Hello once more,
attached the patch to the test library of ExtUtils::MakeMaker,
MakeMaker::Test::Utils, and the tests:
1) perl-5.9.5-whitespace-MakeMakerTest.diff
This adds a/the function C<quoted_perl>, which also lives in C<test.pl>
already. But here it is also documented, a bit.
2) perl-5.9.5-whitespace-test.pl.diff
Modifies the tests to use quoted_perl() instead of which_perl() where
appropriate.
-max
diff -bruN clean_blead/perl-5.9.5/lib/ExtUtils/t/basic.t fresh
blead/perl-5.9.5/lib/ExtUtils/t/basic.t
--- clean_blead/perl-5.9.5/lib/ExtUtils/t/basic.t 2007-07-07
15:40:24.000000000 +0200
+++ fresh blead/perl-5.9.5/lib/ExtUtils/t/basic.t 2007-08-19
00:14:11.000000000 +0200
@@ -27,7 +27,7 @@
# with our testing.
delete @ENV{qw(PREFIX LIB MAKEFLAGS)};
-my $perl = which_perl();
+my $perl = quoted_perl();
my $Is_VMS = $^O eq 'VMS';
# GNV logical interferes with testing
diff -bruN clean_blead/perl-5.9.5/lib/ExtUtils/t/Constant.t fresh
blead/perl-5.9.5/lib/ExtUtils/t/Constant.t
--- clean_blead/perl-5.9.5/lib/ExtUtils/t/Constant.t 2007-07-07
15:40:24.000000000 +0200
+++ fresh blead/perl-5.9.5/lib/ExtUtils/t/Constant.t 2007-08-19
00:00:07.000000000 +0200
@@ -32,6 +32,8 @@
# (where ExtUtils::Constant is in the core, and tests against the uninstalled
# perl)
$perl = File::Spec->rel2abs ($perl) unless $] < 5.006;
+
+$perl = qq{"$perl"} if $perl =~ /\s/ and $perl !~ /^["']/;
# ExtUtils::Constant::C_constant uses $^X inside a comment, and we want to
# compare output to ensure that it is the same. We were probably run as ./perl
# whereas we will run the child with the full path in $perl. So make $^X for
diff -bruN clean_blead/perl-5.9.5/lib/ExtUtils/t/FIRST_MAKEFILE.t fresh
blead/perl-5.9.5/lib/ExtUtils/t/FIRST_MAKEFILE.t
--- clean_blead/perl-5.9.5/lib/ExtUtils/t/FIRST_MAKEFILE.t 2007-07-07
15:40:24.000000000 +0200
+++ fresh blead/perl-5.9.5/lib/ExtUtils/t/FIRST_MAKEFILE.t 2007-08-19
00:16:23.000000000 +0200
@@ -17,7 +17,7 @@
use MakeMaker::Test::Setup::BFD;
use MakeMaker::Test::Utils;
-my $perl = which_perl();
+my $perl = quoted_perl();
my $make = make_run();
perl_lib();
diff -bruN clean_blead/perl-5.9.5/lib/ExtUtils/t/INSTALL_BASE.t fresh
blead/perl-5.9.5/lib/ExtUtils/t/INSTALL_BASE.t
--- clean_blead/perl-5.9.5/lib/ExtUtils/t/INSTALL_BASE.t 2007-07-07
15:40:24.000000000 +0200
+++ fresh blead/perl-5.9.5/lib/ExtUtils/t/INSTALL_BASE.t 2007-08-19
00:17:13.000000000 +0200
@@ -22,7 +22,7 @@
my $Is_VMS = $^O eq 'VMS';
-my $perl = which_perl();
+my $perl = quoted_perl();
chdir 't';
perl_lib;
diff -bruN clean_blead/perl-5.9.5/lib/ExtUtils/t/oneliner.t fresh
blead/perl-5.9.5/lib/ExtUtils/t/oneliner.t
--- clean_blead/perl-5.9.5/lib/ExtUtils/t/oneliner.t 2007-07-07
15:40:24.000000000 +0200
+++ fresh blead/perl-5.9.5/lib/ExtUtils/t/oneliner.t 2007-08-22
20:58:13.000000000 +0200
@@ -28,7 +28,9 @@
sub try_oneliner {
my($code, $switches, $expect, $name) = @_;
my $cmd = $mm->oneliner($code, $switches);
- $cmd =~ s{\$\(ABSPERLRUN\)}{$^X};
+ my $Perl = $^X;
+ $Perl = qq{"$Perl"} if $Perl =~ /\s/ and $Perl !~ /^["']/;
+ $cmd =~ s{\$\(ABSPERLRUN\)}{$Perl};
# VMS likes to put newlines at the end of commands if there isn't
# one already.
diff -bruN clean_blead/perl-5.9.5/lib/ExtUtils/t/PL_FILES.t fresh
blead/perl-5.9.5/lib/ExtUtils/t/PL_FILES.t
--- clean_blead/perl-5.9.5/lib/ExtUtils/t/PL_FILES.t 2007-07-07
15:40:24.000000000 +0200
+++ fresh blead/perl-5.9.5/lib/ExtUtils/t/PL_FILES.t 2007-08-19
00:19:40.000000000 +0200
@@ -18,7 +18,7 @@
use MakeMaker::Test::Setup::PL_FILES;
use MakeMaker::Test::Utils;
-my $perl = which_perl();
+my $perl = quoted_perl();
my $make = make_run();
perl_lib();
diff -bruN clean_blead/perl-5.9.5/lib/ExtUtils/t/prereq_print.t fresh
blead/perl-5.9.5/lib/ExtUtils/t/prereq_print.t
--- clean_blead/perl-5.9.5/lib/ExtUtils/t/prereq_print.t 2007-07-07
15:40:24.000000000 +0200
+++ fresh blead/perl-5.9.5/lib/ExtUtils/t/prereq_print.t 2007-08-19
00:20:10.000000000 +0200
@@ -29,7 +29,7 @@
# with our testing.
delete @ENV{qw(PREFIX LIB MAKEFLAGS)};
-my $Perl = which_perl();
+my $Perl = quoted_perl();
my $Makefile = makefile_name();
my $Is_VMS = $^O eq 'VMS';
diff -bruN clean_blead/perl-5.9.5/lib/ExtUtils/t/recurs.t fresh
blead/perl-5.9.5/lib/ExtUtils/t/recurs.t
--- clean_blead/perl-5.9.5/lib/ExtUtils/t/recurs.t 2007-07-07
15:40:24.000000000 +0200
+++ fresh blead/perl-5.9.5/lib/ExtUtils/t/recurs.t 2007-08-19
00:20:38.000000000 +0200
@@ -23,7 +23,7 @@
# with our testing.
delete @ENV{qw(PREFIX LIB MAKEFLAGS)};
-my $perl = which_perl();
+my $perl = quoted_perl();
my $Is_VMS = $^O eq 'VMS';
chdir('t');
diff -bruN clean_blead/perl-5.9.5/lib/ExtUtils/t/split_command.t fresh
blead/perl-5.9.5/lib/ExtUtils/t/split_command.t
--- clean_blead/perl-5.9.5/lib/ExtUtils/t/split_command.t 2007-07-07
15:40:24.000000000 +0200
+++ fresh blead/perl-5.9.5/lib/ExtUtils/t/split_command.t 2007-08-19
00:30:57.000000000 +0200
@@ -20,7 +20,7 @@
use Test::More tests => 7;
-my $perl = which_perl;
+my $perl = quoted_perl;
my $mm = bless { NAME => "Foo" }, "MM";
# I don't expect anything to have a length shorter than 256 chars.
diff -bruN clean_blead/perl-5.9.5/t/lib/MakeMaker/Test/Utils.pm fresh
blead/perl-5.9.5/t/lib/MakeMaker/Test/Utils.pm
--- clean_blead/perl-5.9.5/t/lib/MakeMaker/Test/Utils.pm 2007-07-07
15:40:24.000000000 +0200
+++ fresh blead/perl-5.9.5/t/lib/MakeMaker/Test/Utils.pm 2007-08-19
00:43:04.000000000 +0200
@@ -11,7 +11,7 @@
$VERSION = 0.03;
[EMAIL PROTECTED] = qw(which_perl perl_lib makefile_name makefile_backup
[EMAIL PROTECTED] = qw(which_perl quoted_perl perl_lib makefile_name
makefile_backup
make make_run run make_macro calibrate_mtime
setup_mm_test_root
have_compiler
@@ -62,7 +62,8 @@
my $perl = which_perl;
Returns a path to perl which is safe to use in a command line, no
-matter where you chdir to.
+matter where you chdir to. This is not whitespace safe but
+is safe to use in system(LIST).
=cut
@@ -93,6 +94,22 @@
return $perlpath;
}
+=item B<quoted_perl>
+
+ my $perl = quoted_perl;
+
+Returns a path to perl which is quoted safe to use in a command line,
+even if it contains whitespace. This is intended for interpolation
+into a string and is not safe to use with C<system(LIST)>.
+
+=cut
+
+sub quoted_perl {
+ my $perl = which_perl;
+ $perl = qq{"$perl"} if $perl =~ /\s/ and $perl !~ /^["']/;
+ $perl
+};
+
=item B<perl_lib>
perl_lib;