Re: [v2 PATCH] eval: Only restore exit status on exit/return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 06, 2018 at 09:35:47PM +0000, Harald van Dijk wrote:
> On 04/12/2018 23:57, Harald van Dijk wrote:
> > This has the benefit of fixing one other test case, a small modification
> > from one of Martijn Dekker's:
> > 
> >    $SHELL -c 'trap "set -o bad@option" INT; kill -s INT $$' && echo BUG
> 
> Another test case, one that still fails:
> 
>   trap exit INT
>   trap 'true; kill -s INT $$' EXIT
>   false
> 
> Here, inside the EXIT handler, "the command that executed immediately
> preceding the trap action" is `false`, but inside the INT handler, it's
> either `true` or `kill -s INT $$` (I think the latter, but it doesn't
> matter). dash treats it as if it were still `false`.

I think this makes sense.  The EXIT trap trumps whatever happens
inside it.  FWIW ksh/mksh both do the same thing.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux