tcsh backtick hang info

Giorgos Keramidas keramida at FreeBSD.org
Mon Jul 16 09:21:51 UTC 2007


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
> | @@ -457,7 +457,7 @@ 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.



More information about the freebsd-current mailing list