Re: 1.3.72 bad news

Theodore Ts'o (tytso@mit.edu)
Thu, 14 Mar 1996 20:14:57 -0500


Date: Thu, 14 Mar 1996 03:59:27 -0800
From: wing@666.com (Ben Wing)

1) There appears to be a race condition in the PTY or socket code.
This problem is rather serious, I think. The idea here is that
I run `M-x grep foo *.c' from XEmacs, where `*.c' expands to
all of the source files for XEmacs (quite a lot of them have
`foo' in it). This spawns a subprocess (which runs the obvious
grep command), and captures its output using a PTY. The primary
event loop in XEmacs does a select() over a number of file
descriptors (including the PTY), and when output from the PTY
is available, it's read in and inserted in an Emacs buffer.

Now the problem I'm observing is that sometimes the end of
the output is lost.....

I can reproduce this problem using emacs 19.28. Unfortunately, I can't
duplicate it using any other program. typescript, xterm, all work fine.
Even "cat /dev/ptypf" in one window, followed by "grep print *.c >
/dev/ttypf" in another works fine.

Furthermore, I've looked through the changes between 1.2.13 and 1.3.72
in pty.c and tty_io.c, and I don't see any changes that should make any
difference. So, I'm puzzled.

If anyone can come up with a (slightly smaller) test case than emacs,
I'd really appreciate it. This is definitely a real bug, and it's
likely to be in the tty subsystem. Now, if only I can figure out what
it is...

- Ted