[GHC] #4454: Misleading errors from Network.Socket

GHC cvs-ghc at haskell.org
Fri Oct 29 12:37:49 EDT 2010


#4454: Misleading errors from Network.Socket
---------------------------------+------------------------------------------
    Reporter:  Olathe            |       Owner:                             
        Type:  bug               |      Status:  new                        
    Priority:  normal            |   Component:  libraries/base             
     Version:  6.12.3            |    Keywords:                             
    Testcase:                    |   Blockedby:                             
          Os:  Unknown/Multiple  |    Blocking:                             
Architecture:  Unknown/Multiple  |     Failure:  Incorrect result at runtime
---------------------------------+------------------------------------------
 == Problem ==
 You must wrap sockets code with `Network.Socket.withSocketsDo` on Windows,
 or it will give misleading error messages :

 {{{
 Prelude Network.Socket> getAddrInfo Nothing (Just "google.com") Nothing
 *** Exception: getAddrInfo: does not exist (error 10093)
 Prelude Network.Socket> withSocketsDo $ getAddrInfo Nothing (Just
 "google.com") Nothing
 [AddrInfo {addrFlags = [], addrFamily = AF_INET, addrSocketType =
 NoSocketType, ...
 }}}

 The error message led me on quite a wild goose chase trying `cabal install
 Network` and installing MinGW to let cabal work properly.

 == Proposed solution ==
 It should give a clear error message whenever anything in `Network.Socket`
 is used without wrapping.

 This should happen ''even outside of Windows'' as there are network
 libraries on Hackage developed on things other than Windows. Library
 authors are misled when they don't wrap their sockets code and everything
 tests perfectly on their non-Windows machine. When they learn about this
 issue, testing for it is an unnecessary hassle, since they then need to
 gain access to a Windows machine every time they want to be confident
 they've tested.

 I encountered my own frustration with this when I installed http-
 enumerator and [http://github.com/snoyberg/http-enumerator/issues#issue/1
 found a bug].

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


More information about the Glasgow-haskell-bugs mailing list