This is not about a bug, but a feature request: Suppose I ssh into a server on Mars. Whenever I press a key, I will first see the echoed keystroke some 20 minutes later. Very unnerving!
Luckily, the sshd on Mars can put its pty in EXTPROC mode. Input line editing (with backspace) and character echo are disabled by the tty driver, and will now be done on Earth by the ssh client. (this is known as LINEMODE, c.f. RFC 1116) The Martian client (say a shell) doesn't have to know about this, but whenever it turns e.g. ECHO off this will now actually change the behaviour of the Earthly client. To do this, this client must of course know about the state (termios structure) of the Martian pty. To make this possible, EXTPROC uses packet mode, and a special packet (having a control byte with TIOCPKT_IOCTL set) will communicate pty state changes (say by sending the new termios structure to Earth) Now we're at it, we might as well build readline into the ssh client so that line editing becomes really comfortable. But here is a snag: if the Martian shell uses readline itself, it will keep its terminal in non-canonical mode all the time, so that we on Earth never get to know that Mars is expecting entire lines from us. Howard Chu, who submitted a patch to put EXTPROC in the linux tty driver this summer, suggested that readline sense EXTPROC and would behave like "gets with a prompt" in that case, keeping the terminal in canonical mode, so that Earthlings can use the readline on their side. He even submitted a (quick and dirty) patch for readline but I cannot find any response to his submission. The upcoming version of the readline wrapper rlwrap will also be able to use EXTPROC, as it solves the long standing race condition where rlwrapped command may change its terminal state and rlwrap will only learn about that *after* the next keypress. Using EXTPROC, rlwrap will be notified immediately by a packet with TIOCPKT_IOCTL. If readline were "EXTPROC-aware" then one could transparently rlwrap commands that use readline and have rlwrap do the line editing. This can be useful when e.g. the command doesn't save its command history, or if we prefer a coloured prompt. I am not quite sure how widespread EXTPROC is. It used to be in BSD, but was retired from FreeBSD in 2004, when they apparently lost all faith in interplanetary travel. Linux never knew about it until summer 2010, when the spread of mobile internet made people sometimes wonder whether the whole internet had suddenly relocated to Mars. My question (after this long and winding story): wouldn't it be a good idea to make readline EXTPROC-aware? regards Hans -- Hans Lub tel/fax +31 (0)30 2899249 Dolomieten 74 3524 VH Utrecht (Nederland) [email protected] _______________________________________________ Bug-readline mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-readline
