From: Ralf Wildenhues Date: Mon, 26 Nov 2007 18:40:50 +0000 (+0100) Subject: Fix autom4te for unusual characters in input file names. X-Git-Tag: v2.62~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=952adbf38941fb36b345aa4efb861fa8efd9f2e5;p=thirdparty%2Fautoconf.git 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. --- diff --git a/ChangeLog b/ChangeLog index 7d35a0bd..b1af40eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-11-26 Ralf Wildenhues + 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) : Document that Tru64 awk always splits $0. diff --git a/bin/autom4te.in b/bin/autom4te.in index 19bb9647..b273b9a0 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/'/'\\''/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; } diff --git a/tests/tools.at b/tests/tools.at index aca28089..4096d9e5 100644 --- a/tests/tools.at +++ b/tests/tools.at @@ -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 ## ------------------ ##