Re: tcsh backtick hang info

From: Giorgos Keramidas <keramida_at_FreeBSD.org>
Date: Mon, 16 Jul 2007 12:21:10 +0300
On 2007-07-15 23:00, Christos Zoulas <christos_at_zoulas.com> wrote:
> On Jul 14,  3:55am, keramida_at_freebsd.org (Giorgos Keramidas) wrote:
> | Hi Christos,
> |
> | Can we persuade you to include the following local patch I keep for
> | autologout detection with /dev/pts/XXX ptys in FreeBSD?
> |
> | %%%
> | Fix pty detection logic of tcsh autologout initialization.
> |
> | Noticed by:     kris
> |
> | diff --git a/contrib/tcsh/sh.c b/contrib/tcsh/sh.c
> | --- a/contrib/tcsh/sh.c
> | +++ b/contrib/tcsh/sh.c
> | _at__at_ -457,7 +457,7 _at__at_ main(int argc, char **argv)
> |         if (*cp) {
> |             /* only for login shells or root and we must have a tty */
> |             if ((cp2 = Strrchr(cp, (Char) '/')) != NULL) {
> | -               cp = cp2 + 1;
> | +               cp2 = cp2 + 1;
> |             }
> |             else
> |                 cp2 = cp;
> | %%%
>
> The code is wrong but I think that the fix is not exactly right... The
> following should work:
>
>             /* only for login shells or root and we must have a tty */
>             if ((cp2 = Strrchr(cp, (Char) '/')) != NULL) {
>                 cp2 = cp2 + 1;
>             }
>             else
>                 cp2 = cp;
>             if (!(((Strncmp(cp2, STRtty, 3) == 0) && Isalpha(cp2[3])) ||
> 		Strstr(cp, Strslptssl) != NULL)) {
>                 if (getenv("DISPLAY") == NULL) {
>                     /* NOT on X window shells */
>                     setcopy(STRautologout, STRdefautologout, VAR_READWRITE);

Ah!  Much better indeed.  I'm happy a fix is going to be in upstream
tcsh now :-)

> Thanks for the bug report. wonder how come nobody complained for
> years!

This was really brought to my notice by Kris Kennaway, so he's the one
we should thank.
Received on Mon Jul 16 2007 - 07:21:51 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:14 UTC