Subject: /bin/sh bug or not?
To: None <current-users@NetBSD.ORG>
From: Kenneth Stailey <kstailey@leidecker.gsfc.nasa.gov>
List: current-users
Date: 05/10/1995 19:53:31
tulloh@dev.tivoli.com (Robert Tulloh) writes:
> Well, I have run across something else that looks suspicious in NetBSD
> sh and I wanted to run it past you. Take the expression:
>
> i=`false`
>
> Under AIX ksh, this expression will set return code to 1.
> Under SunOS sh, this expression will set return code to 255.
> Under SunOS bash, this expression will set return code to 255.
>
> Under NetBSD sh, the expression will set the return code to 0 because
> it treats variable assignment as one transaction and the execution
> of the builtin function false as another transaction. As it turns out,
> the variable assignment happens last so it's return value is what is
> trapped and returned by the shell in $?.
This still happens in -current as of Mon May 8. Does any standard
mandate this behaviour?