]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* doc/autoconf.texi (Shellology): Document eval $? problem
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 1 Dec 2005 21:02:40 +0000 (21:02 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 1 Dec 2005 21:02:40 +0000 (21:02 +0000)
with ash.
(Limitations of Builtins): Likewise.

ChangeLog
doc/autoconf.texi

index b0db338b35e371a12a791e1e06adc944d964adeb..90ff5103d4ee82588f7c852b743587aae2906cfc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-12-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * doc/autoconf.texi (Shellology): Document eval $? problem
+       with ash.
+       (Limitations of Builtins): Likewise.
+
 2005-11-10  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Pass
@@ -62,7 +68,7 @@
 2005-10-21  Stepan Kasal  <kasal@ucw.cz>
 
        * lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): When determining,
-       the delimiter CEOF$ac_eof: fix quoting of CEOF[0-9]* and modify the 
+       the delimiter CEOF$ac_eof: fix quoting of CEOF[0-9]* and modify the
        code so that the most common case requires less forks.
 
 2005-10-20  Stepan Kasal  <kasal@ucw.cz>
index 88a42e7374b0acf6a066d724c368a082ff4bc355..618f38cf0ebee8cb16f55551049809ac350ee3a6 100644 (file)
@@ -9783,13 +9783,16 @@ To be compatible with Ash 0.2:
 
 @itemize @minus
 @item
-don't use @samp{$?} after expanding empty or unset variables:
+don't use @samp{$?} after expanding empty or unset variables,
+or at the start of an @command{eval}:
 
 @example
 foo=
 false
 $foo
-echo "Don't use it: $?"
+echo "Do not use it: $?"
+false
+eval 'echo "Do not use it: $?"'
 @end example
 
 @item
@@ -11121,6 +11124,25 @@ EOF
 @end example
 
 
+@item @command{eval}
+@c -----------------
+@prindex @command{eval}
+In some shell implementations (e.g., @command{ash}, OpenBSD 3.8
+@command{sh}, @command{pdksh} v5.2.14 99/07/13.2, and @command{zsh}
+4.2.5), the arguments of @samp{eval} are evaluated in a context where
+@samp{$?} is 0, so they exhibit behavior like this:
+
+@example
+$ false; eval 'echo $?'
+0
+@end example
+
+The correct behavior here is to assign a nonzero value to @samp{foo},
+but portable scripts should not rely on this.
+
+You should not rely on @code{LINENO} within @command{eval}.
+@xref{Special Shell Variables}.
+
 @item @command{exit}
 @c -----------------
 @prindex @command{exit}