]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix quoting of m4 macros in AT_CHECK.
authorEric Blake <ebb9@byu.net>
Thu, 23 Apr 2009 04:06:04 +0000 (22:06 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 24 Apr 2009 19:15:31 +0000 (13:15 -0600)
* lib/autotest/general.m4 (AT_CHECK): Expand prior to adding
escapes, to avoid shell syntax errors caused by late macro
expansion.
* NEWS: Document this change.
* tests/autotest.at (Metacharacters in command from M4 expansion):
New test.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
NEWS
lib/autotest/general.m4
tests/autotest.at

index 5d3c45c852a8c9a36d866bba784e0d5328c32d9c..0c243cadf6e225b1a16fb4a8a20efb54edbcb897 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-04-24  Eric Blake  <ebb9@byu.net>
 
+       Fix quoting of m4 macros in AT_CHECK.
+       * lib/autotest/general.m4 (AT_CHECK): Expand prior to adding
+       escapes, to avoid shell syntax errors caused by late macro
+       expansion.
+       * NEWS: Document this change.
+       * tests/autotest.at (Metacharacters in command from M4 expansion):
+       New test.
+
        manual: Use consistent spelling of here-document.
        * doc/autoconf.texi (Defining Symbols, Programming in M4sh)
        (Common Shell Constructs, Macro Names, Writing Testsuites): Fix
diff --git a/NEWS b/NEWS
index 2831d664dc0cfef03ffeab8c3775c959c6ffa2a7..11466d6a93f8a9d8fe4dc38c9ed8a9bf7141916c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ GNU Autoconf NEWS - User visible changes.
 ** Ensure AT_CHECK can support commands that include a # given with
    proper m4 quoting.  For shell comments, this is a new feature; for
    non-shell comments, this fixes a regression introduced in 2.63b.
+   Additionally, AT_CHECK correctly supplies shell escapes for
+   metacharacters occurring in m4 macro expansions within the expected
+   stdout and stderr parameters.
 
 ** The macro AT_CHECK now understands the concept of hard failure.  If
    a test exits with an unexpected status 99, cleanup actions for the
index a16224b8980c37b6be4b4426bb924af626fe78ba..ce653978d10d33253ff3b2e09ef00a3e7b41d6d7 100644 (file)
@@ -1901,8 +1901,8 @@ $2[]_ATEOF
 # This may cause spurious failures when the test suite is run with `-x'.
 #
 _AT_DEFINE_SETUP([AT_CHECK],
-[_AT_CHECK(m4_expand([$1]), [$2], m4_expand([AS_ESCAPE([$3])]),
-  m4_expand([AS_ESCAPE([$4])]), [$5], [$6])])
+[_AT_CHECK(m4_expand([$1]), [$2], AS_ESCAPE(m4_dquote(m4_expand([$3]))),
+  AS_ESCAPE(m4_dquote(m4_expand([$4]))), [$5], [$6])])
 
 # AT_CHECK_UNQUOTED(COMMANDS, [STATUS = 0], STDOUT, STDERR,
 #                   [RUN-IF-FAIL], [RUN-IF-PASS])
index 0fad78db67a075aa5dc43eaa3ec756ce6409d46b..d86088c6f09ed68f1a0398dc9eb26af231811e5d 100644 (file)
@@ -491,6 +491,12 @@ bar'])
 ]], [])])
 
 
+AT_CHECK_AT_TEST([Metacharacters in command from M4 expansion],
+  [m4_define([GNU], [\"`])
+   AT_CHECK([echo '\"`' [GNU] 'GNU'], 0, [GNU [G][NU] [\"`
+]], [])])
+
+
 ## -------------------------------------- ##
 ## Backslash-<newline> in test commands.  ##
 ## -------------------------------------- ##