Data truncation on ptys

Michael Sperber sperber at deinprogramm.de
Thu Aug 19 14:05:07 UTC 2010


I'm one of the maintainers of XEmacs, and I've been running into a
persistent problem with subprocesses / ptys since at least 5.x.  (If this
is not the right list, I'd appreciate a pointer to a more appropriate
forum.)

Here's the basic issue: Whenever XEmacs tries to send a larger chunk of
data to a subprocess over a pty, only part of the data arrives at the
other end of the pty.  XEmacs tries very hard to chop up the data into
(245-byte) pieces, terminating the pieces with NL or EOF as appropriate.
Still, when around 7.5 kilobyte is sent rapidly, I see this pattern:

master truss:
write(7," 1692 1693 1694 1695 1696 1697 1"...,245) = 245 (0xf5)
write(7,"\^D",1)				 = 1 (0x1)

slave/subprocess truss ("cat" in this case):
read(0," 1692 1693 1694 1695 1696 1697 1"...,4096) = 144 (0x90)

Subsequent writes from the master do not get seen *at all* on the slave,
i.e. the next read blocks.

If anybody could shed some light on this issue, help would be much
appreciated!

-- 
Regards,
Mike



More information about the freebsd-hackers mailing list