Skip to content

Posix.popen is broken

Posix.popen hangs if the input is longer than 4096
characters.

For example, attempting to run the attached Haskell
source file will result in the program hanging.  The
program attempts
to use Posix.popen to invoke "cat" without 5000 blank
lines as input.

The problem is that it tries to write to the pipe
before forking.
If there are more than 4096 characters, this will block
until some process reads from the pipe.  But there's
only one process,
so it deadlocks.

Trac metadata
Trac field Value
Version None
Type Bug
TypeOfFailure OtherFailure
Priority low
Resolution ResolvedNoReason
Component hslibs/posix
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information