zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: coredump on C-c
Date: Fri, 27 Sep 2013 12:50:03 -0700	[thread overview]
Message-ID: <CAH+w=7ZA3a8kMi8fTQcN8qdNvC14_Vv-=jxbirxypJoAqsVFqQ@mail.gmail.com> (raw)
In-Reply-To: <20130927165043.3b23c6f9@pws-pc.ntlworld.com>

On Fri, Sep 27, 2013 at 8:50 AM, Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:
>
> On Thu, 26 Sep 2013 21:20:36 -0700
> Bart Schaefer <schaefer@brasslantern.com> wrote:
> > It occurs to me, though, that queuing signals all over hashtable.c may
> > be an over-reaction.  Maybe the problem is just with re-entering the
> > endparamscope() routine, and that's where queue_signals() is needed.
>
> Really, we should be doing as little from signals as possible.  The fact
> that the trap (immediately down (numerically) the backtrace from the bit
> you quoted) is running an arbitrary function while anything else can be
> happening outside the handler is a bit worrying.

This particular instance is a special case, where the internal SIGINT
handler is calling the "after_hook" function installed by the ZLE
modules, and (if I'm interpreting things correctly) the result is that
the special scope for ZLE parameters is ended twice.  There may be a
different way to end the ZLE scope when the editor is INTerrupted,
which would also avoid this problem.

> I have a feeling we
> decided at one time that it would be a good strategy only to have trap
> handlers run at certain safe points (i.e. the reverse strategy from
> blocking them at dangerous points)?

Yes, we're using signal masks that way, it's the strategy we adopted
to fix some SIGWINCH bugs, but this case involves a place where we
need to be responsive to SIGINT (lest a runaway widget lock up the
shell).

> But presumably there's nothing to prevent the shell from doing any of
> the hashtable things you looked at before, except caused by actions in
> the function rather than change of scope, at the point where the SIGINT
> arrives and the trap gets run.

I think user-defined traps that might run arbitrary shell code are
deferred to "safe" places in most cases.  In this special case,
though, it's an internally-defined trap gone rogue, and given that
similar rogues could come in from other loadable modules, some
defensive programming in the core shell seems a good idea.


  reply	other threads:[~2013-09-27 19:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-26 17:52 Eitan Adler
2013-09-26 21:31 ` Bart Schaefer
2013-09-27  1:10   ` Eitan Adler
2013-09-27  3:49   ` Bart Schaefer
2013-09-27  4:20     ` Bart Schaefer
2013-09-27 15:50       ` Peter Stephenson
2013-09-27 19:50         ` Bart Schaefer [this message]
2013-09-27  5:00   ` Eitan Adler
2013-10-16 21:40   ` Eitan Adler
2013-10-17  0:04     ` Bart Schaefer

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='CAH+w=7ZA3a8kMi8fTQcN8qdNvC14_Vv-=jxbirxypJoAqsVFqQ@mail.gmail.com' \
    --to=schaefer@brasslantern.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).