[Bug preprocessor/90034] gcc hangs on wait4 after vfork after opening tmp file

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 10 14:34:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90034

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
[...]
> 
> Smaller testcase that will hang:
> 
> #line 1 "/dev/stdout"
> #def xy

Presumably we're blocked, waiting on ourselves to write something to our
stdout so that we can read it.

I was able to reproduce this hang with gcc 4.8.3, so this isn't a regression.

> we should probably check whether the file we opened is a regular file
> before trying to read from it.
[...]

$ ll /dev/stdout
lrwxrwxrwx. 1 root root 15 Nov 26 09:29 /dev/stdout -> /proc/self/fd/1

$ ll /proc/self/fd/1
lrwx------. 1 david david 64 Apr 10 11:13 /proc/self/fd/1 -> /dev/pts/8

$ ll /dev/pts/8
crw--w----. 1 david tty 136, 8 Apr 10 11:14 /dev/pts/8

Presumably we ought to support source "files" that are symlinks; should we
resolve all symlinks before opening, and then require the result to be a
regular file?

Or some other kind of sanity-checking?


More information about the Gcc-bugs mailing list