autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Let autom4te process arbitrary file names


From: Ralf Wildenhues
Subject: Let autom4te process arbitrary file names
Date: Fri, 23 Nov 2007 19:52:53 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

OK to apply?

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.

Cheers,
Ralf

        * bin/autom4te.in (files_to_options): Quote active characters
        for the shell.
        * 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/'/'\\''/;
       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
 
 
 ## ------------------ ##




reply via email to

[Prev in Thread] Current Thread [Next in Thread]