Subject: Re: [BUG] Sticky-sh POSIX_TRAPS are function-local
From: Peter Stephenson <[email-masked]>
To: [email-masked]
Date: Tue, 16 Feb 2016 09:57:44 +0000
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Mon, 15 Feb 2016 06:11:13 +0100
Martijn Dekker <[email-masked]> wrote:
> The POSIX_TRAPS option for the EXIT trap does not work if both of the
> following conditions apply:

Oh, you mean the POSIXness of the trap is not sticky.  It should be
marked as to be run at the end of the programme based on the emulation
when it was started.  I don't think we've ever claimed it would be,
but it would be clearly be useful to change as the intention in
POSIX emulation is unambiguous.

I think that's probably fixable with a bit of flaggery, but we'll
probably need to compromise and agree that if someone sets an EXIT trap
once the emulation is left, which therefore picks up non-POSIX behaviour
(if that's how the shell was started), it will wipe out the trap
completely.  Otherwise we're in a weird and wonderful world of multiple
parallel EXIT traps.  Presumably that's no big issue, since even in
POSIX mode a new EXIT trap wipes out the one you've just set.

pws