Changed behaviour when reading from FIFOs!
Simon Marlow
simonmar at microsoft.com
Mon Oct 29 09:08:23 EST 2001
Volker Stolz writes:
> Something broke when reading from FIFOs in the transition from
> 5.00 to 5.02. The following program behaves as it should in
> 5.00, but with 5.02 it fails after printing the last line
> (strangely for varying numbers of "last"!) with
>
> Fail: end of file
> Action: hGetChar
> Handle: {loc=foo,type=readable,binary=False,buffering=none}
> File: foo
This appears to be because the dummy Handle opened in WriteMode is being
garbage collected and closed, which leaves the FIFO with no writers so
you get EOF. 5.02 is behaving correctly here. You can add an extra
'hClose dummy' at the end of 'main' to prevent the EOF exception.
> Another issue is that it won't work at all with LineBuffering:
> It will just print one line and then sit around doing nothing.
You have some extra blocking in there: just comment out the first two
lines of fifoReadLoop, and everything should be fine. This also fixes
the other problem you mentioned above ("varying numbers of last").
Cheers,
Simon
More information about the Glasgow-haskell-bugs
mailing list