On 01/18/2015 05:45 PM, Howard Chu wrote:
Peter Hurley wrote:
Commit 26df6d13406d1 ("tty: Add EXTPROC support for LINEMODE") added
the undocumented EXTPROC input processing mode, which ignores the ICANON
setting and forces pty slave input to be processed in non-canonical
mode.
What's the motivation to remove this code, rather than improve it if it
needs fixing? It has been removed from the Linux kernel at least once
before already, and that was a mistake back then too.
It is a significant maintenance burden, and I have concerns about the
level of support it's receiving. Here's some outstanding issues:
1. No man page documentation. At a minimum, tty_ioctl(4) and termios(3)
need the userspace visible definitions and behavior documented. Better
would be a LINEMODE (7) description of how this implementation works
wrt supporting RFC 1116.
2. read(), poll()/select() and ioctl() with and without EXTPROC need to
have _identical_ userspace behavior.
3. Does the local edit guarantee canon lines <= 4096 chars? What happens
if pty slave reader does this?
char buffer[4096];
char *p = buffer;
n = read(tty, buffer, sizeof(buffer));
if (n <= 0)
goto done;
while (*p++ != '\n')
;
4. ioctl(TIOCSIG) can send _any_ signal to a different process without
permission checks. That's not good.
5. This needs to work with readline(). Right now, I don't see how this
won't have worst-case behavior, constantly sending termios changes,
with scripted input where the reader switches back-and-forth between
canonical and non-canonical mode (like readline() does). Database
shells behave like this, but you can do a 20-line shell mockup with
just readline().
6. EXTPROC still does some input processing on the server. For example,
7-bit mode (ISTRIP), tolower mode (IUCLC) and processing while
closing; if input processing is being done on the local/client side,
why the extra work here?
7. This needs a reference userspace implementation which for the moment
could double as regression testing. A library with unit tests would
be ideal.
ISTM the right implementation, if there is one, is for EXTPROC to process
input exactly like raw mode except that line termination wakes up read_wait
and there is no special casing in read/poll.
Does SLC_FORW1 & SLC_FORW2
map directly to termios.c_cc[] line termination values?
I'd like to do away with the signalling part; just turn off EXTPROC
and send the appropriate signalling char from the pty master, like telnetd
does now. Same for EOF.