Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Zsh spins in endless loop with SIGHUP + read in zshexit
- X-seq: zsh-users 26737
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Jörg Sommer <joerg@xxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Zsh spins in endless loop with SIGHUP + read in zshexit
- Date: Thu, 13 May 2021 17:07:10 +0100 (BST)
- Archived-at: <https://zsh.org/users/26737>
- Importance: Medium
- In-reply-to: <CAH+w=7ZUJ_WMjJzx-fcwEVigji-nkLfRRdoWGgS8rpwiXck7Eg@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <20210513101751.j5vo2dbrd5uzwju4@jo-so.de> <CAH+w=7ZUJ_WMjJzx-fcwEVigji-nkLfRRdoWGgS8rpwiXck7Eg@mail.gmail.com>
> On 13 May 2021 at 16:54 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Thu, May 13, 2021 at 3:18 AM Jörg Sommer <joerg@xxxxxxxx> wrote:
> >
> > I'm using `read` in `zshexit` and when my terminal crashes (e.g. XTerm gets
> > killed or ssh connection dies) Zsh spins in an endless loop until I kill it
> > with SIGKILL (SIGTERM doesn't work).
> > [...]
> >
> > So, if `raw_getbyte` returns `0` `zexit` gets called again. I think this
> > causes the loop.
>
> Yep. zexit() is a no-op there because it doesn't allow itself to
> execute recursively.
>
> There might be other places where similar loops can be triggered. I
> see just now PWS has also produced a different patch, which requires
> that zexit() return a value; I have no opinion on whether that's
> actually preferable.
I think the only possible issue with just a break would be if we didn't
want to return immediately. But I don't think that's an issue here:
zexit() can't do it's "ooh! you've got jobs" because it's way too late,
and the repeat over multiple ^D's is handled down here in ZLE anyway,
so it's in a position to know that's no-go as well. So don't see why
your simple patch shouldn't work.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author