httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rodent of Unusual Size <Ken.C...@Golux.Com>
Subject qw() and embedded spaces in filname paths
Date Thu, 15 Apr 2004 21:13:46 GMT
okey, bug found.  noticed on windows because spaces in filenames
are more common there, but it happens anywhere.

here's the deal.  this command:

perl Makefile.PL -httpd "C:/A B/apache.exe" -apxs "C:/A B/apxs"

results in the following being put into t/TEST

%Apache::testConfig::Argv = qw(httpd C:\A B\apache.exe apxs C:\A B\apxs)

so, duh, the spaces lose their significance because qw() is treating
the whitespace as delimiters.

here is a *really* rough patch that should fix this.  it needs to
be cleaned up by some perl guru, and probably applied to other files
that do this as well (like TestMM.pm).  comments?


Index: Apache-Test/lib/Apache/TestRun.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.163
diff -u -r1.163 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm	5 Apr 2004 04:35:21 -0000	1.163
+++ Apache-Test/lib/Apache/TestRun.pm	15 Apr 2004 21:11:36 -0000
@@ -1221,8 +1221,19 @@

     $body .= Apache::TestConfig->modperl_2_inc_fixup;

-    if (@Apache::TestMM::Argv) {
-        $body .= "\n\%Apache::TestConfig::Argv = qw(@Apache::TestMM::Argv);\n";
+    if (my @args = @Apache::TestMM::Argv) {
+        $body .= "\n\%Apache::TestConfig::Argv = (";
+	my ($k, $v);
+	while (@args) {
+	    $k = shift @args;
+	    $k =~ s/'/\\'/g;
+	    $body .= "'$k' => ";
+	    $v = shift @args;
+	    $v =~ s/'/\\'/g;
+	    $body .= "'$v'";
+	    $body .= ', ' if @args;
+	}
+	$body .= ");\n";
     }

     my $header = Apache::TestConfig->perlscript_header;

-- 
#ken	P-)}

Ken Coar, Sanagendamgagwedweinini  http://Ken.Coar.Org/
Author, developer, opinionist      http://Apache-Server.Com/

"Millennium hand and shrimp!"

Mime
View raw message