autoconf-patches
[Top][All Lists]
Advanced

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

`unset' and bash...


From: Ralf Wildenhues
Subject: `unset' and bash...
Date: Sun, 3 Sep 2006 17:42:50 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

Older bash (seen with 2.04.0(1) on MinGW) do this:
 $ unset some_unset_variable; echo $?
 1

OK to install the patch below?  Or should we just go all the way and
recommend the exact code that is _AS_UNSET_PREPARE?  I don't quite
understand the Bash 2.01 bug; was that setting MAIL to something, or
unsetting MAIL that triggered the segfault?

| # _AS_UNSET_PREPARE
| # -----------------
| # AS_UNSET depends upon $as_unset: compute it.
| # Use MAIL to trigger a bug in Bash 2.01;
| # the "|| exit" suppresses the resulting "Segmentation fault" message.
| # Avoid 'if ((', as that triggers a bug in pdksh 5.2.14.
| m4_defun([_AS_UNSET_PREPARE],
| [# Support unset when possible.
| if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
|   as_unset=unset
| else
|   as_unset=false
| fi
| ])

Cheers,
Ralf

        * doc/autoconf.texi (Limitations of Builtins): Do not unset
        an unset variable, for Bash 2.04.

Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.1076
diff -u -r1.1076 autoconf.texi
--- doc/autoconf.texi   2 Sep 2006 05:37:07 -0000       1.1076
+++ doc/autoconf.texi   3 Sep 2006 15:38:27 -0000
@@ -12857,7 +12857,7 @@
 not supported:
 
 @example
-if (unset FOO) >/dev/null 2>&1; then
+if (FOO=bar; unset FOO) >/dev/null 2>&1; then
   unset=unset
 else
   unset=false
@@ -12865,6 +12865,10 @@
 $unset PS1 || PS1='$ '
 @end example
 
address@hidden
+Note that Bash 2.04's @command{unset} returned 1 upon unsetting a variable
+that was not set before.
+
 @xref{Special Shell Variables}, for some neutralizing values.  Also, see
 @ref{Limitations of Builtins}, documentation of @command{export}, for
 the case of environment variables.




reply via email to

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