#3808: piping binary files sometimes fail
-------------------------------+--------------------------------------------
Reporter: paolino | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.12.1
Resolution: | Keywords: pipe binary IO
Os: Linux | Testcase:
Architecture: x86_64 (amd64) | Failure: None/Unknown
-------------------------------+--------------------------------------------
Changes (by Baughn):
* cc: [email protected] (added)
Comment:
I'd like to add that
- If you write the output of prod to a file, and then read it in, cons
doesn't fail.
- If you write the output of prod to a file, and read it in through pipe
as in 'cat output | ./cons', cons doesn't fail.
- If you simplify prod, using [0..] instead of fibs, cons hasn't failed
either.
This suggests that the bug is timing-dependent, which doesn't seem
plausible on the face of it. However, one way in which pipes are timing-
dependent is that the read() system call can return incomplete data when
reading from pipes (although not when reading from files, at least on
linux). Therefore, it would be useful to consider what happens when read
does return incomplete data.
Regardless of the exact circumstances, the bug itself is one that should
never happen. Reading bytestrings uses the binary hGetBuf function, and
should always ignore encoding; thus, no encoding error should be produced.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3808#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs