[GHC] #13525: hWaitForInput with timeout causes program to abort

GHC ghc-devs at haskell.org
Fri Apr 21 19:19:09 UTC 2017


#13525: hWaitForInput with timeout causes program to abort
----------------------------------+--------------------------------------
        Reporter:  bgamari        |                Owner:  (none)
            Type:  bug            |               Status:  patch
        Priority:  highest        |            Milestone:  8.2.1
       Component:  Compiler       |              Version:  8.0.2
      Resolution:                 |             Keywords:
Operating System:  Linux          |         Architecture:  x86_64 (amd64)
 Type of failure:  Runtime crash  |            Test Case:
      Blocked By:                 |             Blocking:
 Related Tickets:  #12912, #8684  |  Differential Rev(s):  Phab:D3473
       Wiki Page:                 |
----------------------------------+--------------------------------------

Comment (by bgamari):

 Merged to `master` as,

 In [changeset:"e5732d2a28dfb8a754ee73e124e3558222a543bb/ghc" e5732d2/ghc]:
 {{{
 base: Fix hWaitForInput with timeout on POSIX

 This was previously broken (#13252) by
 f46369b8a1bf90a3bdc30f2b566c3a7e03672518, which ported the fdReady
 function from `select` to `poll` and in so doing dropping support for
 timeouts. Unfortunately, while `select` tells us the amount of time not
 slept (on Linux anyways; it turns out this is implementation dependent),
 `poll` does not give us this luxury. Consequently, we manually need to
 track time slept in this case.

 Unfortunately, portably measuring time is hard. Ideally we would use
 `clock_gettime` with the monotonic clock here, but sadly this isn't
 supported on most versions of Darwin. Consequently, we instead use
 `gettimeofday`, running the risk of system time changes messing us up.

 Test Plan: Validate

 Reviewers: simonmar, austin, hvr

 Reviewed By: simonmar

 Subscribers: rwbarton, thomie

 GHC Trac Issues: #13252

 Differential Revision: https://phabricator.haskell.org/D3473
 }}}

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


More information about the ghc-tickets mailing list