On Wed, May 14, 2008 at 02:29:09PM +0000, Eric Blake wrote:
> Does anyone have access to FreeBSD, or know what shell heritage their /bin/sh 
> has?  This patch was extracted from reports on the git mailing list against 
> the 
> FreeBSD 6.1 /bin/sh, which I don't have access to.  But I reproduced the 
> issues 
> using cygwin's ash, so I'm documenting them.

Indeed, ash and {Free,Net}BSD /bin/sh have a common origin.

> http://marc.info/?l=git&m=121073772610342&w=2
> corrupted $? when combining && and |
> 
> $ sh -c 'true && ! true | true; echo $?'
> 1
> $ ash -c 'true && ! true | true; echo $?'
> 0

This bug is unrelated to `&&', affecting any `!'-ed pipeline:

$  sh -c '! : | :'; echo $?
1
$ ash -c '! : | :'; echo $?
0

Ash evaluates the pipeline like `{ ! :; } | :'.  Also note this bug affecting
`!' with a compound command.

$  sh -c '! { :; }'
$ ash -c '! { :; }'
{: not found
Syntax error: "}" unexpected


Reply via email to