Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Why does zsh un-ignores SIGQUIT?
On Fri, 2019-04-26 at 14:42 +0100, Peter Stephenson wrote:
> On Thu, 2019-04-25 at 22:17 +0100, Stephane Chazelas wrote:
> >
> > I wonder what the rationale is for why zsh will happily install a
> > handler on an ignored signal but not reset to default.
> I think it's simply this in the removetrap() code...
>
> trapped = sigtrapped[sig];
> ...
> if (!trapped) {
> unqueue_signals();
> return NULL;
> }
>
> If the signal was ignored on entry, it stays ignored (because that's
> down in the OS), but zsh doesn't mark it as handled specially. So
> when we get the request to unset it we execute this code, shrugging our
> shoulders and doing nothing. For SIGQUIT we now do mark it as
> handled specially.
>
> Instead of laboriously setting up records for all signals, maybe we
> could add a call to set the default signal handler in the "if" above?
> At worst that should have no effect, probably.
Reading through, I think simply omitting that block should have the right
effect --- all the specific internal effects later in the function are
protected by their own "if"s, so this has the desired effect of only
fixing up the OS state.
I'm not going to commit this immediately.
diff --git a/Src/signals.c b/Src/signals.c
index f294049c2..14218177a 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -1011,10 +1011,6 @@ removetrap(int sig)
(!trapped || locallevel > (sigtrapped[sig] >> ZSIG_SHIFT)))
dosavetrap(sig, locallevel);
- if (!trapped) {
- unqueue_signals();
- return NULL;
- }
if (sigtrapped[sig] & ZSIG_TRAPPED)
nsigtrapped--;
sigtrapped[sig] = 0;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author