Date: Sun, 31 Aug 2008 23:48:35 +0300 From: Giorgos Keramidas <keramida@freebsd.org> To: Ed Schouten <ed@80386.nl> Cc: current@freebsd.org Subject: Re: csh history and pts Message-ID: <871w04syfw.fsf@kobe.laptop> In-Reply-To: <20080831200950.GF99951@hoeg.nl> (Ed Schouten's message of "Sun, 31 Aug 2008 22:09:50 %2B0200") References: <48BAD085.1090507@gmail.com> <20080831200950.GF99951@hoeg.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-= On Sun, 31 Aug 2008 22:09:50 +0200, Ed Schouten <ed@80386.nl> wrote: > Some people on IRC told me that (t)csh had some problems with "pty > detection" with MPSAFE TTY, but grepping through the source and asking > various people around the globe, I still have no idea what "pty > detection" is and why (t)csh has the urge to "detect pty's". > > Maybe a (t)csh guru can help me out? Yes, a bit of background is probably going to be useful... tcsh enables autologout automatically to a default of 60 seconds in the following cases: Set to `60' (automatic logout after 60 minutes, and no locking) by default in login and superuser shells, but not if the shell thinks it is running under a window system (i.e., the DISPLAY environment variable is set), the tty is a pseudo-tty (pty) or the shell was not so compiled (see the version shell variable). The `contrib/tcsh/sh.c' code implements this near line 456: 456 if (loginsh || (uid == 0)) { 457 if (*cp) { 458 /* only for login shells or root and we must have a tty */ 459 if ((cp2 = Strrchr(cp, (Char) '/')) != NULL) { 460 cp2 = cp2 + 1; 461 } 462 else 463 cp2 = cp; 464 if (!(((Strncmp(cp2, STRtty, 3) == 0) && Isalpha(cp2[3])) || 465 Strstr(cp, STRslptssl) != NULL)) { 466 if (getenv("DISPLAY") == NULL) { 467 /* NOT on X window shells */ 468 setcopy(STRautologout, STRdefautologout, VAR_READWRITE); 469 } 470 } 471 } 472 } The STRslptssl[] char array contains { '/', 'p', 't', 's', '/', '\0' }, in wide char format, and this is where the check for /dev/pts/xxx is done. By skimming through the code I haven't been able to see anything odd, after the fix we installed in subversion change r172665: ------------------------------------------------------------------------ r172665 | mp | 2007-10-15 18:23:07 +0300 (Mon, 15 Oct 2007) | 6 lines Import two vendor fixes from tcsh-6.15.01 for MFC to 7.0. The fixes are: - Fix pty detection for autologout setting - kill `foo` got stuck because sigchld was disabled too soon Requested by: re ------------------------------------------------------------------------ I have an IRC log from scottl noting that he still got the default 60 second autologout, but this was on 6.X IIRC: * scottl__ tries to remember how to turn off auto-logout <motminh> scottl__: tcsh option - I guess tcsh can no longer determin activity post TTY? <keramida> scottl__: I remember Kris mentioning an mpsafetty & tcsh issue. I haven't had the time to go back and check if the pty-detection we fixed with kern.pts.enable=1 still works after mpsafetty <motminh> scottl__: what does echo $autologout say? <scottl__> [y1] ~> echo $autologout <scottl__> 60 <scottl__> on a 6.3 machine, I get <scottl__> pooker] ~> echo $autologout <scottl__> autologout: Undefined variable. I can't reproduce this with a current from Aug 29, but this snapshot has been built with the experimental 'packet mode' patch, and a few other local changes, so I will have to try with a clean /head/ snapshot. HTH, Giorgos --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAki7A6kACgkQ1g+UGjGGA7bnJACdFompVLnYMH7YCjm/TyzS+QZ6 bR4AoLv8of5HMtlHdJ50MWE3G+Eqt3FJ =RrQW -----END PGP SIGNATURE----- --=-=-=--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?871w04syfw.fsf>