Re: EXIT trap handling in subshells broken

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

 



On Mon, Jan 06, 2020 at 09:57:20PM +0000, Harald van Dijk wrote:
> 
> The problem is not limited to redirections:
> 
>   f() { (trap "echo \$var" EXIT); }
>   var=bad
>   var=ok f
> 
> This prints "bad", when it should print "ok". Here, the local variable is
> dropped not in main(), but during the unwind process.

This works fine for me with the latest git tree.  This is because
reset has now been split into exitreset and reset and variables
are only reset in reset() which is only called if exitshell is
not happening.

As if we're in a subshell we will never take the reset() path
I don't think we need to do anything here at all.

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