#3808: piping  binary files sometimes fail
-------------------------------+--------------------------------------------
    Reporter:  paolino         |        Owner:  simonmar     
        Type:  bug             |       Status:  assigned     
    Priority:  high            |    Milestone:  6.12.2       
   Component:  Compiler        |      Version:  6.12.1       
    Keywords:  pipe binary IO  |   Difficulty:               
          Os:  Linux           |     Testcase:               
Architecture:  x86_64 (amd64)  |      Failure:  Runtime crash
-------------------------------+--------------------------------------------

Comment(by paolino):

 Replying to [comment:3 simonmar]:
 > `Data.ByteString.Lazy.hGetContents` calls `hIsEOF` which calls
 `hLookAhead`, and `hLookAhead` reads the next `Char` from the `Handle`,
 which does Unicode decoding. Putting `stdin` into binary mode fixes the
 problem.
 >
 In the program revealing the error, putting stdin in binary mode was not
 fixing. It is my fault that I coldn't reproduce that behaviour in the
 given example, which indeed is fixed by this setting.
 > After giving this a bit of thought, I think the best solution is to make
 `hIsEOF` not do any decoding, so I'll look into doing that.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3808#comment:5>
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

Reply via email to