Re: tty/pty problem

Tony Nugent (tonyn@sctnugen.ppp.gu.edu.au)
Sat, 17 Feb 1996 14:42:30 +1000


Thu, 15 Feb 1996, Jon Lewis <jlewis@inorganic5.fdt.net>:

> Subject: tty/pty problem
> To: unlisted-recipients:; (no To-header on input)

Problem?

> Has anyone ever noticed/fixed a problem in 1.2.13 in which a tty will
> hang? By hang, I mean when I telnet or rlogin to the system, if I get a
> "bad" tty, I get:
> Trying 205.229.48.17...
> Connected to yoda.fdt.net.
> Escape character is '^]'.
>
> Linux 1.2.13 (yoda.fdt.net) (ttyp5)
>
> and then nothing else.

Known problem with 1.2.13. Patch for n_tty.c below.

> On yoda, I can see a process for login running
> (sleeping) on the tty in question. Short of rebooting, or firing up a
> screen to try grabbing the bad tty, I've found not way around this. It
> causes major problems for clients coming in from the terminal server
> since when their telnet session fails they get disconnected from the
> terminal server.

--- linux/drivers/char/n_tty.c Tue May 2 01:33:51 1995
+++ linux-1.2.13-hp/drivers/char/n_tty.c Sat Oct 14 23:35:34 1995
@@ -255,24 +255,33 @@
tail = (tail+1) & (N_TTY_BUF_SIZE-1);
}

+ /* should never happen */
+ if (tty->column > 0x80000000) {
+ printk("Trap:tty->column=%d",tty->column);
+ tty->column = 0;
+ }
+
/* Now backup to that column. */
while (tty->column > col) {
/* Can't use opost here. */
put_char('\b', tty);
- tty->column--;
+ if (tty->column > 0)
+ tty->column--;
}
} else {
if (iscntrl(c) && L_ECHOCTL(tty)) {
put_char('\b', tty);
put_char(' ', tty);
put_char('\b', tty);
- tty->column--;
+ if (tty->column > 0)
+ tty->column--;
}
if (!iscntrl(c) || L_ECHOCTL(tty)) {
put_char('\b', tty);
put_char(' ', tty);
put_char('\b', tty);
- tty->column--;
+ if (tty->column > 0)
+ tty->column--;
}
}
}
@@ -696,6 +705,8 @@
}
memset(tty->read_buf, 0, N_TTY_BUF_SIZE);
tty->read_head = tty->read_tail = tty->read_cnt = 0;
+ tty->canon_head = tty->canon_data = tty->erasing = 0;
+ tty->column = 0;
memset(tty->read_flags, 0, sizeof(tty->read_flags));
n_tty_set_termios(tty, 0);
tty->minimum_to_wake = 1;

Cheers
Tony
-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-
T.Nugent@sct.gu.edu.au tonyn@sctnugen.ppp.gu.edu.au
Brisbane Queensland Australia
-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-
Such evil deeds could religion prompt.
-- Titus Lucretius Carus