[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Suppress logging during _AS_LINENO_PREPARE
From: |
Eric Blake |
Subject: |
Suppress logging during _AS_LINENO_PREPARE |
Date: |
Wed, 15 Oct 2008 22:36:37 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
I'm committing this, which fixes libtool; the breakage occurred in commit
http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=01dd2bed
It also fixes a potential bug in status.m4. Right now, m4_rename is
undocumented, and it is unsafe - it copies the topmost definition to the new
name, but doesn't check whether the new name is previously defined, and blows
away all hidden pushdef'd values of the old name. A safer definition would
verify that the new name is undefined, then transfer the entire stack of
definitions; but this is overkill for our internal usage where we never rename
something with multiple definitions (including in libtool's current usage, yet
another use of undocumented stuff that needs cleaning now that we are
documenting AS_INIT_GENERATED). Maybe I'll write a patch that moves the
current m4_rename to _m4_rename, then write and document an m4_rename wrapper
that does the safer but slower behavior.
For now, I'm just leaving m4_rename undocumented, but fixing autoconf's
recommendations to honor a stack of AS_MESSAGE_LOG_FD values. It turns out
that AS_MESSAGE recognizes either an empty AS_MESSAGE_LOG_FD or an undefined
macro as a reason to not use _AS_ECHO_LOG, thus breaking the circular
AS_REQUIRE chain on _AS_LINENO_PREPARE is as easy as using a pushdef stack on
AS_MESSAGE_LOG_FD.
From: Eric Blake <address@hidden>
Date: Wed, 15 Oct 2008 16:15:52 -0600
Subject: [PATCH] Break circular require chain in _AS_LINENO_PREPARE.
* lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): Ensure that logging is
disabled when reporting LINENO failure, since logging requires
LINENO.
* doc/autoconf.texi (Initialization Macros): Recommend m4_pushdef,
not m4_rename, since the latter is undocumented.
* lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Avoid
m4_rename, as it does not yet handle pushdef stacks.
Reported by Ralf Wildenhues.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 12 ++++++++++++
doc/autoconf.texi | 9 ++++++---
lib/autoconf/status.m4 | 4 ++--
lib/m4sugar/m4sh.m4 | 4 ++++
4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d4619b9..e627d14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2008-10-15 Eric Blake <address@hidden>
+ Break circular require chain in _AS_LINENO_PREPARE.
+ * lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): Ensure that logging is
+ disabled when reporting LINENO failure, since logging requires
+ LINENO.
+ * doc/autoconf.texi (Initialization Macros): Recommend m4_pushdef,
+ not m4_rename, since the latter is undocumented.
+ * lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Avoid
+ m4_rename, as it does not yet handle pushdef stacks.
+ Reported by Ralf Wildenhues.
+
+2008-10-15 Eric Blake <address@hidden>
+
Cleanups to previous patches.
* doc/autoconf.texi (Portable Shell): Minor edits.
(Limitations of Builtins): Touch up wording.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index b3ffc76..43227a6 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -11978,11 +11978,14 @@ Initialization Macros
In particular, a line containing @code{#!$SHELL} must have already been
emitted to the child script; you should not use @code{#!/bin/sh}, or the
child script will not use the more modern shell that the parent script
-might have detected. Currently, the suggested idiom for writing a M4sh
+might have detected. Likewise, the child script starts life without a
+log file open, so you must temporarily disable any attempts to use the
+log file until after emitting code to open a log within the child.
+Currently, the suggested idiom for writing a M4sh
shell script from within another script is:
@example
-m4_rename([AS_MESSAGE_LOG_FD], [save_AS_MESSAGE_LOG_FD])dnl
+m4_pushdef([AS_MESSAGE_LOG_FD])dnl
cat > "@var{file}" <<__EOF__
#! $SHELL
# Generated by $as_me.
@@ -11995,7 +11998,7 @@ Initialization Macros
AS_INIT_GENERATED
# ...
__EOF__
-m4_rename([save_AS_MESSAGE_LOG_FD], [AS_MESSAGE_LOG_FD])dnl
+m4_popdef([AS_MESSAGE_LOG_FD])dnl
@end example
This, however, may change in the future as the M4sh interface is
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index 6d622b9..26fa2cf 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -1317,7 +1317,7 @@ fi
m4_define([_AC_OUTPUT_CONFIG_STATUS],
[AC_MSG_NOTICE([creating $CONFIG_STATUS])
dnl AS_MESSAGE_LOG_FD is not available yet:
-m4_rename([AS_MESSAGE_LOG_FD], [_AC_save_AS_MESSAGE_LOG_FD])dnl
+m4_pushdef([AS_MESSAGE_LOG_FD])dnl
cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#! $SHELL
# Generated by $as_me.
@@ -1541,7 +1541,7 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
dnl Open the log:
-m4_rename([_AC_save_AS_MESSAGE_LOG_FD], [AS_MESSAGE_LOG_FD])dnl
+m4_popdef([AS_MESSAGE_LOG_FD])dnl
exec AS_MESSAGE_LOG_FD>>config.log
{
echo
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index b42e87f..44c8049 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -953,6 +953,9 @@ m4_defun([_AS_LINENO_PREPARE],
[AS_REQUIRE([_AS_CR_PREPARE])dnl
AS_REQUIRE([_AS_ME_PREPARE])dnl
_AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])dnl
+dnl Even if the logging fd is open, we don't want to use $LINENO in the
+dnl AS_ERROR complaining that LINENO is broken.
+m4_pushdef([AS_MESSAGE_LOG_FD])dnl
_AS_LINENO_WORKS || {
dnl Create $as_me.lineno as a copy of $as_myself, but with $LINENO
@@ -989,6 +992,7 @@ _AS_LINENO_WORKS || {
# Exit status is that of the last command.
exit
}
+m4_popdef([AS_MESSAGE_LOG_FD])dnl
])# _AS_LINENO_PREPARE
--
1.6.0.2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Suppress logging during _AS_LINENO_PREPARE,
Eric Blake <=