[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: OpenBSD shell, errexit, and && in if clause
From: |
Alexandre Duret-Lutz |
Subject: |
Re: OpenBSD shell, errexit, and && in if clause |
Date: |
Wed, 10 May 2006 22:36:19 +0200 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) |
>>> "RW" == Ralf Wildenhues <address@hidden> writes:
RW> [ upstream report:
RW> http://cvs.openbsd.org/cgi-bin/query-pr-wrapper?full=yes&numbers=5093
RW> ]
RW> OpenBSD /bin/sh aka /bin/ksh has an interesting bug: the second "false"
RW> in the script below wrongly causes the shell to exit, but not the first
RW> one, so "two" isn't printed.
RW> #! /bin/sh
RW> set -e
RW> false && exit 1
RW> echo one
RW> if :; then
RW> false && exit 1
RW> fi
RW> echo two
RW> It doesn't matter if "false" is a builtin here, or replaced by an
RW> external process that happens to fail. Same issue with a "for" loop
RW> (but, surprisingly, not with an "until" loop).
This looks like an issue similar to the one that caused this :
2002-03-17 Alexandre Duret-Lutz <address@hidden>
* tests/dirforbid.test: Workaround for NetBSD sh bug.
Fixes PR automake/305.
http://sources.redhat.com/cgi-bin/cvsweb.cgi/automake/tests/dirforbid.test.diff?cvsroot=automake&r1=1.1&r2=1.2
http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=11542
(I love the suggested "fix" on the initial submission :))
RW> OK to apply these patches to Autoconf and Automake, respectively?
RW> Apologies to Alexandre for changing the same lines of depcomp[67].test
RW> for the third time; at least now I have a good reason to do so. ;-)
Sure :)
--
Alexandre Duret-Lutz
Shared books are happy books. http://www.bookcrossing.com/friend/gadl