zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Philippe Altherr <philippe.altherr@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>,
	Martijn Dekker <martijn@inlv.org>
Subject: Re: EXIT trap not executed on error
Date: Wed, 14 Dec 2022 22:40:03 -0800	[thread overview]
Message-ID: <CAH+w=7ZWmTmNYfT6OUrU2hL29D===iOE5cMvWY9SzKUf5E=5Hg@mail.gmail.com> (raw)
In-Reply-To: <CAGdYchuroqX0=owcipX0ChvxxK-ASVY1PO7H_duVP=DcGMindA@mail.gmail.com>

On Wed, Dec 14, 2022 at 12:35 AM Philippe Altherr
<philippe.altherr@gmail.com> wrote:
>
> I had a look at the errflag logic and admittedly I don't understand everything/much. However I noticed that other places that restore the errflag preserve the ERRFLAG_INT bit.

IMO that's irrelevant ... no trap will run when errflag is set, and in
theory at least the exit trap is the last thing we're going to do, so
remembering that we got an interrupt during the trap doesn't mean
much.  zexit() actually goes so far as to clear errflag twice and to
clear intrap as well the second time.  I'm actually pretty sure saving
and restoring errflag is not needed at all.

> I also wondered whether signals.c/dotraps would be a better place for the new logic.

I considered that, but saw dotraps being re-entered while stepping
through things with the debugger, so I thought it better to stay with
doing changes in the caller.


      reply	other threads:[~2022-12-15  6:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-08 20:08 Martijn Dekker
2022-12-12  4:52 ` Bart Schaefer
2022-12-14  4:47   ` Bart Schaefer
2022-12-14  8:35     ` Philippe Altherr
2022-12-15  6:40       ` Bart Schaefer [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='CAH+w=7ZWmTmNYfT6OUrU2hL29D===iOE5cMvWY9SzKUf5E=5Hg@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=martijn@inlv.org \
    --cc=philippe.altherr@gmail.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).