stas 2004/04/16 13:29:23
Modified: perl-framework/Apache-Test Changes
perl-framework/Apache-Test/lib/Apache TestConfig.pm
TestConfigParse.pm TestRun.pm
Log:
Quote and escape the executables in the shell calls
Revision Changes Path
1.124 +2 -0 httpd-test/perl-framework/Apache-Test/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Changes,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -u -r1.123 -r1.124
--- Changes 16 Apr 2004 19:23:40 -0000 1.123
+++ Changes 16 Apr 2004 20:29:23 -0000 1.124
@@ -8,6 +8,8 @@
=item 1.10-dev
+Quote and escape the executables in the shell calls [Ken Coar, Stas]
+
Quote and escape filtered args received during 'perl Makefile.PL'
[Geoffrey Young, Ken Coar]
1.222 +12 -2
httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm
Index: TestConfig.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.221
retrieving revision 1.222
diff -u -u -r1.221 -r1.222
--- TestConfig.pm 15 Apr 2004 13:00:24 -0000 1.221
+++ TestConfig.pm 16 Apr 2004 20:29:23 -0000 1.222
@@ -1526,7 +1526,8 @@
my($self, $q, $ok_fail) = @_;
return unless $self->{APXS};
my $devnull = devnull();
- my $val = qx($self->{APXS} -q $q 2>$devnull);
+ my $apxs = shell_ready($self->{APXS});
+ my $val = qx($apxs -q $q 2>$devnull);
chomp $val if defined $val; # apxs post-2.0.40 adds a new line
unless ($val) {
if ($ok_fail) {
@@ -1648,6 +1649,7 @@
# httpd opts
my $test_config = Apache::TestConfig->new({thaw=>1});
if (my $httpd = $test_config->{vars}->{httpd}) {
+ $httpd = shell_ready($httpd);
$command = "$httpd -V";
$cfg .= "\n*** $command\n";
$cfg .= qx{$command};
@@ -1656,12 +1658,20 @@
}
# perl opts
- my $perl = $^X;
+ my $perl = shell_ready($^X);
$command = "$perl -V";
$cfg .= "\n\n*** $command\n";
$cfg .= qx{$command};
return $cfg;
+}
+
+# make a string suitable for feed to shell calls (wrap in quotes and
+# escape quotes)
+sub shell_ready {
+ my $arg = shift;
+ $arg =~ s/"/\"/g;
+ return qq["$arg"];
}
1;
1.46 +3 -0
httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigParse.pm
Index: TestConfigParse.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigParse.pm,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -u -r1.45 -r1.46
--- TestConfigParse.pm 7 Apr 2004 22:11:58 -0000 1.45
+++ TestConfigParse.pm 16 Apr 2004 20:29:23 -0000 1.46
@@ -364,6 +364,7 @@
my $httpd = $self->{vars}->{httpd};
return unless $httpd;
+ $httpd = shell_ready($httpd);
my $cmd = "$httpd -l";
my $list = $self->open_cmd($cmd);
@@ -384,6 +385,7 @@
my $httpd = $self->{vars}->{httpd};
return unless $httpd;
+ $httpd = shell_ready($httpd);
my $cmd = "$httpd -V";
my $proc = $self->open_cmd($cmd);
@@ -435,6 +437,7 @@
return unless $httpd;
my $version;
+ $httpd = shell_ready($httpd);
my $cmd = "$httpd -v";
my $v = $self->open_cmd($cmd);
1.166 +1 -1
httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm
Index: TestRun.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -u -r1.165 -r1.166
--- TestRun.pm 16 Apr 2004 19:47:42 -0000 1.165
+++ TestRun.pm 16 Apr 2004 20:29:23 -0000 1.166
@@ -1012,7 +1012,7 @@
# test that the base dir is rwx by the selected non-root user
my $vars = $self->{test_config}->{vars};
my $dir = $vars->{t_dir};
- my $perl = $vars->{perl};
+ my $perl = Apache::TestConfig::shell_ready($vars->{perl});
# find where Apache::TestRun was loaded from, so we load this
# exact package from the external process