aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-01-26 17:50:13 +0100
committerRichard Levitte <levitte@openssl.org>2016-01-27 12:11:52 +0100
commitec307bcc36393969967c4156d98fca50cd446c81 (patch)
tree350ccc8f8ffdfd5582715bf7f1ed8bf789612258
parent8f243018d2e5e4dfe988906849a7f30532e288aa (diff)
downloadopenssl-ec307bcc36393969967c4156d98fca50cd446c81.tar.gz
Be careful when applying EXE_SHELL
$EXE_SHELL should only be used with out own programs, not with surrounding programs such as the perl interpreter. Reviewed-by: Matt Caswell <matt@openssl.org>
-rw-r--r--test/testlib/OpenSSL/Test.pm13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/testlib/OpenSSL/Test.pm b/test/testlib/OpenSSL/Test.pm
index 491984cee4..e1c2899c7e 100644
--- a/test/testlib/OpenSSL/Test.pm
+++ b/test/testlib/OpenSSL/Test.pm
@@ -705,12 +705,13 @@ sub __cwd {
sub __fixup_cmd {
my $prog = shift;
+ my $exe_shell = shift;
my $prefix = __top_file("util", "shlib_wrap.sh")." ";
my $ext = $ENV{"EXE_EXT"} || "";
- if (defined($ENV{EXE_SHELL})) {
- $prefix = "$ENV{EXE_SHELL} ";
+ if (defined($exe_shell)) {
+ $prefix = "$exe_shell ";
} elsif ($^O eq "VMS" ) { # VMS
$prefix = ($prog =~ /^[<\[]/ ? "mcr " : "mcr []");
$ext = ".exe";
@@ -754,9 +755,13 @@ sub __build_cmd {
# more than one. If so, only the first is to be considered a
# program to fix up, the rest is part of the arguments. This
# happens for perl scripts, where $path_builder will return
- # a list of two, $^X and the script name
+ # a list of two, $^X and the script name.
+ # Also, if $path_builder returned more than one, we don't apply
+ # the EXE_SHELL environment variable.
my @prog = ($path_builder->(shift @cmdarray));
- my $cmd = __fixup_cmd(shift @prog);
+ my $first = shift @prog;
+ my $exe_shell = @prog ? undef : $ENV{EXE_SHELL};
+ my $cmd = __fixup_cmd($first, $exe_shell);
if (@prog) {
if ( ! -f $prog[0] ) {
print STDERR "$prog[0] not found\n";