]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Properly handle funny file names for headers in config.status.
authorBenoit Sigoure <tsuna@lrde.epita.fr>
Tue, 18 Dec 2007 12:54:07 +0000 (13:54 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 2 Mar 2008 12:00:23 +0000 (13:00 +0100)
The test suite did not cover this bug because the code was not
quoting properly the arguments of `rm -f' (which "fails" silently)
as well as the arguments of `diff' (whose output was redirected to
/dev/null so we couldn't see its error message).
* lib/autoconf/status.m4 (_AC_OUTPUT_HEADER): Properly quote the
file names passed to `rm' and `diff'.
* tests/torture.at (AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS):
Add a regression test.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
lib/autoconf/status.m4
tests/torture.at

index 38cfe8e622cf0ae7e9e3e0737d6d66785a70e0d1..c480adff12e6de90d78df47b31cdfade3cc0b0ee 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-03-01  Benoit Sigoure  <tsuna@lrde.epita.fr>
+
+       Properly handle funny file names for headers in config.status.
+       The test suite did not cover this bug because the code was not
+       quoting properly the arguments of `rm -f' (which "fails" silently)
+       as well as the arguments of `diff' (whose output was redirected to
+       /dev/null so we couldn't see its error message).
+       * lib/autoconf/status.m4 (_AC_OUTPUT_HEADER): Properly quote the
+       file names passed to `rm' and `diff'.
+       * tests/torture.at (AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS):
+       Add a regression test.
+
 2008-03-01  Benoit Sigoure  <tsuna@lrde.epita.fr>
        and Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
index 398d0cbadd36f50703a74aa69a2ab86631caf609..c8f329ab87d2e93f12bdda5a19214537d746a15f 100644 (file)
@@ -864,10 +864,10 @@ m4_define([_AC_OUTPUT_HEADER],
       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
     } >"$tmp/config.h" \
       || AC_MSG_ERROR([could not create $ac_file])
-    if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
+    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
       AC_MSG_NOTICE([$ac_file is unchanged])
     else
-      rm -f $ac_file
+      rm -f "$ac_file"
       mv "$tmp/config.h" "$ac_file" \
        || AC_MSG_ERROR([could not create $ac_file])
     fi
@@ -879,7 +879,7 @@ m4_define([_AC_OUTPUT_HEADER],
 dnl If running for Automake, be ready to perform additional
 dnl commands to set up the timestamp files.
 m4_ifdef([_AC_AM_CONFIG_HEADER_HOOK],
-        [_AC_AM_CONFIG_HEADER_HOOK([$ac_file])
+        [_AC_AM_CONFIG_HEADER_HOOK(["$ac_file"])
 ])dnl
 ])# _AC_OUTPUT_HEADER
 
index b179afe241d255add0a77224cb46e369a23f137f..c052c049775ea03d628f2c9f08dd192baad9dbd3 100644 (file)
@@ -274,6 +274,15 @@ AT_CHECK([grep OK "$file"], [], [OK
 ])
 AT_CHECK([./config.status "--header=$file:$file.in"],
         [0], [ignore])
+# Run the same test a 2nd time to see that config.status does not recreate
+# the header (regression test)
+AT_CHECK([./config.status "--header=$file:$file.in"],
+        [0], [config.status: creating file with  funny \ ' \' $ & #!*? name
+config.status: file with  funny \ ' \' $ & #!*? name is unchanged
+])
+AT_CHECK([grep ' & ' "$file"], [],
+[/* file with  funny \ ' \' $ & #!*? name.  Generated from file with  funny \ ' \' $ & #!*? name.in by configure.  */
+])
 AT_CHECK([grep OK "$file"], [], [OK
 ])
 AT_CLEANUP