[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix chdir-long.m4 caching

From: Ralf Wildenhues
Subject: Re: Fix chdir-long.m4 caching
Date: Tue, 26 Sep 2006 20:03:36 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

Hello Eric, Stepan,

* Stepan Kasal wrote on Tue, Sep 26, 2006 at 03:29:56PM CEST:
> On Tue, Sep 26, 2006 at 06:09:51AM -0600, Eric Blake wrote:
> > According to Ralf Wildenhues on 9/25/2006 11:00 PM:
> > > I'm still not sure whether the following is safe.
> > It looks right to me - [...]
> FWIIW, I canot see any problem with Ralf's version either.

Well, here you go.  First, the patch makes the `AC_CACHE_CHECK' test
fail, so is incomplete.  So here's a patch to fix the test, also test
that we warn in the literal case, and add a case with a m4 macro.  This
is where my previous patch failed.  I guess you'd suggest I need to rip
off a set of `[]' quotes from the second argument of AC_CACHE_CHECK.
I'd argue that this could be a backward incompatibility for user code.

So here's an updated patch that hopefully catches this as well.  I'll
apply in a couple of days, given absense of objections.  (I'm usually a
bit reluctant to just "fix" testcases: after all, somebody may have
added them on purpose, so that exactly that code continues to work as


2006-09-26  Eric Blake  <address@hidden>
        and Ralf Wildenhues  <address@hidden>

        * lib/autoconf/general.m4 (AC_CACHE_VAL): Warn if cache-id is not
        * tests/ (AC_CACHE_CHECK): Adjust test to expect this,
        also test that macro names and correct literals are not checked.

Index: lib/autoconf/general.m4
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.930
diff -u -r1.930 general.m4
--- lib/autoconf/general.m4     14 Sep 2006 09:40:59 -0000      1.930
+++ lib/autoconf/general.m4     26 Sep 2006 18:02:29 -0000
@@ -1905,7 +1905,12 @@
 # The name of shell var CACHE-ID must contain `_cv_' in order to get saved.
 # Should be dnl'ed.  Try to catch common mistakes.
-[m4_bmatch([$2], [AC_DEFINE],
+  [m4_ifndef([$1],
+     [m4_bmatch([$1], [_cv_], [],
+       [AC_DIAGNOSE([syntax],
+[$0($1, ...): suspicious cache-id, must contain _cv_ to be cached])])])])dnl
+m4_bmatch([$2], [AC_DEFINE],
 [$0($1, ...): suspicious presence of an AC_DEFINE in the second argument, ]dnl
 [where no actions should be taken])])dnl
Index: tests/
RCS file: /cvsroot/autoconf/autoconf/tests/,v
retrieving revision 1.39
diff -u -r1.39
--- tests/       2 Sep 2006 05:37:08 -0000       1.39
+++ tests/       26 Sep 2006 18:02:29 -0000
@@ -204,16 +204,30 @@
 ## ---------------- ##
 # Make sure AC_CACHE_CHECK is silent with -q.
+# Also make sure we warn about cache id's not named with `_cv_'.
+# m4_define([ac_nothing], [ac_cv_absolutely_nothing])
 AC_CACHE_CHECK([for nothing],
+# A little hack, as AT_CHECK_M4 already uses `stderr' to normalize it.
+AT_CHECK_AUTOCONF([2>&1], [], [stdout])
+AT_CHECK([grep 'must contain _cv_ to be cached' stdout], [], [ignore])
+# Do not warn about defines:
+sed 's,^# ,,' > t
+mv -f t
+sed '/m4_define/d; s,ac_nothing,ac_cv_nothing,' > t
+mv -f t

reply via email to

[Prev in Thread] Current Thread [Next in Thread]