bug-autoconf
[Top][All Lists]
Advanced

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

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


From: Francesco Romani
Subject: (2.59 bug) Extra whitespace in CFLAGS causes false "cache corrupt"
Date: Sat, 29 Apr 2006 14:03:39 +0200

Forwarded as requested.

Begin forwarded message:

From: address@hidden (Andrew Church)
To: address@hidden
Subject: (2.59 bug) Extra whitespace in CFLAGS causes false "cache corrupt"
error Date: Fri, 30 Dec 2005 04:16:02 JST
X-Mailer: MMail v5.21
Sender: address@hidden
Message-ID: <address@hidden>

     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.  To demonstrate,
create the following two configure.in files:

-------- configure.in --------
AC_INIT
AC_PROG_CC
AC_CONFIG_SUBDIRS(test)
AC_OUTPUT
------------------------------
-------- test/configure.in --------
AC_INIT
AC_PROG_CC
-----------------------------------

then do the following:

$ autoreconf
$ touch install-sh
$ CFLAGS="-O2  " ./configure --cache-file=config.cache

which will result in configure printing:

configure: creating cache config.cache
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
updating cache config.cache
configure: creating ./config.status
configure: configuring in test
configure: running /bin/sh './configure' --prefix=/usr/local
'--cache-file=config.cache' 'CFLAGS=-O2 ' --cache-file=../config.cache
--srcdir=. configure: loading cache ../config.cache configure: error:
`CFLAGS' has changed since the previous run: configure:   former value:  -O2  
configure:   current value: -O2 
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm ../config.cache' and start
over configure: error: /bin/sh './configure' failed for test

     Note how the CFLAGS= parameter in the sub-configure command line has
only one trailing space.  This appears to be due to the method by which
the sub-configure is run:

status.m4:1164:      eval $ac_sub_configure $ac_sub_configure_args \

which causes whitespace in the sub-configure arguments to be treated as
word separators rather than passed on literally.

     The patch below, while kludgey, seems to correct the problem at the
expense of readability in the displayed command line.

  --Andrew Church
    address@hidden
    http://achurch.org/

---------------------------------------------------------------------------

--- lib/autoconf/general.m4.old 2003-10-27 20:10:56 +0900
+++ lib/autoconf/general.m4     2005-12-30 04:13:58 +0900
@@ -1106,7 +1106,7 @@
 dnl If you change this globbing pattern, test it on an old shell --
 dnl it's sensitive.  Putting any kind of quote in it causes syntax errors.
   [  *" "*|*"  "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)]
-      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g" | sed
"s/\\([[        ]]\\)/'\\\\\\\\\\\\1'/g"` ;; esac
     case $ac_pass in
     1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
@@ -1409,7 +1409,7 @@
 dnl If you change this globbing pattern, test it on an old shell --
 dnl it's sensitive.  Putting any kind of quote in it causes syntax errors.
 [    *" "*|*"  "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)]
-      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g" | sed
"s/\\([[        ]]\\)/'\\\\\\\\\\\\1'/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;;
     esac
     case " $ac_configure_args " in

End forwarded message;

best regards,

-- 
Francesco Romani - Ikitt ['people always complain, no matther what you do']
IM contact: (email-me, I have antispam default deny!) icq://27-83-87-867
some known bugs: http://www.transcoding.org/cgi-bin/transcode?Bug_Showcase




reply via email to

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