[GHC] #12012: Socket operations on Windows check errno instead of calling WSAGetLastError()
#12012: Socket operations on Windows check errno instead of calling WSAGetLastError() -------------------------------------+------------------------------------- Reporter: enolan | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Core | Version: Libraries | Keywords: | Operating System: Windows Architecture: | Type of failure: Incorrect result Unknown/Multiple | at runtime Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Winsock doesn't set errno, but it is checked in `blockingReadRawBufferPtr` and `blockingWriteRawBufferPtr` (both are in `GHC.IO.FD`). I the same thing happens in the non threaded RTS too, but that's in terms of primops and I don't understand it very well. The upshot here is that every error message originating from Winsock is wrong. Nobody noticed since any error used to just crash your program (#12010). Here's some MinGW documentation http://oldwiki.mingw.org/index.php/sockets and something from MSDN https://msdn.microsoft.com/en- us/library/windows/desktop/ms740121%28v=vs.85%29.aspx -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12012> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12012: Socket operations on Windows check errno instead of calling WSAGetLastError() -------------------------------------+------------------------------------- Reporter: enolan | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: Core Libraries | Version: Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2170 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * status: new => patch * differential: => Phab:D2170 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12012#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12012: Socket operations on Windows check errno instead of calling WSAGetLastError() -------------------------------------+------------------------------------- Reporter: enolan | Owner: enolan Type: bug | Status: patch Priority: normal | Milestone: Component: Core Libraries | Version: Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2170 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * owner: => enolan -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12012#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12012: Socket operations on Windows check errno instead of calling WSAGetLastError() -------------------------------------+------------------------------------- Reporter: enolan | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Core Libraries | Version: Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * owner: enolan => * status: patch => new * differential: Phab:D2170 => -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12012#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12012: Socket operations on Windows check errno instead of calling WSAGetLastError() -------------------------------------+------------------------------------- Reporter: enolan | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Core Libraries | Version: Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): Whoops, sorry, confused this with #12010 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12012#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12012: Socket operations on Windows check errno instead of calling WSAGetLastError() -------------------------------------+------------------------------------- Reporter: enolan | Owner: Azel Type: bug | Status: new Priority: normal | Milestone: Component: Core Libraries | Version: Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Azel): * owner: (none) => Azel Comment: I'm willing to have a go at this issue, is anyone already working on it? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12012#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12012: Socket operations on Windows check errno instead of calling WSAGetLastError() -------------------------------------+------------------------------------- Reporter: enolan | Owner: Azel Type: bug | Status: patch Priority: normal | Milestone: Component: Core Libraries | Version: Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4639 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Azel): * status: new => patch * differential: => Phab:D4639 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12012#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12012: Socket operations on Windows check errno instead of calling WSAGetLastError() -------------------------------------+------------------------------------- Reporter: enolan | Owner: Azel Type: bug | Status: patch Priority: normal | Milestone: Component: Core Libraries | Version: Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4639 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"01b15b88639443bec12415b6b0d906261bd6c047/ghc" 01b15b88/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="01b15b88639443bec12415b6b0d906261bd6c047" Calling GetLastError() on Windows for socket IO (trac issue #12012) For the threaded RTS, putting a private copy of the throwErrno series in GHC.IO.FD which gets if the operation was on a socket, so that we can call c_maperrno if need be. For the non-threaded RTS, if memory serves we call GetLastError() in case of an error on socket IO. However, we don't do the translation ErrCode ↔ Errno currently (and besides, it's a primop) so we do it if needed through c_maperrno_func in the asynchronous read/write functions. Signed-off-by: ARJANEN Loïc Jean David <arjanen.loic@gmail.com> Reviewers: ekmett, hvr, bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #12012 Differential Revision: https://phabricator.haskell.org/D4639 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12012#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12012: Socket operations on Windows check errno instead of calling WSAGetLastError() -------------------------------------+------------------------------------- Reporter: enolan | Owner: Azel Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: Resolution: fixed | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4639 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: => 8.6.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12012#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC