[GHC] #11009: Errors reading stdin on Windows

GHC ghc-devs at haskell.org
Fri Oct 23 00:40:07 UTC 2015


#11009: Errors reading stdin on Windows
-------------------------------------+-------------------------------------
           Reporter:  ncreep         |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:                 |           Version:  7.10.2
  libraries/base                     |
           Keywords:                 |  Operating System:  Windows
       Architecture:  x86_64         |   Type of failure:  Incorrect result
  (amd64)                            |  at runtime
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Hi,


 I'm running GHC 7.10.2 on Windows 7 x64. Given this code that reads bytes
 of `stdin`:
 {{{#!hs
 import Foreign.C
 import Foreign
 import System.Posix.Internals
 import qualified GHC.IO.FD as FD

 readStdin bytes = allocaBytes bytes $ \p ->
   throwErrnoIfMinus1 "" $ c_safe_read (FD.fdFD FD.stdin) p (fromIntegral
 bytes)
 }}}

 Running
 {{{#!hs
 readStdin (32 * 1024)
 }}}

 Throws the following
 {{{
 *** Exception: resource exhausted (Not enough space)
 }}}

 Taking less bytes, e.g. `readStdin (30 * 1024)`, runs as expected.

 This code is motivated by
 [[https://github.com/haskell/bytestring/issues/35|this]] issue in the
 `bytestring` library. This is essentially a minimization of the error case
 [[https://github.com/haskell/bytestring/issues/35#issuecomment-148954406|here]].

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11009>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list