Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-network for openSUSE:Factory checked in at 2026-11-17 17:17:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-network (Old) and /work/SRC/openSUSE:Factory/.ghc-network.new.1251 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-network" Tue Nov 17 17:17:12 2026 rev:37 rq:1397772 version:3.2.14.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-network/ghc-network.changes 2026-11-06 19:56:15.633870899 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-network.new.1251/ghc-network.changes 2026-11-17 17:19:06.915362644 +0100 @@ -1,0 +2,25 @@ +Sun Nov 15 10:59:39 UTC 2026 - Peter Simons <[email protected]> + +- Update network to version 3.2.14.0. + ## Version 3.2.14.0 + + * dontfrag for WINE + [#605](https://github.com/haskell/network/pull/605) + * Describe getaddrinfo errors on Windows with the Winsock table + [#640](https://github.com/haskell/network/pull/640) + * HsNetDef.h: use ccall for aarch64 too + [#651](https://github.com/haskell/network/pull/651) + +------------------------------------------------------------------- +Fri Nov 13 00:50:46 UTC 2026 - Peter Simons <[email protected]> + +- Update network to version 3.2.13.0. + ## Version 3.2.13.0 + + * Give Winsock errors the IOErrorType of their errno + [#632](https://github.com/haskell/network/pull/632) + * Regenerate configure, which 3.2.12.0 shipped stale, producing an invalid + network.buildinfo on Windows with GHC 9.14.2 + [#633](https://github.com/haskell/network/issues/633) + +------------------------------------------------------------------- Old: ---- network-3.2.12.0.tar.gz New: ---- network-3.2.14.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-network.spec ++++++ --- /var/tmp/diff_new_pack.D9rKTT/_old 2026-11-17 17:19:07.597391433 +0100 +++ /var/tmp/diff_new_pack.D9rKTT/_new 2026-11-17 17:19:07.599391517 +0100 @@ -20,7 +20,7 @@ %global pkgver %{pkg_name}-%{version} %bcond_with tests Name: ghc-%{pkg_name} -Version: 3.2.12.0 +Version: 3.2.14.0 Release: 0 Summary: Low-level networking interface License: BSD-3-Clause ++++++ network-3.2.12.0.tar.gz -> network-3.2.14.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/network-3.2.12.0/CHANGELOG.md new/network-3.2.14.0/CHANGELOG.md --- old/network-3.2.12.0/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 +++ new/network-3.2.14.0/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,22 @@ # CHANGELOG for network +## Version 3.2.14.0 + +* dontfrag for WINE + [#605](https://github.com/haskell/network/pull/605) +* Describe getaddrinfo errors on Windows with the Winsock table + [#640](https://github.com/haskell/network/pull/640) +* HsNetDef.h: use ccall for aarch64 too + [#651](https://github.com/haskell/network/pull/651) + +## Version 3.2.13.0 + +* Give Winsock errors the IOErrorType of their errno + [#632](https://github.com/haskell/network/pull/632) +* Regenerate configure, which 3.2.12.0 shipped stale, producing an invalid + network.buildinfo on Windows with GHC 9.14.2 + [#633](https://github.com/haskell/network/issues/633) + ## Version 3.2.12.0 * Add unsafeGracefulClose and recvMsgWith diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/network-3.2.12.0/Network/Socket/Cbits.hsc new/network-3.2.14.0/Network/Socket/Cbits.hsc --- old/network-3.2.12.0/Network/Socket/Cbits.hsc 2001-09-09 03:46:40.000000000 +0200 +++ new/network-3.2.14.0/Network/Socket/Cbits.hsc 2001-09-09 03:46:40.000000000 +0200 @@ -3,6 +3,9 @@ #include "HsNet.h" import Network.Socket.Imports +#if defined(mingw32_HOST_OS) +import GHC.IO.Exception (IOErrorType (..)) +#endif -- | This is the value of SOMAXCONN, typically 128. -- 128 is good enough for normal network servers but @@ -41,6 +44,51 @@ wsaEHOSTUNREACH = #const WSAEHOSTUNREACH wsaENOPROTOOPT :: CInt wsaENOPROTOOPT = #const WSAENOPROTOOPT +-- | The 'IOErrorType' which 'Foreign.C.Error.errnoToIOError' gives the +-- errno of the same name. WSAEINTR stays 'OtherError': on Windows it +-- is what closesocket gives a blocked call, not an interrupt. +winsockErrorType :: CInt -> IOErrorType +winsockErrorType rc = case rc of + #{const WSAEACCES} -> PermissionDenied + #{const WSAEADDRINUSE} -> ResourceBusy + #{const WSAEADDRNOTAVAIL} -> UnsupportedOperation + #{const WSAEAFNOSUPPORT} -> UnsupportedOperation + #{const WSAEALREADY} -> AlreadyExists + #{const WSAEBADF} -> InvalidArgument + #{const WSAECONNREFUSED} -> NoSuchThing + #{const WSAECONNRESET} -> ResourceVanished + #{const WSAEDESTADDRREQ} -> InvalidArgument + #{const WSAEDQUOT} -> PermissionDenied + #{const WSAEHOSTDOWN} -> NoSuchThing + #{const WSAEHOSTUNREACH} -> NoSuchThing + #{const WSAEINPROGRESS} -> AlreadyExists + #{const WSAEINVAL} -> InvalidArgument + #{const WSAEISCONN} -> AlreadyExists + #{const WSAELOOP} -> InvalidArgument + #{const WSAEMFILE} -> ResourceExhausted + #{const WSAEMSGSIZE} -> ResourceExhausted + #{const WSAENAMETOOLONG} -> InvalidArgument + #{const WSAENETDOWN} -> ResourceVanished + #{const WSAENETRESET} -> ResourceVanished + #{const WSAENETUNREACH} -> NoSuchThing + #{const WSAENOBUFS} -> ResourceExhausted + #{const WSAENOPROTOOPT} -> UnsupportedOperation + #{const WSAENOTCONN} -> InvalidArgument + #{const WSAENOTEMPTY} -> UnsatisfiedConstraints + #{const WSAENOTSOCK} -> InvalidArgument + #{const WSAEOPNOTSUPP} -> UnsupportedOperation + #{const WSAEPFNOSUPPORT} -> UnsupportedOperation + #{const WSAEPROCLIM} -> PermissionDenied + #{const WSAEPROTONOSUPPORT} -> ProtocolError + #{const WSAEPROTOTYPE} -> ProtocolError + #{const WSAEREMOTE} -> IllegalOperation + #{const WSAESHUTDOWN} -> IllegalOperation + #{const WSAESOCKTNOSUPPORT} -> UnsupportedOperation + #{const WSAESTALE} -> ResourceVanished + #{const WSAETIMEDOUT} -> TimeExpired + #{const WSAETOOMANYREFS} -> ResourceExhausted + #{const WSAEUSERS} -> ResourceExhausted + _ -> OtherError #else fGetFd :: CInt fGetFd = #const F_GETFD diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/network-3.2.12.0/Network/Socket/Info.hsc new/network-3.2.14.0/Network/Socket/Info.hsc --- old/network-3.2.12.0/Network/Socket/Info.hsc 2001-09-09 03:46:40.000000000 +0200 +++ new/network-3.2.14.0/Network/Socket/Info.hsc 2001-09-09 03:46:40.000000000 +0200 @@ -11,7 +11,11 @@ import qualified Data.List.NonEmpty as NE import Foreign.Marshal.Alloc (alloca, allocaBytes) import Foreign.Marshal.Utils (maybeWith, with) +#if defined(mingw32_HOST_OS) +import GHC.IO.Exception (IOErrorType(NoSuchThing), IOException(..)) +#else import GHC.IO.Exception (IOErrorType(NoSuchThing)) +#endif import System.IO.Error (ioeSetErrorString, mkIOError) import Network.Socket.Imports @@ -281,11 +285,7 @@ ais <- release (followAddrInfo ptr_addrs) `onException` c_freeaddrinfo ptr_addrs c_freeaddrinfo ptr_addrs return ais - else do - err <- gai_strerror ret - ioError $ ioeSetErrorString - (mkIOError NoSuchThing message Nothing Nothing) - err + else gaiError message ret message = concat [ "Network.Socket.getAddrInfo (called with preferred socket type/protocol: " , maybe "Nothing" show hints @@ -342,15 +342,31 @@ foreign import ccall safe "hsnet_freeaddrinfo" c_freeaddrinfo :: Ptr AddrInfo -> IO () -gai_strerror :: CInt -> IO String +-- | The error which getaddrinfo(3) or getnameinfo(3) reported as @rc@. +-- On Windows the code is a Winsock code, kept in 'ioe_errno' as for +-- other socket errors. +gaiError :: String -> CInt -> IO a +gaiError loc rc = do + err <- gai_strerror rc + let ioe = mkIOError NoSuchThing loc Nothing Nothing +#if defined(mingw32_HOST_OS) + ioError $ ioeSetErrorString ioe{ioe_errno = Just rc} err +#else + ioError $ ioeSetErrorString ioe err +#endif -#ifdef HAVE_GAI_STRERROR +gai_strerror :: CInt -> IO String +#if defined(mingw32_HOST_OS) +-- gai_strerror is a macro in mingw, which the configure check misses, +-- and it writes to a static buffer. +gai_strerror = winsockErrorString +#elif defined(HAVE_GAI_STRERROR) gai_strerror n = c_gai_strerror n >>= peekCString foreign import ccall safe "gai_strerror" c_gai_strerror :: CInt -> IO CString #else -gai_strerror n = ioError $ userError $ "Network.Socket.gai_strerror not supported: " ++ show n +gai_strerror n = return $ "error " ++ show n #endif ----------------------------------------------------------------------------- @@ -402,11 +418,7 @@ host <- peekIf doHost c_host serv <- peekIf doService c_serv return (host, serv) - else do - err <- gai_strerror ret - ioError $ ioeSetErrorString - (mkIOError NoSuchThing message Nothing Nothing) - err + else gaiError message ret message = concat [ "Network.Socket.getNameInfo (called with flags: " , show flags diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/network-3.2.12.0/Network/Socket/Internal.hs new/network-3.2.14.0/Network/Socket/Internal.hs --- old/network-3.2.12.0/Network/Socket/Internal.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/network-3.2.14.0/Network/Socket/Internal.hs 2001-09-09 03:46:40.000000000 +0200 @@ -27,6 +27,7 @@ , throwSocketErrorCode #if defined(mingw32_HOST_OS) , c_getLastError + , winsockErrorString #endif -- * Guards for socket operations that may fail @@ -61,9 +62,9 @@ import Control.Exception (evaluate) import System.IO.Unsafe (unsafePerformIO) # if __GLASGOW_HASKELL__ >= 707 -import GHC.IO.Exception (IOErrorType(..), IOException(..)) +import GHC.IO.Exception (IOException(..)) # else -import GHC.IOBase (IOErrorType(..), IOException(..)) +import GHC.IOBase (IOException(..)) # endif import System.IO.Error (ioeSetErrorString, mkIOError) #else @@ -94,14 +95,14 @@ -- | Like 'throwSocketError', but the error code is supplied as an argument. -- -- On Windows the code is a Winsock error code rather than an errno. It --- is kept in 'ioe_errno' all the same: Winsock reports every error as --- 'OtherError', so the code is the only thing which tells them apart. +-- is kept in 'ioe_errno' all the same, and the error type is the one +-- the errno of the same name has elsewhere. throwSocketErrorCode :: String -> CInt -> IO a #if defined(mingw32_HOST_OS) throwSocketErrorCode name rc = do - pstr <- c_getWSError rc - str <- peekCString pstr - let ioe = (mkIOError OtherError name Nothing Nothing){ioe_errno = Just rc} + str <- winsockErrorString rc + let typ = winsockErrorType rc + ioe = (mkIOError typ name Nothing Nothing){ioe_errno = Just rc} ioError (ioeSetErrorString ioe str) #else throwSocketErrorCode loc errno = @@ -230,6 +231,14 @@ foreign import ccall unsafe "getWSErrorDescr" c_getWSError :: CInt -> IO (Ptr CChar) + +-- | A description of a Winsock error code. +winsockErrorString :: CInt -> IO String +winsockErrorString rc = do + pstr <- c_getWSError rc + if pstr == nullPtr + then return $ "Unknown WinSock error: " ++ show rc + else peekCString pstr #endif -- --------------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/network-3.2.12.0/Network/Socket/Posix/HostName.hsc new/network-3.2.14.0/Network/Socket/Posix/HostName.hsc --- old/network-3.2.12.0/Network/Socket/Posix/HostName.hsc 2001-09-09 03:46:40.000000000 +0200 +++ new/network-3.2.14.0/Network/Socket/Posix/HostName.hsc 2001-09-09 03:46:40.000000000 +0200 @@ -16,7 +16,7 @@ -- | Get name of current host -- --- Since: 3.3.0.0 +-- @since 3.2.10.0 getHostName :: IO HostName getHostName = allocaArray0 size $ \cstr -> do throwErrnoIfMinus1_ "getHostName" $ gethostname cstr (fromIntegral size) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/network-3.2.12.0/Network/Socket/Syscall.hs new/network-3.2.14.0/Network/Socket/Syscall.hs --- old/network-3.2.12.0/Network/Socket/Syscall.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/network-3.2.14.0/Network/Socket/Syscall.hs 2001-09-09 03:46:40.000000000 +0200 @@ -7,9 +7,7 @@ import Data.Either (isRight) import Foreign.Marshal.Utils (with) import qualified Control.Exception as E -# if defined(mingw32_HOST_OS) import System.IO.Error (catchIOError) -#endif #if defined(mingw32_HOST_OS) import Control.Exception (bracket) @@ -127,7 +125,7 @@ setDontFragment s = when (family == AF_INET) $ #if HAVE_DECL_IP_DONTFRAG || HAVE_DECL_IP_MTU_DISCOVER - setSocketOption s DontFragment 1 + setSocketOption s DontFragment 1 `catchIOError` \_ -> return () #else -- do nothing return () diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/network-3.2.12.0/Network/Socket/Wait.hs new/network-3.2.14.0/Network/Socket/Wait.hs --- old/network-3.2.12.0/Network/Socket/Wait.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/network-3.2.14.0/Network/Socket/Wait.hs 2001-09-09 03:46:40.000000000 +0200 @@ -363,8 +363,9 @@ -- earlier send of its own came back as an ICMP port unreachable. -- -- POSIX gives it as @ECONNREFUSED@ and Winsock as @WSAECONNRESET@, so --- the error type differs (@NoSuchThing@ and @OtherError@); this reads --- the code instead. Only a connected socket hears it on any platform. +-- the error type differs (@NoSuchThing@ and @ResourceVanished@); this +-- reads the code instead. Only a connected socket hears it on any +-- platform. -- -- @since 3.2.12.0 isPortUnreachableError :: E.IOException -> Bool diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/network-3.2.12.0/Network/Socket/Win32/HostName.hsc new/network-3.2.14.0/Network/Socket/Win32/HostName.hsc --- old/network-3.2.12.0/Network/Socket/Win32/HostName.hsc 2001-09-09 03:46:40.000000000 +0200 +++ new/network-3.2.14.0/Network/Socket/Win32/HostName.hsc 2001-09-09 03:46:40.000000000 +0200 @@ -25,7 +25,7 @@ -- | Get name of current host -- --- Since: 3.3.0.0 +-- @since 3.2.10.0 getHostName :: IO HostName getHostName = with 0 $ \p_charcount -> do -- On the first run, determine the character count and ignore any error we get diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/network-3.2.12.0/cbits/winSockErr.c new/network-3.2.14.0/cbits/winSockErr.c --- old/network-3.2.12.0/cbits/winSockErr.c 2001-09-09 03:46:40.000000000 +0200 +++ new/network-3.2.14.0/cbits/winSockErr.c 2001-09-09 03:46:40.000000000 +0200 @@ -2,15 +2,14 @@ #include "HsFFI.h" #if defined(_WIN32) -#include <stdio.h> /* to the end */ +/* NULL for a code not in the table, which the caller describes itself: + formatting it here would need a static buffer, shared between threads. */ const char* getWSErrorDescr(int err) { - static char otherErrMsg[256]; - switch (err) { case WSAEINTR: return "Interrupted function call (WSAEINTR)"; case WSAEBADF: return "bad socket descriptor (WSAEBADF)"; @@ -67,8 +66,7 @@ case WSANO_RECOVERY: return "This is a nonrecoverable error (WSANO_RECOVERY)"; case WSANO_DATA: return "Valid name, no data record of requested type (WSANO_DATA)"; default: - sprintf(otherErrMsg, "Unknown WinSock error: %u", err); - return otherErrMsg; + return NULL; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/network-3.2.12.0/configure new/network-3.2.14.0/configure --- old/network-3.2.12.0/configure 2001-09-09 03:46:40.000000000 +0200 +++ new/network-3.2.14.0/configure 2001-09-09 03:46:40.000000000 +0200 @@ -685,8 +685,6 @@ ac_user_opts=' enable_option_checking with_cc -with_compiler -with_hc ' ac_precious_vars='build_alias host_alias @@ -1318,7 +1316,6 @@ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) C compiler -Haskell compiler Some influential environment variables: CC C compiler command @@ -3930,25 +3927,6 @@ -# Check whether --with-compiler was given. -if test ${with_compiler+y} -then : - withval=$with_compiler; HC=$withval -fi - - -# Check whether --with-hc was given. -if test ${with_hc+y} -then : - withval=$with_hc; HC=$withval -fi - -if test -z "$HC" -then : - HC=ghc -fi - - { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 printf %s "checking for an ANSI C-conforming const... " >&6; } if test ${ac_cv_c_const+y} @@ -4450,45 +4428,6 @@ printf '%s\n' "$as_me: creating ./network.buildinfo" >&6;} echo "install-includes: HsNetworkConfig.h" > network.buildinfo -WINIO_GHC_OPTIONS= -{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking whether to use native Windows I/O manager RTS option" >&5 -printf %s "checking whether to use native Windows I/O manager RTS option... " >&6; } -case "$host_os" in -mingw*) - cat > conftest_ghc_cpp.hs <<EOF -#if !defined(__IO_MANAGER_WINIO__) || __IO_MANAGER_WINIO__ < 2 -#error __IO_MANAGER_WINIO__ < 2 -#endif -module Main where -main :: IO () -main = return () -EOF - if "$HC" -c -cpp -fforce-recomp conftest_ghc_cpp.hs >/dev/null 2>&1; then - { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf '%s\n' "yes" >&6; } - WINIO_GHC_OPTIONS="-with-rtsopts=--io-manager=native" - else - { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no, $HC does not define __IO_MANAGER_WINIO__ >= 2" >&5 -printf '%s\n' "no, $HC does not define __IO_MANAGER_WINIO__ >= 2" >&6; } - fi - rm -f conftest_ghc_cpp.hi conftest_ghc_cpp.hs conftest_ghc_cpp.o - ;; -*) - { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no, not Windows" >&5 -printf '%s\n' "no, not Windows" >&6; } - ;; -esac - -if test -n "$WINIO_GHC_OPTIONS" -then : - cat >> network.buildinfo <<EOF - -test-suite spec - ghc-options: $WINIO_GHC_OPTIONS -EOF - -fi - cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/network-3.2.12.0/include/HsNetDef.h new/network-3.2.14.0/include/HsNetDef.h --- old/network-3.2.12.0/include/HsNetDef.h 2001-09-09 03:46:40.000000000 +0200 +++ new/network-3.2.14.0/include/HsNetDef.h 2001-09-09 03:46:40.000000000 +0200 @@ -32,7 +32,7 @@ #if defined(mingw32_HOST_OS) # if defined(i386_HOST_ARCH) # define CALLCONV stdcall -# elif defined(x86_64_HOST_ARCH) +# elif defined(x86_64_HOST_ARCH) || defined(aarch64_HOST_ARCH) # define CALLCONV ccall # else # error Unknown mingw32 arch diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/network-3.2.12.0/network.cabal new/network-3.2.14.0/network.cabal --- old/network-3.2.12.0/network.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/network-3.2.14.0/network.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,6 +1,6 @@ cabal-version: 1.18 name: network -version: 3.2.12.0 +version: 3.2.14.0 license: BSD3 license-file: LICENSE maintainer: Kazu Yamamoto, Tamar Christina diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/network-3.2.12.0/tests/Network/SocketSpec.hs new/network-3.2.14.0/tests/Network/SocketSpec.hs --- old/network-3.2.12.0/tests/Network/SocketSpec.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/network-3.2.14.0/tests/Network/SocketSpec.hs 2001-09-09 03:46:40.000000000 +0200 @@ -19,7 +19,8 @@ import Network.Socket.ByteString import Network.Test.Common import System.Mem (performGC) -import System.IO.Error (tryIOError) +import GHC.IO.Exception (IOErrorType (NoSuchThing, ResourceVanished)) +import System.IO.Error (ioeGetErrorString, ioeGetErrorType, tryIOError) import System.IO.Temp (withSystemTempDirectory) import System.Posix.Types (Fd(..)) import Foreign.C.Types () @@ -213,6 +214,16 @@ getAddrInfo (Just hints) (Just "127.128.129.130") Nothing hostAddressToTuple hostAddr `shouldBe` (0x7f, 0x80, 0x81, 0x82) + -- On Windows this used to be a userError which lost the reason (#636). + it "throws NoSuchThing with a description for a name it cannot resolve" $ do + let hints = defaultHints { addrFlags = [AI_NUMERICHOST] } + r <- tryIOError $ getAddrInfo (Just hints) (Just "no-such-host.invalid") Nothing + case r :: Either IOError [AddrInfo] of + Left e -> do + ioeGetErrorType e `shouldBe` NoSuchThing + ioeGetErrorString e `shouldNotContain` "not supported" + Right _ -> expectationFailure "resolved a name which is not numeric" + it "works for IPv6 address" $ do let hints = defaultHints { addrFlags = [AI_NUMERICHOST, AI_ADDRCONFIG] } host = "2001:0db8:85a3:0000:0000:8a2e:0370:7334" @@ -378,6 +389,21 @@ it "is heard by a connected one through recvMsg" $ bounceWith recvMsg' connectSend `shouldThrow` isPortUnreachableError + describe "a connection the peer resets" $ do + it "is reported as ResourceVanished" $ do + -- The byte makes the reset follow the connect: an RST which + -- beat it would fail the connect itself on Linux. + let server sock = do + void $ recv sock 1 + setSockOpt sock Linger (StructLinger 1 0) + -- Plain recv on Windows reads through GHC's IO manager, + -- which does not go by the Winsock code. + client sock = do + sendAll sock "x" + recvWith sock 1024 retry `shouldThrow` isVanished + isVanished e = ioeGetErrorType e == ResourceVanished + tcpTest client server + describe "gracefulClose" $ do it "does not send TCP RST back" $ do let server sock = do
