Re: eval: Only restore exit status on exit/return

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

 



On Thu, Nov 29, 2018 at 03:27:31PM +0100, Martijn Dekker wrote:
> Op 29-11-18 om 12:33 schreef Herbert Xu:
> > Thanks for the report.  This patch should fix the problem:
> 
> Doesn't work for me, in fact it seems to make no difference.
> 
> Here are a few more test cases.
> 
> (trap '(! :) && echo BUG1' EXIT)
> (trap '(false) && echo BUG2' EXIT)
> (trap 'readonly foo=bar; (foo=baz) && echo BUG3' EXIT)
> (trap '(set -o bad@option) && echo BUG4' EXIT)

Oops, I only tested the dotrap case, and not exitshell.

The problem is that in evalsubshell we end up in exitshell again
which restores the old exit status.  So we need to come up with
a way to differentiate the exitshell from the original shell vs.
a subshell.

Thanks,
-- 
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