I agree with the commit that reverts my ICANON change. Yet:
There is AFAIK no bug report or test case for the long line problem.
AFAIK, the missing bug-report is the one that shows the ills of sending
EOFs, while the bug-report for long-lines is bug#6149, which should be
re-opened.
+ /* There is no more "send eof to flush" going on (which is wrong and
+ unportable in itself), and disabling ICANON breaks a lot of stuff
+ and shows literal ^D in many cases. The correct way to handle too
+ much output is to buffer what could not be written and then write it
+ again when select returns ok for writing.
Could you spell out more precisely how it's different from what we do
now: we already check emacs_write's output to see if the buffer is full,
in which case we wait, don't we?
+ s.main.c_lflag |= ICANON; /* Enable line editing and eof processing */
+ s.main.c_cc[VEOF] = 'D'&037; /* Control-D */
s.main.c_cc[VMIN] = 1;
s.main.c_cc[VTIME] = 0;
IIUC VMIN and VTIME not only are specific to the non-ICANON mode, but
also they use the same slot as some of the other settings (specifically
the slots may be shared with VEOL and VEOF, according to my manpage).