Re: reset tty modes on TMOUT

Mikael Magnusson <[email protected]> Mon, 27 Jul 2026 08:42:25 +0200
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <CAHYJk3ScYCCoRad=D26Cbt2M50S+YxLt3R3iprtn=WM8XhyhSg@mail.gmail.com>
On Mon, Jul 27, 2026 at 6:07=E2=80=AFAM Bart Schaefer <schaefer@brasslanter=
n.com> wrote:
>
> On Sat, Jul 25, 2026 at 11:22=E2=80=AFAM J.R. Oldroyd <[email protected]> wro=
te:
> >
> > On Fri, 24 Jul 2026 19:36:35 -0700 Bart Schaefer <schaefer@brasslantern=
.com> wrote:
> > >
> > > On Fri, Jul 24, 2026 at 10:26=E2=80=AFAM J.R. Oldroyd <[email protected]>=
 wrote:
> > > >
> > > > +               if (zleactive)
> > > > +                   settyinfo(&shttyinfo);
> > > >                 stopmsg =3D 1;
> > > >                 zexit(SIGALRM, ZEXIT_SIGNAL);
> > >
> > > Shouldn't this happen inside zexit() for any ZEXIT_SIGNAL ?
>
> That question was more aimed at zsh-workers in general.
>
> In fact I wonder whether zexit() ought to reset the tty when zleactive
> no matter what caused the exit.
>
> > If you wish to send any alternate patches, I am happy to try and post
> > back if they work or not.
>
> The patch is easy ... but a new question is why the shell is exiting
> at all.  I didn't think about this at first, but the ALRM signal isn't
> supposed to be fatal.

The default action is to exit,
              If  no  trap  is  set, and the idle time of the terminal
is not less than the
              value of the TMOUT parameter, zsh  terminates.

Perhaps it is a bit unexpected that it also exits when sent an ALRM
signal when TMOUT is unset or 0 though. I suppose any non-zero idle
time is 'not less than' 0 by definition, but still.

--=20
Mikael Magnusson