Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

reset tty modes on TMOUT



Hi zsh devs,

Back in February 2023 I reported a patch to the FreeBSD mailing lists
for the zsh port.  Unfortunately, it has sat and languished ever since.

    https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269292

The patch fixes a problem, on FreeBSD at least, where the tty modes
are not reset if zsh exits on a TMOUT.  You can see details of the before
and after tty modes in the PR above.

In short:
	- log in to a zsh shell
	- start another zsh shell, set TMOUT
	- wait until the shell exits on TMOUT
	- when the shell exits due to TMOUT, the tty modes are left
	  in an incorrect state (many cchars unset, iflag inlcr now
	  set when it shouldn't be)

The patch below fixes it:

# p ../../../files/patch-Src_signals.c
--- Src/signals.c.orig  2022-05-08 02:18:22.000000000 -0400
+++ Src/signals.c       2023-02-02 13:54:18.177017000 -0500
@@ -703,6 +703,8 @@
  		 */
  		errflag = noerrs = 0;
  		zwarn("timeout");
+ 		if (zleactive)
+ 		    settyinfo(&shttyinfo);
  		stopmsg = 1;
  		zexit(SIGALRM, ZEXIT_SIGNAL);
  	    }

The line numbers appear to have changed in the current zsh code on git,
but this patch still works at line 703 on FreeBSD.  Looks like the patch
line 703 needs to be 485 now.

	-jr





Messages sorted by: Reverse Date, Date, Thread, Author