Skip to content

Commit

Permalink
Be careful when applying EXE_SHELL
Browse files Browse the repository at this point in the history
$EXE_SHELL should only be used with out own programs, not with
surrounding programs such as the perl interpreter.

Reviewed-by: Matt Caswell <[email protected]>
  • Loading branch information
levitte committed Jan 27, 2016
1 parent 8f24301 commit ec307bc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/testlib/OpenSSL/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit ec307bc

Please sign in to comment.