Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] Sticky-sh POSIX_TRAPS are function-local

On Feb 17,  6:24am, Martijn Dekker wrote:
} But POSIX is irrelevant to function-local traps because they are not
} defined in POSIX, so, once emulation mode is exited, there is nothing
} that compels you to make them wipe out a global POSIX trap.

That's sort of the point -- there's nothing that compels us, hence ...

} > I could see an argument either way

... and your argument is a pretty good one.

} > I could also see an argument
} > that the localtraps option should affect this
} How do you think that option should affect this?

To be pedantic, I didn't say I think that; I said I could understand how
one might argue that position.  To try to frame it -- the implication is
that a trap created under LOCAL_TRAPS should *never* alter traps in any
outer scope.  This ought to include the global scope, regardless of the
context in which the global trap was created.

I.e. given "setopt POSIX_TRAPS LOCAL_TRAPS" this argues that LOCAL_TRAPS
should "win".  With PWS's patch, POSIX_TRAPS prevails.

Messages sorted by: Reverse Date, Date, Thread, Author