#4144: Exception: ToDo: hGetBuf - when using custom handle infrastructure
  Reporter:  AntoineLatter     |          Owner:                  
      Type:  bug               |         Status:  new             
  Priority:  normal            |      Milestone:                  
 Component:  libraries/base    |        Version:  7.6.1           
Resolution:                    |       Keywords:                  
        Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  Runtime crash     |     Difficulty:                  
  Testcase:                    |      Blockedby:                  
  Blocking:                    |        Related:                  
Changes (by joeyadams):

  * status:  closed => new
 * cc: joeyadams3.14159@… (added)
  * resolution:  fixed =>
  * component:  Compiler => libraries/base
  * version:  6.12.3 => 7.6.1
  * architecture:  x86_64 (amd64) => Unknown/Multiple
  * os:  MacOS X => Unknown/Multiple


 The fix for this is incomplete.  I implemented a custom handle to make
 network I/O interruptible on Windows, but Holger Reinhardt revealed
 [https://github.com/haskell/network/pull/79#issuecomment-11637676 a case
 where `Todo: hPutBuf` comes up].

 It looks like `bufWrite` (in GHC.IO.Handle.Text), when told to write a
 chunk that is larger than the buffer size, does a RawIO `writeChunk`,
 which only works for `FD`.  `hGetBufSome` has the same problem.

 Another problem is that the RawIO methods are sometimes called with a size
 argument of zero.  This can lead to failed system calls and unexpected
 side effects unless the implementation filters out zero-length calls.
 Also, if `RawIO.read buf 0` returns 0, the callee might treat it as EOF.

Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4144#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

Glasgow-haskell-bugs mailing list

Reply via email to