From: Jacob Bachmeyer Date: Sat, 27 Feb 2021 22:30:20 +0000 (-0600) Subject: Override configuration directories in testing mode X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5d4817ce5879de3dc5d15d002322a053b4752463;p=gatekeeper.git Override configuration directories in testing mode --- diff --git a/upload-ftp-v1.2.pl b/upload-ftp-v1.2.pl index 09dc0b2..7553478 100755 --- a/upload-ftp-v1.2.pl +++ b/upload-ftp-v1.2.pl @@ -236,6 +236,18 @@ my $facility = "LOCAL5"; if (IN_TEST_MODE) { # override the above for testing # override PATH # override file paths to our testcase environment + { + # Again, the test environment is trusted, but we still run in taint mode. + $ENV{TEST_BASE_DIR} =~ m/^([[:graph:] ]+$)/ && -d $1 + or die "ftp-upload: test mode: TEST_BASE_DIR not valid"; + my $basedir = $1; # untainted + $package_config_base = File::Spec->catdir($basedir, 'packages'); + $incoming_dir = File::Spec->catdir($basedir, 'incoming'); + $incoming_tmp = File::Spec->catdir($basedir, 'in-stage'); + $destfinal = File::Spec->catdir($basedir, 'pub'); + $olddestfinal = File::Spec->catdir($basedir, 'archive'); + $desttmp = File::Spec->catdir($basedir, 'stage'); + } # verify mock gpgv { open my $gpgv,'-|',GPGV_BIN, '--version'