According to Ralf Wildenhues on 7/28/2009 12:39 PM: > Hello Arkadiusz, > >> old_IFS=$IFS >> IFS="," >> AC_DEFINE([VC_ENABLE_API_COMPAT], [1]) >> IFS="$old_IFS" >> >> AC_OUTPUT >> [ar...@carme-pld ~/test/1]$ ./configure >> ./configure[1640]: print -r --: not found >> configure: creating ./config.status >> > Thanks for the report. This will probably mean that we will document > that you should not change, or that you need to restore, IFS when > invoking Autoconf macros. In general, we really cannot guarantee which > macros will expand to IFS-sensitive code and which won't, so you may > have to assume they all will.
Cleaning out some old mails in my inbox. I agree with Ralf that the best we can do is document IFS better (it is easier to do that than to ask all internal uses of $* to reset IFS to the defaults). I will be pushing this. -- Eric Blake [email protected] +1-801-349-2682 Libvirt virtualization library http://libvirt.org
From 2c0a2e14f09a363d9fddd1d31147e84746069726 Mon Sep 17 00:00:00 2001 From: Eric Blake <[email protected]> Date: Thu, 25 Feb 2010 14:06:38 -0700 Subject: [PATCH] Document that Autoconf relies on IFS. * doc/autoconf.texi (Special Shell Variables) <IFS>: Add details about use of IFS within configure script. * THANKS: Update. Reported by Arkadiusz Miskiewicz. Signed-off-by: Eric Blake <[email protected]> --- ChangeLog | 8 ++++++++ doc/autoconf.texi | 10 ++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7caa93..fa477a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-02-25 Eric Blake <[email protected]> + + Document that Autoconf relies on IFS. + * doc/autoconf.texi (Special Shell Variables) <IFS>: Add details + about use of IFS within configure script. + * THANKS: Update. + Reported by Arkadiusz Miskiewicz. + 2009-09-16 Eric Blake <[email protected]> Optimize AC_REPLACE_FUNCS. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index e5cf9fd..8f44ffe 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -15715,18 +15715,24 @@ Special Shell Variables but this caused many problems so modern shells ignore any environment settings for @env{IFS}. -Don't set the first character of @code{IFS} to backslash. Indeed, +Don't set the first character of @env{IFS} to backslash. Indeed, Bourne shells use the first character (backslash) when joining the components in @samp{"$@@"} and some shells then reinterpret (!)@: the backslash escapes, so you can end up with backspace and other strange characters. -The proper value for @code{IFS} (in regular code, not when performing +The proper value for @env{IFS} (in regular code, not when performing splits) is @sa...@key{spc}@key{t...@key{ret}}. The first character is especially important, as it is used to join the arguments in @samp{$*}; however, note that traditional shells, but also bash-2.04, fail to adhere to this and join with a space anyway. +M4sh guarantees that @env{IFS} will have the default value at the +beginning of a script, and many macros within autoconf rely on this +setting. It is okay to use blocks of shell code that temporarily change +the value of @env{IFS} in order to split on another character, but +remember to restore it before expanding further macros. + @item LANG @itemx LC_ALL @itemx LC_COLLATE -- 1.6.6.1
signature.asc
Description: OpenPGP digital signature
