From: Paolo Bonzini Date: Thu, 21 Jan 2010 11:16:42 +0000 (+0100) Subject: Add recommendation on (not) unsetting IFS. X-Git-Tag: v2.66~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e51c9919f2cf70185b7916ac040bc0bbfd0f743b;p=thirdparty%2Fautoconf.git Add recommendation on (not) unsetting IFS. * doc/autoconf.texi (Special shell variables): Explain why it's better not to unset IFS. --- diff --git a/ChangeLog b/ChangeLog index eaee96bf..70432f8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-01-20 Paolo Bonzini + + Add recommendation on (not) unsetting IFS. + * doc/autoconf.texi (Special shell variables): Explain why it's + better not to unset IFS. + 2010-01-19 Ralf Wildenhues config.status: consistent exit status with nonexistent config file input. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 1549f895..e5cf9fd6 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -15750,6 +15750,22 @@ environment variables be set to @samp{C} if the C locale is desired; @file{configure} scripts and M4sh do that for you. Export these variables after setting them. +Unsetting @code{IFS} instead of resetting it to the default sequence +is not suggested, since code that tries to save and restore the +variable's value will incorrectly reset it to an empty value, thus +disabling field splitting: + +@example +unset IFS +# default separators used for field splitting + +save_IFS=$IFS +IFS=: +# ... +IFS=$save_IFS +# no field splitting performed +@end example + @c However, some older, nonstandard @c systems (notably @acronym{SCO}) break if locale environment variables @c are set to @samp{C}, so when running on these systems