[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] AC_MSG_ERROR: fix regression in expansion
From: |
Eric Blake |
Subject: |
[PATCH] AC_MSG_ERROR: fix regression in expansion |
Date: |
Thu, 16 Sep 2010 08:55:03 -0600 |
Regression introduced in commit cffdc394.
* lib/m4sugar/m4sh.m4 (AS_ERROR): Avoid macro concatenation.
* tests/m4sh.at (AS_WARN and AS_ERROR): New test.
* NEWS: Document the fix.
* THANKS: Update.
Reported by Adrian Bunk and and Nishio Futoshi.
Signed-off-by: Eric Blake <address@hidden>
---
Wow - testing this was much harder than I originally expected. The bug
requires the use of AS_MESSAGE_LOG_FD and a prior expansion of AS_ERROR
(that is, the first expansion is immune).
Hmm, maybe that means m4_defun_init should be revisited for why the
first instance was immune. Followup patch coming soon.
ChangeLog | 9 +++++++
NEWS | 3 ++
THANKS | 1 +
lib/m4sugar/m4sh.m4 | 2 +-
tests/m4sh.at | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++-
5 files changed, 79 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index be3c8a0..24bddbc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-09-16 Eric Blake <address@hidden>
+
+ AC_MSG_ERROR: fix regression in expansion
+ * lib/m4sugar/m4sh.m4 (AS_ERROR): Avoid macro concatenation.
+ * tests/m4sh.at (AS_WARN and AS_ERROR): New test.
+ * NEWS: Document the fix.
+ * THANKS: Update.
+ Reported by Adrian Bunk and and Nishio Futoshi.
+
2010-09-13 Stefano Lattarini <address@hidden>
tests: simplify grepping of 'automake --version'.
diff --git a/NEWS b/NEWS
index 43e3621..78851b9 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ GNU Autoconf NEWS - User visible changes.
* Noteworthy changes in release ?.? (????-??-??) [?]
+** AC_MSG_ERROR (and AS_ERROR) can once again be followed immediately by
+ `dnl'. Regression introduced in 2.66.
+
** AT_BANNER() with empty argument will cause visual separation from previous
test category.
diff --git a/THANKS b/THANKS
index 06448bd..cb1589b 100644
--- a/THANKS
+++ b/THANKS
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index ca22161..af2a4e4 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -851,7 +851,7 @@ m4_defun_init([AS_ERROR],
[m4_append_uniq([_AS_CLEANUP],
[m4_divert_text([M4SH-INIT-FN], [_AS_ERROR_PREPARE[]])])],
[as_fn_error m4_default([$2], [$?])
"_AS_QUOTE([$1])"m4_ifval(AS_MESSAGE_LOG_FD,
- [ "$LINENO" AS_MESSAGE_LOG_FD])])
+ [ "$LINENO" AS_MESSAGE_LOG_FD[]])])
# AS_LINENO_PUSH([LINENO])
diff --git a/tests/m4sh.at b/tests/m4sh.at
index e73c971..08680c3 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -18,6 +18,71 @@ AT_BANNER([M4sh.])
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+## ------------------- ##
+## AS_WARN, AS_ERROR. ##
+## ------------------- ##
+
+AT_SETUP([AS@&address@hidden and AS@&address@hidden)
+AT_KEYWORDS([m4sh])
+
+dnl without logging
+AT_DATA_M4SH([script.as],
+[[AS_INIT
+AS_WARN([*watch out*])dnl
+
+if test x"$die" != x; then
+ AS_ERROR([you're dead])dnl
+
+ AS_ERROR([really])dnl
+
+fi
+echo got here
+]])
+
+AT_CHECK_M4SH
+AT_CHECK([$CONFIG_SHELL ./script], [],
+[[got here
+]], [[script: WARNING: *watch out*
+]])
+AT_CHECK([die=: $CONFIG_SHELL ./script], [1],
+[], [[script: WARNING: *watch out*
+script: error: you're dead
+]])
+
+dnl with logging
+rm script
+AT_DATA_M4SH([script.as],
+[[AS_INIT
+m4_define([gone], [AS_ERROR([really])])
+m4_define([AS_MESSAGE_LOG_FD], [5])
+exec AS_MESSAGE_LOG_FD>log.txt
+AS_WARN([*watch out*])dnl
+
+if test x"$die" != x; then
+ AS_ERROR([you're dead])dnl
+
+ AS_ERROR([really])dnl
+
+fi
+echo got here
+exec AS_MESSAGE_LOG_FD>&-
+]])
+
+AT_CHECK_M4SH
+AT_CHECK([$CONFIG_SHELL ./script], [],
+[[got here
+]], [[script: WARNING: *watch out*
+]])
+AT_CHECK([[grep 'script:[0-9]*: WARNING: \*watch out\*' log.txt]], [],
[ignore])
+AT_CHECK([die=: $CONFIG_SHELL ./script], [1],
+[], [[script: WARNING: *watch out*
+script: error: you're dead
+]])
+AT_CHECK([[grep 'script:[0-9]*: WARNING: \*watch out\*' log.txt]], [],
[ignore])
+AT_CHECK([[grep 'script:[0-9]*: error: you'\''re dead' log.txt]], [], [ignore])
+
+AT_CLEANUP
+
## ---------------- ##
## LINENO support. ##
## ---------------- ##
@@ -95,7 +160,6 @@ AT_CHECK([sh ./test/test-2], 0,
[expout])
AT_CLEANUP
-
## ---------------------- ##
## LINENO stack support. ##
## ---------------------- ##
--
1.7.2.3
- [PATCH] AC_MSG_ERROR: fix regression in expansion,
Eric Blake <=