[ upstream report: http://cvs.openbsd.org/cgi-bin/query-pr-wrapper?full=yes&numbers=5093 ]
OpenBSD /bin/sh aka /bin/ksh has an interesting bug: the second "false" in the script below wrongly causes the shell to exit, but not the first one, so "two" isn't printed. #! /bin/sh set -e false && exit 1 echo one if :; then false && exit 1 fi echo two It doesn't matter if "false" is a builtin here, or replaced by an external process that happens to fail. Same issue with a "for" loop (but, surprisingly, not with an "until" loop). OK to apply these patches to Autoconf and Automake, respectively? Apologies to Alexandre for changing the same lines of depcomp[67].test for the third time; at least now I have a good reason to do so. ;-) I have scanned Automake/tests/* and Autoconf and not found any other instances of this at a glance. Cheers, Ralf Autoconf: * doc/autoconf.texi (Limitations of Builtins): Mention OpenBSD /bin/sh -e issues with failing commands in if clauses. Index: doc/autoconf.texi =================================================================== RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v retrieving revision 1.1002 diff -u -r1.1002 autoconf.texi --- doc/autoconf.texi 28 Apr 2006 04:17:51 -0000 1.1002 +++ doc/autoconf.texi 28 Apr 2006 16:27:59 -0000 @@ -12168,6 +12321,24 @@ The @command{set} of the [EMAIL PROTECTED] 6.0 shell does not sort its output. +The [EMAIL PROTECTED] 4.8 shell wrongly exits if a command in an @samp{&&} +list fails inside an @samp{if} clause or @samp{for} loop: + [EMAIL PROTECTED] +#! /bin/sh +set -e +false && exit 1 +echo one +if :; then + false && exit 1 +fi +echo two [EMAIL PROTECTED] example + [EMAIL PROTECTED] +does not print @samp{two}. A workaround is to use another if clause: [EMAIL PROTECTED] false; then exit 1; fi}. + @item @command{shift} @c ------------------ Automake: * tests/depcomp6.test, tests/depcomp7.test: Cater for OpenBSD /bin/sh -e issue with failing commands in if clauses. Index: tests/depcomp6.test =================================================================== RCS file: /cvs/automake/automake/tests/depcomp6.test,v retrieving revision 1.3 diff -u -r1.3 depcomp6.test --- tests/depcomp6.test 23 Mar 2006 06:30:06 -0000 1.3 +++ tests/depcomp6.test 28 Apr 2006 16:16:57 -0000 @@ -98,6 +98,6 @@ cd sub2 $sleep echo 'choke me' > sub3/ba3.h - $MAKE && exit 1 + if $MAKE; then exit 1; fi fi : Index: tests/depcomp7.test =================================================================== RCS file: /cvs/automake/automake/tests/depcomp7.test,v retrieving revision 1.3 diff -u -r1.3 depcomp7.test --- tests/depcomp7.test 23 Mar 2006 06:30:06 -0000 1.3 +++ tests/depcomp7.test 28 Apr 2006 08:15:56 -0000 @@ -100,6 +100,6 @@ cd sub2 $sleep echo 'choke me' > sub3/ba3.h - $MAKE && exit 1 + if $MAKE; then exit 1; fi fi :