LWN.net Logo

A tempest in a tty pot

A tempest in a tty pot

Posted Aug 2, 2009 15:36 UTC (Sun) by pflugstad (subscriber, #224)
In reply to: A tempest in a tty pot by nix
Parent article: A tempest in a tty pot

Good explanation, thanks!

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.


(Log in to post comments)

A tempest in a tty pot

Posted Aug 2, 2009 19:58 UTC (Sun) by nix (subscriber, #2304) [Link]

Not exactly, It should loop as long as it gets any data, until it
gets -EOF/close on the pipe or gets *any error other than -EINTR*.

Otherwise you're going to loop forever if there's an error.

A tempest in a tty pot

Posted Aug 3, 2009 13:02 UTC (Mon) by clugstj (subscriber, #4020) [Link]

Anything as "old/mature" as Emacs probably has other bad assumptions lurking in it. It should come as no surprise.

Assuming an order between read() and signal reception is ALWAYS a bad idea.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds