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
** 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
# 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])
]], [])])
+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. ##
## -------------------------------------- ##