eval: Test evalskip before flipping status for NNOT
commitd5d616126ccc309d441fa82bb6a5bbf3377bd0e9
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 7 Dec 2022 08:55:07 +0000 (7 16:55 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sun, 11 Dec 2022 06:29:21 +0000 (11 14:29 +0800)
tree071726167eb073ae9708684ea19ed5f6eed79ffd
parentf0d57fded5b1a4b0aa6f0571a316cb9482ef3af8
eval: Test evalskip before flipping status for NNOT

On Tue, Dec 06, 2022 at 10:15:03AM +0000, Harald van Dijk wrote:
>
> There is a long-standing bug that may or may not be harder to fix if this
> patch goes in, depending on how you want to fix it. Here's a script that
> already fails on current dash.
>
>   f() {
>     if ! return 0
>     then :
>     fi
>   }
>   f
>
> This should return 0, and does return 0 in bash and ksh (and almost all
> shells), but returns 1 in dash.
>
> There are a few possible ways of fixing it. Some of them rely on continuing
> to conditionally set exitstatus.

This can be fixed simply by testing evalskip prior to flipping the
status.

Reported-by: Harald van Dijk <harald@gigawatt.nl>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
src/eval.c