From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-users@zsh.org
Subject: Re: Zsh spins in endless loop with SIGHUP + read in zshexit
Date: Fri, 14 May 2021 18:44:48 +0100 [thread overview]
Message-ID: <c87ab72eb7f9df91d4357d412c9fea2f85cee373.camel@ntlworld.com> (raw)
In-Reply-To: <979701293.98679.1620986176059@mail2.virginmedia.com>
On Fri, 2021-05-14 at 10:56 +0100, Peter Stephenson wrote:
> > 3) exit (bin_break + BIN_EXIT)
> > 3a) in a shell function (ZEXIT_DEFERRED)
>
> Focussing on this one, I tried
>
> TRAPEXIT() { while true; do exit; done; }
>
> and sure enough the shell is looping forever if I kill the terminal.
> (Obviously, as written that's a daft thing to do, but with an appropriate
> set of internal conditions it might become realistic.)
>
> This is the sort of thing I was thinking about --- the answer is probably
> going to be along the lines of "breaks = loops" etc. in that condition
> at the top of zexit(), but I haven't made a patch as I suspect there's
> going to be more to the can of worms.
Actually, this seems to work and may be one of the less complicated
aspects of this.
pws
diff --git a/Src/builtin.c b/Src/builtin.c
index b7ceefd55..a29eb49e4 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5828,8 +5828,11 @@ zexit(int val, enum zexit_t from_where)
* a later value always overrides an earlier.
*/
exit_val = val;
- if (shell_exiting == -1)
+ if (shell_exiting == -1) {
+ retflag = 1;
+ breaks = loops;
return;
+ }
if (isset(MONITOR) && !stopmsg && from_where != ZEXIT_SIGNAL) {
scanjobs(); /* check if jobs need printing */
next prev parent reply other threads:[~2021-05-14 17:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-13 10:17 Jörg Sommer
2021-05-13 14:36 ` Daniel Shahaf
2021-07-18 19:11 ` Lawrence Velázquez
2021-07-27 3:14 ` Daniel Shahaf
2021-05-13 15:51 ` Peter Stephenson
2021-05-13 15:54 ` Bart Schaefer
2021-05-13 16:07 ` Peter Stephenson
2021-05-13 16:30 ` Bart Schaefer
2021-05-13 18:44 ` Peter Stephenson
2021-05-13 21:37 ` Bart Schaefer
2021-05-14 9:56 ` Peter Stephenson
2021-05-14 17:44 ` Peter Stephenson [this message]
2021-05-14 18:51 ` 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=c87ab72eb7f9df91d4357d412c9fea2f85cee373.camel@ntlworld.com \
--to=p.w.stephenson@ntlworld.com \
--cc=zsh-users@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).