termio TCSETAF bug
Michael Bloom
mb at ttidca.TTI.COM
Sat Sep 10 11:18:35 AEST 1988
The man page for TERMIO(7) states that TCSETAF flushes the input queue
after waiting for output to drain.
In fact, in s5 rel 3.0, it's doing a ttyflush(tp,FREAD|FWRITE), flushing
both input AND output.
Harmless, you say, since it's already waited for output to drain?
Not so. I discovered this after adding packet mode to the pty driver
on my system to support remote flushing. Afterward, the bug displayed
itself quite graphically. While rlogined, every time emacs called it's
internal error handler, i.e to report an invalid command, the screen
would go haywire.
This turned out to be due to emacs's use of TCSETAF to flush terminal
input on user error. The flush (both input and OUTPUT) was being
propagated out of band to the rlogin client, which dutifully flushed
output smack in the middle of a set of terminal escape sequences which
were only now being displayed.
Admittedly, TCFLSH would have been a better choice for emacs to have used,
but given the current termio documentation, the use of TCSETAF was not
unreasonable. For the time being, i've modified emacs to use TCFLSH.
So, now two questions.
First, is this a bug in the documentation or in the tty code?
Second, noting that the SunOs 4.0 manual page is identical in this
regard to the sys5 manual page, does TCSETAF behavior in the new Sun
tty driver follow the man page or the original sys5 code?
More information about the Comp.unix.wizards
mailing list