Created attachment 9507 [details]
When a process calls fork while some stdio streams open the underlying file offsets are modified in the child causing the parent to read from the wrong offset on the next buffer underflow. This was broken by commit 18d26750dd8fd328a78cf639fd0ec2494680a2a4.
Is it really fork and not exit? If I replace exit with _exit, the endless loop goes away.
The cause appears to be that unbuffering read-only streams needs to adjust the file descriptor seek offset, otherwise the next character read would be wrong.
Yes, this is about the exit actually. But reading "2.5.1 Interaction of File Descriptors and Standard I/O Streams", I think this is really undefined, because the required action is not performed before the call to fork, and the correct fix is to use _exit in the forked child.
Closing as INVALID.