]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Clarify OpenBSD sh errexit issue with compound commands.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 6 Jun 2010 09:59:25 +0000 (11:59 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 8 Jun 2010 04:48:34 +0000 (06:48 +0200)
* doc/autoconf.texi (Limitations of Builtins): Only the last
command in a compound list is problematic.
Tested on OpenBSD 4.4.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
doc/autoconf.texi

index 9c626346cb075a2a9ac5d26a5a6d0af4375450d2..f71d53a3469ca4f380358228466f970e975a29c8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-06-08  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Clarify OpenBSD sh errexit issue with compound commands.
+       * doc/autoconf.texi (Limitations of Builtins): Only the last
+       command in a compound list is problematic.
+       Tested on OpenBSD 4.4.
+
 2010-06-07  Eric Blake  <eblake@redhat.com>
 
        Properly quote AC_PREREQ during autoupdate.
index eab9ab215253e78a481ff1748e8167de1cbde7f0..6a7666b55ae22d2ebabe1decddda00e26251b019 100644 (file)
@@ -16877,9 +16877,9 @@ makefiles, and led to circumlocutions like @samp{sh -c 'test -f file ||
 touch file'}, where the seemingly-unnecessary @samp{sh -c '@dots{}'}
 wrapper works around the bug (@pxref{Failure in Make Rules}).
 
-Even relatively-recent versions of the BSD shell (e.g.,
-OpenBSD 3.4) wrongly exit with @option{-e} if a command within
-@samp{&&} fails inside a compound statement.  For example:
+Even relatively-recent versions of the BSD shell (e.g., OpenBSD 3.4)
+wrongly exit with @option{-e} if the last command within a compound
+statement fails and is guarded by an @samp{&&} only.  For example:
 
 @example
 #! /bin/sh
@@ -16889,14 +16889,17 @@ test -n "$foo" && exit 1
 echo one
 if :; then
   test -n "$foo" && exit 1
+  echo two
+  test -n "$foo" && exit 1
 fi
-echo two
+echo three
 @end example
 
 @noindent
-does not print @samp{two}.  One workaround is to use @samp{if test -n
-"$foo"; then exit 1; fi} rather than @samp{test -n "$foo" && exit 1}.
-Another possibility is to warn BSD users not to use @samp{sh -e}.
+does not print @samp{three}.  One workaround is to change the last
+instance of @samp{test -n "$foo" && exit 1} to be @samp{if test -n
+"$foo"; then exit 1; fi} instead.  Another possibility is to warn BSD
+users not to use @samp{sh -e}.
 
 When @samp{set -e} is in effect, a failed command substitution in
 Solaris @command{/bin/sh} cannot be ignored, even with @samp{||}.