Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

hWaitForInput with socket as handle excepts on windows
If I create a socket wrapped in a Handle (either by directly creating a handle with connectTo, or by creating a socket and wrapping it), hWaitForInput and hReady always give an exception with that handle. It excepts directly when calling, it does not wait until the given timeout of hWaitForInput has expired. The following code exposes the bug (requiring that a server-socket is listening on port 7892): ```hs module SockDebug where import System.IO import Network main = do sock <- connectTo "localhost" (Service $ show 7892) hWaitForInput sock 5000 ``` Excepts with "hWaitForInput: invalid argument (Invalid argument)" Happens both on windows 10 and windows 7. This is the same error as in ticket 1198 so I'd guess that the bug is in cbits/inputReady.c as well, but I'm not an expert. <details><summary>Trac metadata</summary> | Trac field | Value | | ---------------------- | ------------ | | Version | 8.0.1 | | Type | Bug | | TypeOfFailure | OtherFailure | | Priority | normal | | Resolution | Unresolved | | Component | Compiler | | Test case | | | Differential revisions | | | BlockedBy | | | Related | | | Blocking | | | CC | | | Operating system | | | Architecture | | </details> <!-- {"blocked_by":[],"summary":"hWaitForInput with socket as handle excepts on windows","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"If I create a socket wrapped in a Handle (either by directly creating a handle with connectTo, or by creating a socket and wrapping it), hWaitForInput and hReady always give an exception with that handle. It excepts directly when calling, it does not wait until the given timeout of hWaitForInput has expired.\r\n\r\nThe following code exposes the bug (requiring that a server-socket is listening on port 7892):\r\n{{{#!hs\r\nmodule SockDebug\r\nwhere\r\nimport System.IO\r\nimport Network\r\n\r\nmain = do\r\n sock <- connectTo \"localhost\" (Service $ show 7892)\r\n hWaitForInput sock 5000\r\n\r\n}}}\r\n\r\nExcepts with \"hWaitForInput: invalid argument (Invalid argument)\"\r\n\r\nHappens both on windows 10 and windows 7.\r\n\r\nThis is the same error as in ticket 1198 so I'd guess that the bug is in cbits/inputReady.c as well, but I'm not an expert.","type_of_failure":"OtherFailure","blocking":[]} -->
issue