[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Let autom4te process arbitrary file names
From: |
Benoit Sigoure |
Subject: |
Re: Let autom4te process arbitrary file names |
Date: |
Sat, 24 Nov 2007 15:24:33 +0100 |
Hi Ralf,
On Nov 23, 2007, at 7:52 PM, Ralf Wildenhues wrote:
OK to apply?
See my comment below.
I did not use AT_DATA in the test because I'm not sure we want to
set in stone how it copes with special characters in its first
argument (I don't remember how it used to be when AT_DATA was used
for cleanup purposes also). I guess that's another TODO item.
* bin/autom4te.in (files_to_options): Quote active characters
for the shell.
Yup, this has been in my TODO list for quite a while (when I posted
my patch series to implement "unbootstrap" -- which I've imported in
a topic branch in Git btw -- Paul noted that autoreconf had this
problem in all its xsystem calls).
* tests/tools.at (autom4te and white space in file names):
New test.
diff --git a/bin/autom4te.in b/bin/autom4te.in
index 19bb964..517dcde 100644
--- a/bin/autom4te.in
+++ b/bin/autom4te.in
@@ -235,14 +235,16 @@ sub files_to_options (@)
my @res;
foreach my $file (@file)
{
+ (my $arg = $file) =~ s/'/'\\''/;
This line of code isn't exercised by the testsuite.
if ($file =~ /\.m4f$/)
{
- push @res, "--reload-state=$file";
+ $arg = "--reload-state=$file";
}
- else
+ if ($file =~ /[\t "'\\\$()]/)
{
- push @res, $file;
+ $arg = "'$arg'";
}
+ push @res, $arg;
}
return join ' ', @res;
}
diff --git a/tests/tools.at b/tests/tools.at
index aca2808..1877391 100644
--- a/tests/tools.at
+++ b/tests/tools.at
@@ -138,6 +138,21 @@ AT_CHECK([cat file], 0,
AT_CLEANUP
+# autom4te and file names containing white space
+# ----------------------------------------------
+
+AT_SETUP([autom4te and white space in file names])
+
+cat >'file with funny name.m4' <<'END'
+right
+END
+AT_CHECK_AUTOM4TE([-o 'file with funny name' 'file with funny
name.m4'])
+
+AT_CHECK([cat 'file with funny name'], [],
+[[right
+]])
+
+AT_CLEANUP
## ------------------ ##
So I you add another test that has both spaces and single quotes and
backslashes and maybe \' in its name, to ensure that it really works
with arbitrary file names. If you don't want to deal with the stuff
in autoreconf, then just don't bother about it, I'll cook a couple of
patches... when I'll have some free time in my hands :)
--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory
PGP.sig
Description: This is a digitally signed message part