Change 34234 by [EMAIL PROTECTED] on 2008/08/28 13:11:44
Fix #30660: Repeated spaces on shebang line stops option parsing
From a patch and test sent by Renée Bäcker in
<[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/perl.c#874 edit
... //depot/perl/t/run/switches.t#28 edit
Differences ...
==== //depot/perl/perl.c#874 (text) ====
Index: perl/perl.c
--- perl/perl.c#873~34225~ 2008-08-24 08:23:41.000000000 -0700
+++ perl/perl.c 2008-08-28 06:11:44.000000000 -0700
@@ -3431,8 +3431,10 @@
return s;
case '*':
case ' ':
- if (s[1] == '-') /* Additional switches on #! line. */
- return s+2;
+ while( *s == ' ' )
+ ++s;
+ if (s[0] == '-') /* Additional switches on #! line. */
+ return s+1;
break;
case '-':
case 0:
==== //depot/perl/t/run/switches.t#28 (text) ====
Index: perl/t/run/switches.t
--- perl/t/run/switches.t#27~34184~ 2008-08-08 02:59:45.000000000 -0700
+++ perl/t/run/switches.t 2008-08-28 06:11:44.000000000 -0700
@@ -11,7 +11,7 @@
BEGIN { require "./test.pl"; }
-plan(tests => 69);
+plan(tests => 70);
use Config;
@@ -350,3 +350,19 @@
stdin => 'zomtek',
);
is( $r, "affe\n", '-E works outside of the block created by -n' );
+
+# RT #30660
+
+$filename = tempfile();
+SKIP: {
+ open my $f, ">$filename" or skip( "Can't write temp file $filename: $!" );
+ print $f <<'SWTEST';
+#!perl -w -iok
+print "$^I\n";
+SWTEST
+ close $f or die "Could not close: $!";
+ $r = runperl(
+ progfile => $filename,
+ );
+ like( $r, qr/ok/, 'Spaces on the #! line (#30660)' );
+}
End of Patch.