]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix autom4te for unusual characters in input file names.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 26 Nov 2007 18:40:50 +0000 (19:40 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 26 Nov 2007 18:40:50 +0000 (19:40 +0100)
* bin/autom4te.in (files_to_options): Quote active characters
for the shell.
* tests/tools.at (autom4te and white space in file names):
New test.

ChangeLog
bin/autom4te.in
tests/tools.at

index 7d35a0bd34bc98577390e3bc4ee85fc61e0ba01d..b1af40eb56cef0a4806c1eacfea823e12e4230fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2007-11-26  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Fix autom4te for unusual characters in input file names.
+       * bin/autom4te.in (files_to_options): Quote active characters
+       for the shell.
+       * tests/tools.at (autom4te and white space in file names):
+       New test.
+
        * doc/autoconf.texi (Limitations of Usual Tools) <awk>:
        Document that Tru64 awk always splits $0.
 
index 19bb96474b7331e75c2626ae859994a7deaf2c29..b273b9a08f6c4166ae079937e44a2f0a1d9a53d1 100644 (file)
@@ -235,14 +235,16 @@ sub files_to_options (@)
   my @res;
   foreach my $file (@file)
     {
+      (my $arg = $file) =~ s/'/'\\''/g;
       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;
 }
index aca280893b738f41b2e2bf2b8ac48a9d0c9b6959..4096d9e5c97b45fce940ee4f4bf5ed35d217f270 100644 (file)
@@ -138,6 +138,24 @@ AT_CHECK([cat file], 0,
 AT_CLEANUP
 
 
+# autom4te and file names containing white space
+# ----------------------------------------------
+
+AT_SETUP([autom4te and white space in file names])
+
+file='file with  funny \ '\'' \'\'' $ & #!*? name'
+cat >"$file.m4" <<'END'
+right
+END
+# skip if we cannot create such a file
+AT_CHECK([test -f "$file.m4" || exit 77])
+AT_CHECK_AUTOM4TE([-o "$file" "$file.m4"])
+
+AT_CHECK([cat "$file"], [],
+[[right
+]])
+
+AT_CLEANUP
 
 
 ## ------------------ ##