autoconf-patches
[Top][All Lists]
Advanced

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

Detect override of precious vars with braces


From: Ralf Wildenhues
Subject: Detect override of precious vars with braces
Date: Fri, 7 Apr 2006 16:05:59 +0200
User-agent: Mutt/1.5.11

There is a bug wrt. precious variables, when the cached value contains
braces.  Following is a description of the bug and a patch including an
update to the AC_ARG_VAR test to catch this.  Credit for analysis,
description and patch go to Stepan Kasal, I merely did the test case.

OK to apply?

Cheers,
Ralf


This is correct:

$ rm config.cache
$ ./configure -C EMACS=em1
configure: creating cache config.cache
...
$ ./configure -C EMACS=em2
configure: loading cache config.cache
configure: error: `EMACS' has changed since the previous run:
configure:   former value:  em1
configure:   current value: em2
configure: error: changes in the environment can compromise the build

But the following is a bug:

$ rm config.cache
$ ./configure -C EMACS=em1{}
...
$ ./configure -C EMACS=em2
...

This is because config.cache contains:
ac_cv_env_EMACS_set=set
test "${ac_cv_env_EMACS_value+set}" = set || ac_cv_env_EMACS_value='em1{}'

While is should be
ac_cv_env_EMACS_set=set
ac_cv_env_EMACS_value='em1{}'


2006-04-07  Stepan Kasal  <address@hidden>,
            Ralf Wildenhues  <address@hidden>

        * lib/autoconf/general.m4 (AC_CACHE_SAVE): All `ac_cv_env_foo'
        variables shall be overriden by the cache.
        * tests/torture.at (AC_ARG_VAR): Test also with a first value
        that contains braces.

Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.900
diff -u -r1.900 general.m4
--- lib/autoconf/general.m4     6 Apr 2006 18:16:56 -0000       1.900
+++ lib/autoconf/general.m4     4 Apr 2006 15:33:48 -0000
@@ -1880,11 +1880,12 @@
 
 _AC_CACHE_DUMP() |
   sed ['
+     /^ac_cv_env_/b end
      t clear
      :clear
      s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
      t end
-     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
      :end'] >>confcache
 if diff $cache_file confcache >/dev/null 2>&1; then :; else
   if test -w $cache_file; then
Index: tests/torture.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/torture.at,v
retrieving revision 1.57
diff -u -r1.57 torture.at
--- tests/torture.at    5 Apr 2006 20:55:14 -0000       1.57
+++ tests/torture.at    6 Apr 2006 22:56:27 -0000
@@ -116,6 +116,9 @@
 # Change a precious variable
 AT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye])
 
+# Change a precious variable that contains braces
+AT_CHECK_AC_ARG_VAR([apple of my {eye}], [orange of my eye])
+
 AT_CLEANUP
 
 




reply via email to

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