Hi Paul,

* Paul Eggert wrote on Mon, May 01, 2006 at 07:37:55PM CEST:
> Ralf Wildenhues <[EMAIL PROTECTED]> writes:
> 
> > +The [EMAIL PROTECTED] 4.8 shell
> 
> Thanks, but the latest OpenBSD release is 3.9, so there's something
> wrong here.  Perhaps you meant "3.8"?

Yes, sorry about that.  OpenBSD 3.8 is what I tested on.  The followup
to the upstream bug report suggests that it has not been fixed yet:
http://cvs.openbsd.org/cgi-bin/query-pr-wrapper?full=yes&numbers=5093

> This reminds me of a longstanding related problem in BSD sh and make.
> I installed this patch into Autoconf, which combines the two ideas.

Thanks.  Note however: 

> +Even relatively-recent versions of the @acronym{BSD} shell (e.g.,
> [EMAIL PROTECTED] 3.4) wrongly exit with @option{-e} if a command within
> [EMAIL PROTECTED]&&} fails inside a compound statement.  For example:
> +
> [EMAIL PROTECTED]
> +#! /bin/sh
> +set -e
> +foo='nonempty'
> +test -n "$foo" && exit 1
> +echo one
> +if :; then
> +  test -n "$foo" && exit 1
> +fi
> +echo two
> [EMAIL PROTECTED] example
> +
> [EMAIL PROTECTED]
> +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}.

This example isn't right, in that it does not expose the problem, as
the first command in the AND list should fail.  Did you mean "test -z"
instead of "test -n" (four instances), or "foo=''", and is there a
reason to prefer it over the simpler "false"?

Cheers,
Ralf


Reply via email to