From owner-freebsd-current@FreeBSD.ORG Sun Aug 31 20:49:13 2008 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98F071065673 for ; Sun, 31 Aug 2008 20:49:13 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 1348E8FC1A for ; Sun, 31 Aug 2008 20:49:12 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from kobe.laptop (adsl10-93.kln.forthnet.gr [77.49.137.93]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id m7VKmij8030678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 31 Aug 2008 23:48:50 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id m7VKmh4x003253; Sun, 31 Aug 2008 23:48:43 +0300 (EEST) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id m7VKmgGg003252; Sun, 31 Aug 2008 23:48:42 +0300 (EEST) (envelope-from keramida@freebsd.org) From: Giorgos Keramidas To: Ed Schouten References: <48BAD085.1090507@gmail.com> <20080831200950.GF99951@hoeg.nl> Date: Sun, 31 Aug 2008 23:48:35 +0300 In-Reply-To: <20080831200950.GF99951@hoeg.nl> (Ed Schouten's message of "Sun, 31 Aug 2008 22:09:50 +0200") Message-ID: <871w04syfw.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-MailScanner-ID: m7VKmij8030678 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.288, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.11, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@freebsd.org X-Spam-Status: No Cc: current@freebsd.org Subject: Re: csh history and pts X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Aug 2008 20:49:13 -0000 --=-=-= On Sun, 31 Aug 2008 22:09:50 +0200, Ed Schouten 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 scottl__: tcsh option - I guess tcsh can no longer determin activity post TTY? 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 scottl__: what does echo $autologout say? [y1] ~> echo $autologout 60 on a 6.3 machine, I get pooker] ~> echo $autologout 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----- --=-=-=--