zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: <zsh-workers@zsh.org>
Subject: Re: Why does zsh un-ignores SIGQUIT?
Date: Fri, 26 Apr 2019 15:03:02 +0100	[thread overview]
Message-ID: <1556287382.6728.12.camel@samsung.com> (raw)
In-Reply-To: <1556286159.6728.9.camel@samsung.com>

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;



      reply	other threads:[~2019-04-26 14:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24  8:13 Stephane Chazelas
2019-04-24 16:13 ` Peter Stephenson
2019-04-25 21:17   ` Stephane Chazelas
2019-04-26 13:42     ` Peter Stephenson
2019-04-26 14:03       ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1556287382.6728.12.camel@samsung.com \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).