Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 23, 2013
An "enum" for Python 3
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
1. "Also, no matter how many bytes are requested in the read() call, at most one line shall be
returned." (in canonical mode)
2. "process to close a terminal device file shall cause any output to be sent to the device and any
input to be discarded."
I don't think the problem is in userland, neither emacs nor kdesu. Can someone comment?
A tempest in a tty pot
Posted Aug 1, 2009 10:15 UTC (Sat) by nix (subscriber, #2304)
Since this can happen when you're reading any data from anywhere, it seems
unfortunate that Emacs isn't looping on -EINTR in read() everywhere.
(That part of the Unix API sucks rocks. SA_RESTART should have been the
default forever, IMNSHO. Instead, we *still* can't rely on it if we want
to be portable: two of the platforms I have to write code for don't
support it, so it's still -EINTR loops everywhere...)
Posted Aug 2, 2009 15:36 UTC (Sun) by pflugstad (subscriber, #224)
Shouldn't emacs really be looping until it get EOF/close on the pipe
(which would implicitly loop on -EINTR)? Unfortunatley, I don't have
my copy of Stevens handy... it's been too long since I messed with tty/pty stuff.
Depending on the ordering of SIGCHLD and reading data from the pipe seems quite fragile to me. I'm surprised something as mature/old as Emacs depends on it.
Posted Aug 2, 2009 19:58 UTC (Sun) by nix (subscriber, #2304)
Otherwise you're going to loop forever if there's an error.
Posted Aug 3, 2009 13:02 UTC (Mon) by clugstj (subscriber, #4020)
Assuming an order between read() and signal reception is ALWAYS a bad idea.
Posted Aug 3, 2009 3:49 UTC (Mon) by alex_the_d (guest, #59935)
It's not a pipe nor stream, it's an intaractive tty/pty.
Posted Aug 3, 2009 22:30 UTC (Mon) by nix (subscriber, #2304)
(Emacs is not the device. The device and buffering for it are kernel
entities. Emacs is merely the entity on the *master side* of the device.)
Posted Aug 4, 2009 8:46 UTC (Tue) by alex_the_d (guest, #59935)
No, 'kernel entities' are 'device driver(s)'. THE device is that beige box on the table or a piece of
code emulating it (emacs).
Posted Aug 4, 2009 21:06 UTC (Tue) by nix (subscriber, #2304)
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds