csh history and pts
Giorgos Keramidas
keramida at freebsd.org
Sun Aug 31 20:49:13 UTC 2008
On Sun, 31 Aug 2008 22:09:50 +0200, Ed Schouten <ed at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20080831/80675db9/attachment.pgp
More information about the freebsd-current
mailing list