#4808: File descriptor reuse causes Handle to point to a different stream
------------------------+---------------------------------------------------
    Reporter:  clemens  |       Owner:                                         
        Type:  bug      |      Status:  new                                    
    Priority:  normal   |   Component:  libraries/base                         
     Version:  7.0.1    |    Keywords:  fd reuse, file descriptor, handle reuse
    Testcase:           |   Blockedby:                                         
          Os:  Linux    |    Blocking:                                         
Architecture:  x86      |     Failure:  None/Unknown                           
------------------------+---------------------------------------------------

Comment(by clemens):

 Could it be the case that wantWritableHandle for DuplexHandle is
 malfunctional?

 Compare the FileHandle with the DuplexHandle case in
 GHC.IO.Handle.Internals
 {{{
 wantWritableHandle :: String -> Handle -> (Handle__ -> IO a) -> IO a
 wantWritableHandle fun h@(FileHandle _ m) act
   = wantWritableHandle' fun h m act
 wantWritableHandle fun h@(DuplexHandle _ _ m) act
   = withHandle_' fun h m  act
 }}}
 The FileHandle case calls wantWritableHandle' which actually does the
 check on ClosedHandle state by wrapping act in a checkWritableHandle
 function:
 {{{
 wantWritableHandle' fun h m act
    = withHandle_' fun h m (checkWritableHandle act)
 }}}
 The DuplexCase just calls withHandle_' without any further checks of
 haType.

 Same applies to wantReadable handle. Here the DuplexHandle case also
 misses the ClosedHandle check. This doesn't look right from the first
 glance.

 Will try a fix tomorrow.

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

Reply via email to