Skip to content

Commit ae8f333

Browse files
Brad Bardenbingos
authored andcommitted
Fix PERL_MM_SHEBANG when input script has args
In _fixin_replace_shebang, empty the argument string when PERL_MM_SHEBANG=relocatable is set in the environment. Previously, if a script had a shebang such as "#!/usr/bin/env perl" already, it would become "#!/usr/bin/env perl perl"; on most systems, env will then try to run "perl perl" and fail. The same issue exists if the script had a shebang with any arguments. Note that this occurs with the env utility before perl does its special argument-list-as-a-string handling. No arguments can be portably preserved when using this override.
1 parent 5ff7f74 commit ae8f333

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
Core fixes:
77
- Disable XS prototypes by default
8+
- Do not copy args when using PERL_MM_SHEBANG=relocatable
89

910
Test fixes:
1011
- Make macros portably in basic.t

lib/ExtUtils/MM_Unix.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,7 @@ sub _fixin_replace_shebang {
13221322
my $interpreter;
13231323
if ( defined $ENV{PERL_MM_SHEBANG} && $ENV{PERL_MM_SHEBANG} eq "relocatable" ) {
13241324
$interpreter = "/usr/bin/env perl";
1325+
$arg = '';
13251326
}
13261327
elsif ( $cmd =~ m{^perl(?:\z|[^a-z])} ) {
13271328
if ( $Config{startperl} =~ m,^\#!.*/perl, ) {

0 commit comments

Comments
 (0)