autoconf-patches
[Top][All Lists]
Advanced

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

Re: (2.59 bug) Extra whitespace in CFLAGS causes false "cache corrupt"


From: Ralf Wildenhues
Subject: Re: (2.59 bug) Extra whitespace in CFLAGS causes false "cache corrupt"
Date: Sat, 29 Apr 2006 20:04:49 +0200
User-agent: Mutt/1.5.11+cvs20060403

Hi Francesco, Andrew,

* Francesco Romani wrote on Sat, Apr 29, 2006 at 02:03:39PM CEST:
> From: address@hidden (Andrew Church)

>      I've encountered a bug in Autoconf's (version 2.59) handling of
> precious variables, such as CFLAGS, when calling configure scripts in
> subdirectories.  Specifically, if such a variable contains two or more
> consecutive whitespace characters (for example, CFLAGS="-O2  ", as can
> happen when configure is called from a build script), the sub-configure
> will abort, claiming that the variable's value has changed since the
> previous run, because the multiple whitespace characters are compressed to
> a single space by the shell when the sub-configure is run.

Confirmed.  The bug is genuine, also in 2.59c.  Your proposed fix is
wrong.  :-)

Proposed patch below.  Testsuite is still running, and I'd like someone
to look very closely over this.

Cheers,
Ralf

        * lib/autoconf/status.m4 (_AC_OUTPUT_SUBDIRS): Take care not to
        munge (multiple) white space and other oddities.
        * tests/torture.at (AC_CONFIG_SUBDIRS and precious vars): New
        test.
        Report and test by Francesco Romani <address@hidden> and
        Andrew Church <address@hidden>.

Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.98
diff -u -r1.98 status.m4
--- lib/autoconf/status.m4      24 Apr 2006 19:36:02 -0000      1.98
+++ lib/autoconf/status.m4      29 Apr 2006 17:55:44 -0000
@@ -915,7 +915,10 @@
   # Remove --cache-file and --srcdir arguments so they do not pile up.
   ac_sub_configure_args=
   ac_prev=
-  for ac_arg in $ac_configure_args; do
+  eval set x "$ac_configure_args"
+  shift
+  for ac_arg
+  do
     if test -n "$ac_prev"; then
       ac_prev=
       continue
@@ -938,7 +941,7 @@
       ac_prev=prefix ;;
     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
       ;;
-    *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+    *) ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
     esac
   done
 
@@ -984,7 +987,7 @@
 
       AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args 
--cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
       # The eval makes quoting arguments work.
-      eval $ac_sub_configure $ac_sub_configure_args \
+      eval $ac_sub_configure "$ac_sub_configure_args" \
           --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir ||
        AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir])
     fi
Index: tests/torture.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/torture.at,v
retrieving revision 1.59
diff -u -r1.59 torture.at
--- tests/torture.at    12 Apr 2006 20:40:22 -0000      1.59
+++ tests/torture.at    29 Apr 2006 18:03:52 -0000
@@ -991,3 +991,32 @@
 AT_CHECK([test -f HeeHee.in])
 
 AT_CLEANUP
+
+
+## ----------------------------------------------- ##
+## AC_CONFIG_SUBDIRS and spaces in precious vars.  ##
+## ----------------------------------------------- ##
+
+AT_SETUP([AC_CONFIG_SUBDIRS and spaces in precious vars])
+AT_KEYWORDS([autoreconf])
+
+mkdir sub
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_PROG_CC
+AC_CONFIG_SUBDIRS([sub])
+AC_OUTPUT
+]])
+
+AT_DATA([sub/configure.ac],
+[[AC_INIT
+AC_PROG_CC
+]])
+
+echo fake > install-sh
+
+AT_CHECK([autoreconf -Wall -v -i], [0], [ignore], [ignore])
+AT_CHECK([CFLAGS="-O2  " ./configure -C], [0], [ignore])
+
+AT_CLEANUP




reply via email to

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