[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Add recommendation on (not) unsetting IFS.
From: |
Paolo Bonzini |
Subject: |
[PATCH] Add recommendation on (not) unsetting IFS. |
Date: |
Thu, 21 Jan 2010 12:18:44 +0100 |
What about this change? It was discussed yesterday on the qemu
mailing list, and one developer referred to the Autoconf manual
even though qemu does not use Autoconf.
* doc/autoconf.texi (Special shell variables): Explain why it's
better not to unset IFS.
---
ChangeLog | 6 ++++++
doc/autoconf.texi | 16 ++++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index eaee96b..70432f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-20 Paolo Bonzini <address@hidden>
+
+ 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 <address@hidden>
config.status: consistent exit status with nonexistent config file
input.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 1549f89..e5cf9fd 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -15750,6 +15750,22 @@ Special Shell Variables
@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:
+
address@hidden
+unset IFS
+# default separators used for field splitting
+
+save_IFS=$IFS
+IFS=:
+# ...
+IFS=$save_IFS
+# no field splitting performed
address@hidden 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
--
1.6.5.2
- [PATCH] Add recommendation on (not) unsetting IFS.,
Paolo Bonzini <=