Misleading errors from Network.Socket
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 found a bug.
Trac metadata
Trac field | Value |
---|---|
Version | 6.12.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |