Hello community, here is the log from the commit of package ghc-network for openSUSE:Factory checked in at 2014-11-26 20:54:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-network (Old) and /work/SRC/openSUSE:Factory/.ghc-network.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-network" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-network/ghc-network.changes 2014-08-25 11:05:57.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-network.new/ghc-network.changes 2014-11-26 20:54:55.000000000 +0100 @@ -1,0 +2,12 @@ +Fri Sep 12 06:31:03 UTC 2014 - peter.trommler@ohm-hochschule.de + +- update to 2.4.2.3 +* no changelog +* Haskell Platform 2014.2.0.0 + +------------------------------------------------------------------- +Tue Sep 2 09:37:14 UTC 2014 - peter.trommler@ohm-hochschule.de + +- regenerate spec file + +------------------------------------------------------------------- Old: ---- network-2.4.1.2.tar.gz New: ---- network-2.4.2.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-network.spec ++++++ --- /var/tmp/diff_new_pack.gy7MAj/_old 2014-11-26 20:54:56.000000000 +0100 +++ /var/tmp/diff_new_pack.gy7MAj/_new 2014-11-26 20:54:56.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-network # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,41 +18,41 @@ %global pkg_name network -%global common_summary Haskell Low-level networking interface library - -%global common_description A low-level networking interface library for Haskell. - Name: ghc-network -Version: 2.4.1.2 +Version: 2.4.2.3 Release: 0 -Summary: %{common_summary} +Summary: Low-level networking interface License: BSD-3-Clause Group: System/Libraries -BuildRoot: %{_tmppath}/%{name}-%{version}-build -# BEGIN cabal2spec Url: http://hackage.haskell.org/package/%{pkg_name} Source0: http://hackage.haskell.org/packages/archive/%{pkg_name}/%{version}/%{pkg_name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-build + BuildRequires: ghc-Cabal-devel +BuildRequires: ghc-rpm-macros +# Begin cabal-rpm deps: BuildRequires: ghc-bytestring-devel BuildRequires: ghc-parsec-devel -BuildRequires: ghc-rpm-macros -# END cabal2spec +BuildRequires: ghc-unix-devel +# End cabal-rpm deps %description -%{common_description} +Low-level networking interface for Haskell. + %package devel Summary: Haskell %{pkg_name} library development files -Group: Development/Languages/Other -Requires: ghc-compiler -Requires(post): ghc-compiler -Requires(postun): ghc-compiler +Group: Development/Libraries/Other +Provides: %{name}-static = %{version}-%{release} +Requires: ghc-compiler = %{ghc_version} +Requires(post): ghc-compiler = %{ghc_version} +Requires(postun): ghc-compiler = %{ghc_version} Requires: %{name} = %{version}-%{release} %description devel -%{common_description} -This package contains the development files. +This package provides the Haskell %{pkg_name} library development files. + %prep %setup -q -n %{pkg_name}-%{version} @@ -75,5 +75,6 @@ %files devel -f %{name}-devel.files %defattr(-,root,root,-) +%doc examples README %changelog ++++++ network-2.4.1.2.tar.gz -> network-2.4.2.3.tar.gz ++++++ ++++ 2885 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/Network/BSD.hsc new/network-2.4.2.3/Network/BSD.hsc --- old/network-2.4.1.2/Network/BSD.hsc 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/Network/BSD.hsc 2014-04-18 09:16:03.000000000 +0200 @@ -4,7 +4,7 @@ -- Module : Network.BSD -- Copyright : (c) The University of Glasgow 2001 -- License : BSD-style (see the file libraries/network/LICENSE) --- +-- -- Maintainer : libraries@haskell.org -- Stability : experimental -- Portability : non-portable @@ -16,9 +16,6 @@ #include "HsNet.h" --- NOTE: ##, we want this interpreted when compiling the .hs, not by hsc2hs. -##include "Typeable.h" - module Network.BSD ( -- * Host names @@ -141,7 +138,7 @@ -- close the database a call to endServiceEntry is required. This -- database file is usually stored in the file /etc/services. -data ServiceEntry = +data ServiceEntry = ServiceEntry { serviceName :: ServiceName, -- Official Name serviceAliases :: [ServiceName], -- aliases @@ -187,7 +184,7 @@ $ (trySysCall (c_getservbyname cstr_name cstr_proto))
= peek
-foreign import CALLCONV unsafe "getservbyname" +foreign import CALLCONV unsafe "getservbyname" c_getservbyname :: CString -> CString -> IO (Ptr ServiceEntry) -- | Get the service given a 'PortNumber' and 'ProtocolName'. @@ -198,7 +195,7 @@ $ (trySysCall (c_getservbyport (fromIntegral port) cstr_proto))
= peek
-foreign import CALLCONV unsafe "getservbyport" +foreign import CALLCONV unsafe "getservbyport" c_getservbyport :: CInt -> CString -> IO (Ptr ServiceEntry) -- | Get the 'PortNumber' corresponding to the 'ServiceName'. @@ -242,9 +239,9 @@ -- As for setServiceEntry above, calling setProtocolEntry. -- determines whether or not the protocol database file, usually -- @/etc/protocols@, is to be kept open between calls of --- getProtocolEntry. Similarly, +-- getProtocolEntry. Similarly, -data ProtocolEntry = +data ProtocolEntry = ProtocolEntry { protoName :: ProtocolName, -- Official Name protoAliases :: [ProtocolName], -- aliases @@ -264,12 +261,12 @@ -- With WinSock, the protocol number is only a short; -- hoist it in as such, but represent it on the Haskell side -- as a CInt. - p_proto_short <- (#peek struct protoent, p_proto) p + p_proto_short <- (#peek struct protoent, p_proto) p let p_proto = fromIntegral (p_proto_short :: CShort) #else - p_proto <- (#peek struct protoent, p_proto) p + p_proto <- (#peek struct protoent, p_proto) p #endif - return (ProtocolEntry { + return (ProtocolEntry { protoName = p_name, protoAliases = p_aliases, protoNumber = p_proto @@ -284,7 +281,7 @@ $ (trySysCall.c_getprotobyname) name_cstr
= peek
-foreign import CALLCONV unsafe "getprotobyname" +foreign import CALLCONV unsafe "getprotobyname" c_getprotobyname :: CString -> IO (Ptr ProtocolEntry) @@ -331,7 +328,7 @@ -- --------------------------------------------------------------------------- -- Host lookups -data HostEntry = +data HostEntry = HostEntry { hostName :: HostName, -- Official Name hostAliases :: [HostName], -- aliases @@ -385,7 +382,7 @@ $ trySysCall $ c_gethostbyname name_cstr peek ent -foreign import CALLCONV safe "gethostbyname" +foreign import CALLCONV safe "gethostbyname" c_gethostbyname :: CString -> IO (Ptr HostEntry) @@ -460,7 +457,7 @@ return (NetworkEntry { networkName = n_name, networkAliases = n_aliases, - networkFamily = unpackFamily (fromIntegral + networkFamily = unpackFamily (fromIntegral (n_addrtype :: CInt)), networkAddress = n_net }) @@ -476,7 +473,7 @@ $ trySysCall $ c_getnetbyname name_cstr
= peek
-foreign import ccall unsafe "getnetbyname" +foreign import ccall unsafe "getnetbyname" c_getnetbyname :: CString -> IO (Ptr NetworkEntry) getNetworkByAddr :: NetworkAddr -> Family -> IO NetworkEntry @@ -485,7 +482,7 @@ $ trySysCall $ c_getnetbyaddr addr (packFamily family)
= peek
-foreign import ccall unsafe "getnetbyaddr" +foreign import ccall unsafe "getnetbyaddr" c_getnetbyaddr :: NetworkAddr -> CInt -> IO (Ptr NetworkEntry) getNetworkEntry :: IO NetworkEntry @@ -539,7 +536,7 @@ throwSocketErrorIfMinus1_ "getHostName" $ c_gethostname cstr (fromIntegral size) peekCString cstr -foreign import CALLCONV unsafe "gethostname" +foreign import CALLCONV unsafe "gethostname" c_gethostname :: CString -> CSize -> IO CInt -- Helper function used by the exported functions that provides a diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/Network/Socket/ByteString/IOVec.hsc new/network-2.4.2.3/Network/Socket/ByteString/IOVec.hsc --- old/network-2.4.1.2/Network/Socket/ByteString/IOVec.hsc 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/Network/Socket/ByteString/IOVec.hsc 2014-04-18 09:16:03.000000000 +0200 @@ -9,6 +9,7 @@ import Foreign.Ptr (Ptr) import Foreign.Storable (Storable(..)) +#include <sys/types.h> #include <sys/uio.h> data IOVec = IOVec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/Network/Socket/ByteString.hsc new/network-2.4.2.3/Network/Socket/ByteString.hsc --- old/network-2.4.1.2/Network/Socket/ByteString.hsc 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/Network/Socket/ByteString.hsc 2014-04-18 09:16:03.000000000 +0200 @@ -23,7 +23,7 @@ -- > import Network.Socket.ByteString -- module Network.Socket.ByteString - ( + ( -- * Send data to a socket send , sendAll diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/Network/Socket/Types.hsc new/network-2.4.2.3/Network/Socket/Types.hsc --- old/network-2.4.1.2/Network/Socket/Types.hsc 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/Network/Socket/Types.hsc 2014-04-18 09:16:03.000000000 +0200 @@ -1,6 +1,9 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ForeignFunctionInterface #-} + +#include "HsNet.h" + module Network.Socket.Types ( -- * Socket @@ -50,8 +53,6 @@ , zeroMemory ) where -#include "HsNet.h" - import Control.Concurrent.MVar import Control.Monad import Data.Bits @@ -89,14 +90,19 @@ type ProtocolNumber = CInt +-- | The status of the socket as /determined by this library/, not +-- necessarily reflecting the state of the connection itself. +-- +-- For example, the 'Closed' status is applied when the 'close' +-- function is called. data SocketStatus -- Returned Status Function called - = NotConnected -- socket - | Bound -- bind - | Listening -- listen - | Connected -- connect/accept - | ConvertedToHandle -- is now a Handle, don't touch - | Closed -- close + = NotConnected -- ^ Newly created, unconnected socket + | Bound -- ^ Bound, via 'bind' + | Listening -- ^ Listening, via 'listen' + | Connected -- ^ Connected or accepted, via 'connect' or 'accept' + | ConvertedToHandle -- ^ Is now a 'Handle' (via 'socketToHandle'), don't touch + | Closed -- ^ Closed was closed by 'close' deriving (Eq, Show, Typeable) ----------------------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/Network/Socket.hsc new/network-2.4.2.3/Network/Socket.hsc --- old/network-2.4.1.2/Network/Socket.hsc 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/Network/Socket.hsc 2014-04-18 09:16:03.000000000 +0200 @@ -22,9 +22,6 @@ #include "HsNet.h" --- NOTE: ##, we want this interpreted when compiling the .hs, not by hsc2hs. -##include "Typeable.h" - -- In order to process this file, you need to have CALLCONV defined. module Network.Socket @@ -82,9 +79,12 @@ , getPeerName , getSocketName -#ifdef HAVE_STRUCT_UCRED +#if defined(HAVE_STRUCT_UCRED) || defined(HAVE_GETPEEREID) -- get the credentials of our domain socket peer. , getPeerCred +#if defined(HAVE_GETPEEREID) + , getPeerEid +#endif #endif , socketPort @@ -179,7 +179,7 @@ import Foreign.Ptr (Ptr, castPtr, nullPtr) import Foreign.Storable (Storable(..)) import Foreign.C.Error -import Foreign.C.String (CString, withCString, peekCString, peekCStringLen) +import Foreign.C.String (CString, withCString, withCStringLen, peekCString, peekCStringLen) import Foreign.C.Types (CUInt, CChar) #if __GLASGOW_HASKELL__ >= 703 import Foreign.C.Types (CInt(..), CSize(..)) @@ -510,17 +510,16 @@ return new_sock #else with (fromIntegral sz) $ \ ptr_len -> do - new_sock <- # ifdef HAVE_ACCEPT4 - throwSocketErrorIfMinus1RetryMayBlock "accept" + new_sock <- throwSocketErrorIfMinus1RetryMayBlock "accept" (threadWaitRead (fromIntegral s)) (c_accept4 s sockaddr ptr_len (#const SOCK_NONBLOCK)) # else - throwSocketErrorWaitRead sock "accept" + new_sock <- throwSocketErrorWaitRead sock "accept" (c_accept s sockaddr ptr_len) + setNonBlockIfNeeded new_sock # endif /* HAVE_ACCEPT4 */ #endif - setNonBlockIfNeeded new_sock addr <- peekSockAddr sockaddr new_status <- newMVar Connected return ((MkSocket new_sock family stype protocol new_status), addr) @@ -562,8 +561,8 @@ -> SockAddr -> IO Int -- Number of Bytes sent sendTo sock xs addr = do - withCString xs $ \str -> do - sendBufTo sock str (length xs) addr + withCStringLen xs $ \(str, len) -> do + sendBufTo sock str len addr -- | Send data to the socket. The recipient can be specified -- explicitly, so the socket need not be in a connected state. @@ -638,8 +637,7 @@ -> String -- Data to send -> IO Int -- Number of Bytes sent send sock@(MkSocket s _family _stype _protocol _status) xs = do - let len = length xs - withCString xs $ \str -> do + withCStringLen xs $ \(str, len) -> do liftM fromIntegral $ #if defined(mingw32_HOST_OS) # if __GLASGOW_HASKELL__ >= 611 @@ -922,12 +920,12 @@ Just UseLoopBack -> Just ((#const SOL_SOCKET), (#const SO_USELOOPBACK)) #endif #endif // SOL_SOCKET -#ifdef IPPROTO_IP +#if HAVE_DECL_IPPROTO_IP #ifdef IP_TTL Just TimeToLive -> Just ((#const IPPROTO_IP), (#const IP_TTL)) #endif -#endif // IPPROTO_IP -#ifdef IPPROTO_TCP +#endif // HAVE_DECL_IPPROTO_IP +#if HAVE_DECL_IPPROTO_TCP #ifdef TCP_MAXSEG Just MaxSegment -> Just ((#const IPPROTO_TCP), (#const TCP_MAXSEG)) #endif @@ -937,12 +935,12 @@ #ifdef TCP_CORK Just Cork -> Just ((#const IPPROTO_TCP), (#const TCP_CORK)) #endif -#endif // IPPROTO_TCP -#ifdef IPPROTO_IPV6 +#endif // HAVE_DECL_IPPROTO_TCP +#if HAVE_DECL_IPPROTO_IPV6 #if HAVE_DECL_IPV6_V6ONLY Just IPv6Only -> Just ((#const IPPROTO_IPV6), (#const IPV6_V6ONLY)) #endif -#endif // IPPROTO_IPV6 +#endif // HAVE_DECL_IPPROTO_IPV6 _ -> Nothing -- | Return the option level and option value if they exist, @@ -983,12 +981,15 @@ fromIntegral `liftM` peek ptr_v -#ifdef HAVE_STRUCT_UCRED +#if defined(HAVE_STRUCT_UCRED) || defined(HAVE_GETPEEREID) -- | Returns the processID, userID and groupID of the socket's peer. -- --- Only available on platforms that support SO_PEERCRED on domain sockets. +-- Only available on platforms that support SO_PEERCRED or GETPEEREID(3) +-- on domain sockets. +-- GETPEEREID(3) returns userID and groupID. processID is always 0. getPeerCred :: Socket -> IO (CUInt, CUInt, CUInt) getPeerCred sock = do +#ifdef HAVE_STRUCT_UCRED let fd = fdSocket sock let sz = (fromIntegral (#const sizeof(struct ucred))) with sz $ \ ptr_cr -> @@ -1000,6 +1001,25 @@ uid <- (#peek struct ucred, uid) ptr_cr gid <- (#peek struct ucred, gid) ptr_cr return (pid, uid, gid) +#else + (uid,gid) <- getPeerEid sock + return (0,uid,gid) +#endif + +#ifdef HAVE_GETPEEREID +-- | The getpeereid() function returns the effective user and group IDs of the +-- peer connected to a UNIX-domain socket +getPeerEid :: Socket -> IO (CUInt, CUInt) +getPeerEid sock = do + let fd = fdSocket sock + alloca $ \ ptr_uid -> + alloca $ \ ptr_gid -> do + throwSocketErrorIfMinus1Retry "getPeerEid" $ + c_getpeereid fd ptr_uid ptr_gid + uid <- peek ptr_uid + gid <- peek ptr_gid + return (uid, gid) +#endif #endif ##if !(MIN_VERSION_base(4,3,1)) @@ -1105,6 +1125,10 @@ -- ----------------------------------------------------------------------------- +-- | Determines whether 'close' has been used on the 'Socket'. This +-- does /not/ indicate any status about the socket beyond this. If the +-- socket has been closed remotely, this function can still return +-- 'True'. isConnected :: Socket -> IO Bool isConnected (MkSocket _ _ _ _ status) = do value <- readMVar status @@ -1634,6 +1658,10 @@ foreign import CALLCONV unsafe "setsockopt" c_setsockopt :: CInt -> CInt -> CInt -> Ptr CInt -> CInt -> IO CInt +#if defined(HAVE_GETPEEREID) +foreign import CALLCONV unsafe "getpeereid" + c_getpeereid :: CInt -> Ptr CUInt -> Ptr CUInt -> IO CInt +#endif -- --------------------------------------------------------------------------- -- * Deprecated aliases diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/Network/URI.hs new/network-2.4.2.3/Network/URI.hs --- old/network-2.4.1.2/Network/URI.hs 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/Network/URI.hs 2014-04-18 09:16:03.000000000 +0200 @@ -64,13 +64,13 @@ URI(..) , URIAuth(..) , nullURI - + -- * Parsing , parseURI , parseURIReference , parseRelativeReference , parseAbsoluteURI - + -- * Test for strings containing various kinds of URI , isURI , isURIReference @@ -78,16 +78,16 @@ , isAbsoluteURI , isIPv6address , isIPv4address - + -- * Predicates , uriIsAbsolute , uriIsRelative - + -- * Relative URIs , relativeTo , nonStrictRelativeTo , relativeFrom - + -- * Operations on URI strings -- | Support for putting strings into URI-friendly -- escaped format and getting them back again. @@ -103,12 +103,12 @@ , escapeURIChar , escapeURIString , unEscapeString - + -- * URI Normalization functions , normalizeCase , normalizeEscape , normalizePathSegments - + -- * Deprecated functions , parseabsoluteURI , escapeString diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/Network.hs new/network-2.4.2.3/Network.hs --- old/network-2.4.1.2/Network.hs 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/Network.hs 2014-04-18 09:16:03.000000000 +0200 @@ -4,7 +4,7 @@ -- Module : Network -- Copyright : (c) The University of Glasgow 2001 -- License : BSD-style (see the file libraries/network/LICENSE) --- +-- -- Maintainer : libraries@haskell.org -- Stability : provisional -- Portability : portable @@ -32,7 +32,7 @@ -- * Initialisation , withSocketsDo - + -- * Server-side connections , listenOn , accept @@ -63,7 +63,8 @@ import Control.Monad (liftM) import Data.Maybe (fromJust) import Network.BSD -import Network.Socket hiding (accept, socketPort, recvFrom, sendTo, PortNumber) +import Network.Socket hiding (accept, socketPort, recvFrom, + sendTo, PortNumber, sClose) import qualified Network.Socket as Socket (accept) import System.IO import Prelude @@ -77,7 +78,7 @@ -- raised. Alternatively an empty string may be given to @connectTo@ -- signalling that the current hostname applies. -data PortID = +data PortID = Service String -- Service Name eg "ftp" | PortNumber PortNumber -- User defined Port Number #if !defined(mingw32_HOST_OS) && !defined(cygwin32_HOST_OS) && !defined(_WIN32) @@ -88,7 +89,7 @@ -- | Calling 'connectTo' creates a client side socket which is -- connected to the given host and port. The Protocol and socket type is -- derived from the given port identifier. If a port number is given --- then the result is always an internet family 'Stream' socket. +-- then the result is always an internet family 'Stream' socket. connectTo :: HostName -- Hostname -> PortID -- Port Identifier @@ -267,14 +268,14 @@ accept :: Socket -- ^ Listening Socket -> IO (Handle, HostName, - PortNumber) -- ^ Triple of: read\/write 'Handle' for + PortNumber) -- ^ Triple of: read\/write 'Handle' for -- communicating with the client, -- the 'HostName' of the peer socket, and -- the 'PortNumber' of the remote connection. accept sock@(MkSocket _ AF_INET _ _ _) = do ~(sock', (SockAddrInet port haddr)) <- Socket.accept sock peer <- catchIO - (do + (do (HostEntry peer _ _ _) <- getHostByAddr AF_INET haddr return peer ) @@ -308,6 +309,13 @@ accept (MkSocket _ family _ _ _) = error $ "Sorry, address family " ++ (show family) ++ " is not supported!" + +-- | Close the socket. All future operations on the socket object will fail. +-- The remote end will receive no more data (after queued data is flushed). +sClose :: Socket -> IO () +sClose = close -- Explicit redefinition because Network.sClose is deperecated, + -- hence the re-export would also be marked as such. + -- ----------------------------------------------------------------------------- -- sendTo/recvFrom @@ -361,7 +369,7 @@ ip <- getHostByName host let ipHs = hostAddresses ip s <- listenOn port - let + let waiting = do ~(s', SockAddrInet _ haddr) <- Socket.accept s he <- getHostByAddr AF_INET haddr @@ -400,7 +408,7 @@ -- --------------------------------------------------------------------------- -- Utils --- Like bracket, but only performs the final action if there was an +-- Like bracket, but only performs the final action if there was an -- exception raised by the middle bit. bracketOnError :: IO a -- ^ computation to run first (\"acquire resource\") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/configure.ac new/network-2.4.2.3/configure.ac --- old/network-2.4.1.2/configure.ac 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/configure.ac 2014-04-18 09:16:03.000000000 +0200 @@ -17,9 +17,6 @@ # include <ws2tcpip.h> // fix for MingW not defining IPV6_V6ONLY # define IPV6_V6ONLY 27 -#endif -#ifdef HAVE_WSPIAPI_H -# include <wspiapi.h> #endif" # Safety check: Ensure that we are in the correct source directory. @@ -37,7 +34,7 @@ AC_C_CONST dnl ** check for specific header (.h) files that we are interested in -AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h sys/types.h unistd.h winsock2.h ws2tcpip.h wspiapi.h]) +AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h sys/types.h unistd.h winsock2.h ws2tcpip.h]) AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h netinet/tcp.h sys/socket.h sys/uio.h sys/un.h]) AC_CHECK_FUNCS([readlink symlink]) @@ -103,6 +100,12 @@ fi dnl -------------------------------------------------- +dnl * test for GETPEEREID(3) +dnl -------------------------------------------------- +AC_MSG_CHECKING(for getpeereid in unistd.h) +AC_CHECK_FUNC( getpeereid, AC_DEFINE([HAVE_GETPEEREID], [1], [Define to 1 if you have getpeereid.] )) + +dnl -------------------------------------------------- dnl * check for Windows networking libraries dnl -------------------------------------------------- AC_CHECK_LIB(ws2_32, _head_libws2_32_a) @@ -140,6 +143,11 @@ dnl ------------------------------------------------------- AC_CHECK_DECLS([IPV6_V6ONLY]) +dnl ------------------------------------------------------- +dnl * test for IPPROTO_* macros/constants +dnl ------------------------------------------------------- +AC_CHECK_DECLS([IPPROTO_IP, IPPROTO_TCP, IPPROTO_IPV6]) + dnl -------------------------------------------------- dnl * test for Linux sendfile(2) dnl -------------------------------------------------- @@ -161,7 +169,7 @@ AC_CHECK_FUNCS(accept4) case "$host" in -*-mingw32) +*-mingw*) EXTRA_SRCS="cbits/initWinSock.c, cbits/winSockErr.c, cbits/asyncAccept.c" EXTRA_LIBS=ws2_32 CALLCONV=stdcall ;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/include/HsNet.h new/network-2.4.2.3/include/HsNet.h --- old/network-2.4.1.2/include/HsNet.h 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/include/HsNet.h 2014-04-18 09:16:03.000000000 +0200 @@ -23,7 +23,7 @@ #ifndef INLINE # if defined(_MSC_VER) # define INLINE extern __inline -# elif defined(__GNUC__) +# elif defined(__GNUC_GNU_INLINE__) # define INLINE extern inline # else # define INLINE inline @@ -43,9 +43,6 @@ // fix for MingW not defining IPV6_V6ONLY # define IPV6_V6ONLY 27 # endif -# ifdef HAVE_WSPIAPI_H -# include <wspiapi.h> -# endif extern void shutdownWinSock(); extern int initWinSock (); @@ -176,4 +173,8 @@ # define IOV_MAX 1024 #endif +#if !defined(SOCK_NONBLOCK) // Missing define in Bionic libc (Android) +# define SOCK_NONBLOCK O_NONBLOCK +#endif + #endif /* HSNET_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/include/HsNetworkConfig.h new/network-2.4.2.3/include/HsNetworkConfig.h --- old/network-2.4.1.2/include/HsNetworkConfig.h 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/include/HsNetworkConfig.h 2014-04-18 09:16:03.000000000 +0200 @@ -26,6 +26,18 @@ don't. */ #define HAVE_DECL_AI_V4MAPPED 1 +/* Define to 1 if you have the declaration of `IPPROTO_IP', and to 0 if you + don't. */ +#define HAVE_DECL_IPPROTO_IP 1 + +/* Define to 1 if you have the declaration of `IPPROTO_IPV6', and to 0 if you + don't. */ +#define HAVE_DECL_IPPROTO_IPV6 1 + +/* Define to 1 if you have the declaration of `IPPROTO_TCP', and to 0 if you + don't. */ +#define HAVE_DECL_IPPROTO_TCP 1 + /* Define to 1 if you have the declaration of `IPV6_V6ONLY', and to 0 if you don't. */ #define HAVE_DECL_IPV6_V6ONLY 1 @@ -42,6 +54,9 @@ /* Define to 1 if you have the `gethostent' function. */ #define HAVE_GETHOSTENT 1 +/* Define to 1 if you have getpeereid. */ +#define HAVE_GETPEEREID 1 + /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 @@ -123,9 +138,6 @@ /* Define to 1 if you have the <ws2tcpip.h> header file. */ /* #undef HAVE_WS2TCPIP_H */ -/* Define to 1 if you have the <wspiapi.h> header file. */ -/* #undef HAVE_WSPIAPI_H */ - /* Define to 1 if the `getaddrinfo' function needs WINVER set. */ /* #undef NEED_WINVER_XP */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/include/HsNetworkConfig.h.in new/network-2.4.2.3/include/HsNetworkConfig.h.in --- old/network-2.4.1.2/include/HsNetworkConfig.h.in 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/include/HsNetworkConfig.h.in 2014-04-18 09:16:03.000000000 +0200 @@ -25,6 +25,18 @@ don't. */ #undef HAVE_DECL_AI_V4MAPPED +/* Define to 1 if you have the declaration of `IPPROTO_IP', and to 0 if you + don't. */ +#undef HAVE_DECL_IPPROTO_IP + +/* Define to 1 if you have the declaration of `IPPROTO_IPV6', and to 0 if you + don't. */ +#undef HAVE_DECL_IPPROTO_IPV6 + +/* Define to 1 if you have the declaration of `IPPROTO_TCP', and to 0 if you + don't. */ +#undef HAVE_DECL_IPPROTO_TCP + /* Define to 1 if you have the declaration of `IPV6_V6ONLY', and to 0 if you don't. */ #undef HAVE_DECL_IPV6_V6ONLY @@ -41,6 +53,9 @@ /* Define to 1 if you have the `gethostent' function. */ #undef HAVE_GETHOSTENT +/* Define to 1 if you have getpeereid. */ +#undef HAVE_GETPEEREID + /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H @@ -122,9 +137,6 @@ /* Define to 1 if you have the <ws2tcpip.h> header file. */ #undef HAVE_WS2TCPIP_H -/* Define to 1 if you have the <wspiapi.h> header file. */ -#undef HAVE_WSPIAPI_H - /* Define to 1 if the `getaddrinfo' function needs WINVER set. */ #undef NEED_WINVER_XP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/network.buildinfo.in new/network-2.4.2.3/network.buildinfo.in --- old/network-2.4.1.2/network.buildinfo.in 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/network.buildinfo.in 2014-04-18 09:16:03.000000000 +0200 @@ -1,5 +1,6 @@ ghc-options: -DCALLCONV=@CALLCONV@ @EXTRA_CPPFLAGS@ ghc-prof-options: -DCALLCONV=@CALLCONV@ @EXTRA_CPPFLAGS@ +ld-options: @LDFLAGS@ cc-options: -DCALLCONV=@CALLCONV@ @EXTRA_CPPFLAGS@ c-sources: @EXTRA_SRCS@ extra-libraries: @EXTRA_LIBS@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/network.cabal new/network-2.4.2.3/network.cabal --- old/network-2.4.1.2/network.cabal 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/network.cabal 2014-04-18 09:16:03.000000000 +0200 @@ -1,5 +1,5 @@ name: network -version: 2.4.1.2 +version: 2.4.2.3 license: BSD3 license-file: LICENSE maintainer: Johan Tibell <johan.tibell@gmail.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/network-2.4.1.2/tests/Simple.hs new/network-2.4.2.3/tests/Simple.hs --- old/network-2.4.1.2/tests/Simple.hs 2013-02-22 01:03:06.000000000 +0100 +++ new/network-2.4.2.3/tests/Simple.hs 2014-04-18 09:16:03.000000000 +0200 @@ -112,6 +112,67 @@ client sock = send sock testMsg +{- +testGetPeerCred:: Assertion +testGetPeerCred = + test clientSetup clientAct serverSetup server + where + clientSetup = do + sock <- socket AF_UNIX Stream defaultProtocol + connect sock $ SockAddrUnix addr + return sock + + serverSetup = do + sock <- socket AF_UNIX Stream defaultProtocol + bindSocket sock $ SockAddrUnix addr + listen sock 1 + return sock + + server sock = do + (clientSock, _) <- accept sock + serverAct clientSock + sClose clientSock + + addr = "/tmp/testAddr1" + clientAct sock = withSocketsDo $ do + sendAll sock testMsg + (pid,uid,gid) <- getPeerCred sock + putStrLn $ unwords ["pid=",show pid,"uid=",show uid, "gid=", show gid] + serverAct sock = withSocketsDo $ do + msg <- recv sock 1024 + putStrLn $ C.unpack msg + + +testGetPeerEid :: Assertion +testGetPeerEid = + test clientSetup clientAct serverSetup server + where + clientSetup = do + sock <- socket AF_UNIX Stream defaultProtocol + connect sock $ SockAddrUnix addr + return sock + + serverSetup = do + sock <- socket AF_UNIX Stream defaultProtocol + bindSocket sock $ SockAddrUnix addr + listen sock 1 + return sock + + server sock = do + (clientSock, _) <- accept sock + serverAct clientSock + sClose clientSock + + addr = "/tmp/testAddr2" + clientAct sock = withSocketsDo $ do + sendAll sock testMsg + (uid,gid) <- getPeerEid sock + putStrLn $ unwords ["uid=",show uid, "gid=", show gid] + serverAct sock = withSocketsDo $ do + msg <- recv sock 1024 + putStrLn $ C.unpack msg +-} + ------------------------------------------------------------------------ -- Other @@ -132,6 +193,8 @@ , testCase "testOverFlowRecv" testOverFlowRecv , testCase "testRecvFrom" testRecvFrom , testCase "testOverFlowRecvFrom" testOverFlowRecvFrom +-- , testCase "testGetPeerCred" testGetPeerCred +-- , testCase "testGetPeerEid" testGetPeerEid ] tests :: [Test] -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org