]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/general.m4 (_AC_CACHE_DUMP): Fix the detection of
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Thu, 6 Apr 2006 18:16:56 +0000 (18:16 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Thu, 6 Apr 2006 18:16:56 +0000 (18:16 +0000)
whether `set' quotes correctly: redirect stderr of the tested
`set', and use a subshell, for Ultrix; use `sed' instead of
`grep' for zsh `set' which may write binary output; match only
at the beginning of a line, to avoid false positives.
In order to avoid false positives by unrelated variables with
multiline content, put the dump algorithm in a subshell and
unset all variables containing newlines (except some which are
special to the shell).  Warn about cache variables that are
unset.

ChangeLog
lib/autoconf/general.m4

index d15b489f3cb1b0a14be48a89e23e888f427c53c7..d2e697cb46477392d92427f341d24158657151d8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
+2006-04-06  Stepan Kasal  <kasal@ucw.cz>,
+           Eric Blake  <ebb9@byu.net>,
+           Paul Eggert  <eggert@cs.ucla.edu>,
+           Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+       * lib/autoconf/general.m4 (_AC_CACHE_DUMP): Fix the detection of
+       whether `set' quotes correctly: redirect stderr of the tested
+       `set', and use a subshell, for Ultrix; use `sed' instead of
+       `grep' for zsh `set' which may write binary output; match only
+       at the beginning of a line, to avoid false positives.
+       In order to avoid false positives by unrelated variables with
+       multiline content, put the dump algorithm in a subshell and
+       unset all variables containing newlines (except some which are
+       special to the shell).  Warn about cache variables that are
+       unset.
+
 2006-04-06  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       * config/config.guess, config/config.sub, config/texinfo.tex:
+       Sync from upstream.
+
        * tests/mktests.sh: Reword comments.
 
        * tests/mktests.sh: Only skip internal macros starting with
index b44dd92593a0738f3e6a088bb534872de3feb722..c88c3f57ee8d34f747514ecdcb993081ad4b443a 100644 (file)
@@ -1821,26 +1821,39 @@ fi
 m4_define([_AC_CACHE_DUMP],
 [# The following way of writing the cache mishandles newlines in values,
 # but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
+# So, we kill variables containing newlines.
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
-{
+(
+  for ac_var in `(set) 2>&1 | sed -n ['s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p']`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) AC_MSG_WARN([Cache variable $ac_var contains a newline.]) ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+
   (set) 2>&1 |
-    case `(ac_space=' '; set | grep ac_space) 2>&1` in
-    *ac_space=\ *)
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
       # `set' does not quote correctly, so add quotes (double-quote
       # substitution turns \\\\ into \\, and sed turns \\ into \).
       sed -n \
        ["s/'/'\\\\''/g;
          s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"]
-      ;;
+      ;; #(
     *)
       # `set' quotes correctly as required by POSIX, so do not add quotes.
-      sed -n \
-       ["s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"]
+      sed -n ["/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"]
       ;;
-    esac;
-}dnl
+    esac
+)dnl
 ])# _AC_CACHE_DUMP