pm_filter: use \Q...\E to escape all possible strings pedantically

The current implementation would misbehave for prefixes containing
a single quote.
master
Simon McVittie 2016-09-03 23:46:33 +01:00
parent 276f0cf578
commit 06fce2b238
1 changed files with 4 additions and 4 deletions

View File

@ -7,10 +7,10 @@ BEGIN {
} }
if (/INSTALLDIR_AUTOREPLACE/) { if (/INSTALLDIR_AUTOREPLACE/) {
$_=qq{our \$installdir='$prefix';}; $_=qq{our \$installdir="\Q$prefix\E";};
} }
elsif (/VERSION_AUTOREPLACE/) { elsif (/VERSION_AUTOREPLACE/) {
$_=qq{our \$version="$ver";}; $_=qq{our \$version="\Q$ver\E";};
} }
elsif (/^(?:use FindBin; *)?use lib/) { elsif (/^(?:use FindBin; *)?use lib/) {
# The idea here is to figure out if the libdir the Makefile.PL # The idea here is to figure out if the libdir the Makefile.PL
@ -22,12 +22,12 @@ elsif (/^(?:use FindBin; *)?use lib/) {
$_=""; $_="";
} }
else { else {
$_="use lib '$libdir';\n"; $_="use lib \"\Q$libdir\E\";\n";
} }
} }
elsif ($. == 1 && ($ENV{NOTAINT}=0) && m{^(#!.*perl.*?)$}) { elsif ($. == 1 && ($ENV{NOTAINT}=0) && m{^(#!.*perl.*?)$}) {
$_=qq{$1 -T\n}; $_=qq{$1 -T\n};
} }
elsif (/^\$ENV\{PATH}="(.*)";/) { elsif (/^\$ENV\{PATH}="(.*)";/) {
$_="\$ENV{PATH}=\"$1:$prefix/bin\";\n"; $_="\$ENV{PATH}=\"\Q$1\E:\Q$prefix\E/bin\";\n";
} }