[network] #1: unpackFamily on Windows fails match

#1: unpackFamily on Windows fails match ------------------------+--------------------------------------------------- Reporter: igloo | Owner: somebody Type: defect | Status: new Priority: major | Milestone: Component: component1 | Version: Keywords: | ------------------------+--------------------------------------------------- Initially reported here: http://hackage.haskell.org/trac/ghc/ticket/2250 ---- In the HostEntry returned by Network.BSD.getHostByName, evaluating the hostFamily field causes the following error, which is pointing at the unpackFamily function: {{{ *** Exception: Network/Socket.hsc:(1711,17)-(1777,13): Non-exhaustive patterns in case }}} This occurs with 6.8.2 and 6.9.20080323 i386. The machine is running Windows Server 2008 x64. ---- I modified Network/BSD.hs to trace out the h_addrtype variable in Storable `HostEntry`'s peek, and it had the value 0x40002. The corresponding variable in the C struct should be a short, but is inferred to be CInt in the Haskell source, probably thanks to unpackFamily having type CInt -> Family. Due to that, it reads the family as an int, consuming the following length field as well. I hacked past this by giving the peek of h_addrtype an annotation of ":: IO CShort" and adding a fromIntegral at the call to unpackFamily to convert it to the CInt that the unpackFamily function expects. ---- Great stuff, thanks! It looks like it should be `CSaFamily` rather than `CInt`. Likewise `packFamily`, and I expect the whole library could do with an audit. ---- I can reproduce the exact bug on the following combinations: - GHC 6.8.2, x86, Windows XP - GHC 6.8.3, x86, Windows XP - GHC 6.8.2, x86, Windows Vista - GHC 6.8.3, x86, Windows Vista - GHC 6.8.2, x64, Windows Vista - GHC 6.8.3, x64, Windows Vista -- Ticket URL: http://trac.haskell.org/network/ticket/1 network http://projects.haskell.org/network/ Networking-related facilities

#1: unpackFamily on Windows fails match -------------------+-------------------------------------------------------- Reporter: igloo | Owner: Type: defect | Status: new Priority: major | Milestone: Version: | Resolution: Keywords: | -------------------+-------------------------------------------------------- Changes (by igloo): * owner: somebody => -- Ticket URL: http://trac.haskell.org/network/ticket/1#comment:1 network http://projects.haskell.org/network/ Networking-related facilities

#1: unpackFamily on Windows fails match -------------------------+-------------------------------------------------- Reporter: igloo | Owner: Type: defect | Status: new Priority: major | Milestone: Component: component1 | Version: Resolution: | Keywords: -------------------------+-------------------------------------------------- Comment (by igloo): Testcase: {{{ module Main where import Network.BSD main = getHostByName "zao.se" >>= print }}} -- Ticket URL: http://trac.haskell.org/network/ticket/1#comment:2 network http://projects.haskell.org/network/ Networking-related facilities

#1: unpackFamily on Windows fails match ----------------------+----------------------------------------------------- Reporter: igloo | Owner: Type: defect | Status: new Priority: major | Milestone: Component: network | Version: Resolution: | Keywords: ----------------------+----------------------------------------------------- Changes (by anonymous): * component: component1 => network -- Ticket URL: http://trac.haskell.org/network/ticket/1#comment:3 network http://projects.haskell.org/network/ Networking-related facilities

#1: unpackFamily on Windows fails match ----------------------+----------------------------------------------------- Reporter: igloo | Owner: Type: defect | Status: new Priority: major | Milestone: Component: network | Version: Resolution: | Keywords: ----------------------+----------------------------------------------------- Comment (by tibbe): I have limited access to Windows machines. If someone could come up with a rough patch that addresses this bug I'd be happy to review it. -- Ticket URL: http://trac.haskell.org/network/ticket/1#comment:4 network http://projects.haskell.org/network/ Networking-related facilities

#1: unpackFamily on Windows fails match ----------------------+----------------------------------------------------- Reporter: igloo | Owner: bos Type: defect | Status: new Priority: major | Milestone: Component: network | Version: Resolution: | Keywords: ----------------------+----------------------------------------------------- Changes (by bos): * owner: => bos Comment: I'll take a look at this. -- Ticket URL: http://trac.haskell.org/network/ticket/1#comment:5 network http://projects.haskell.org/network/ Networking-related facilities

#1: unpackFamily on Windows fails match ----------------------+----------------------------------------------------- Reporter: igloo | Owner: bos Type: defect | Status: closed Priority: major | Milestone: Component: network | Version: Resolution: fixed | Keywords: ----------------------+----------------------------------------------------- Changes (by bos): * status: new => closed * resolution: => fixed Comment: Fix pushed to darcs repo. -- Ticket URL: http://trac.haskell.org/network/ticket/1#comment:6 network http://projects.haskell.org/network/ Networking-related facilities

#1: unpackFamily on Windows fails match ----------------------+----------------------------------------------------- Reporter: igloo | Owner: bos Type: defect | Status: closed Priority: major | Milestone: Component: network | Version: Resolution: fixed | Keywords: ----------------------+----------------------------------------------------- Comment (by tibbe): Thanks for the fix. I'll make one more release before the next release of the Haskell Platform. I'll wait and see if there are any other bugs that need fixing first. -- Ticket URL: http://trac.haskell.org/network/ticket/1#comment:7 network http://projects.haskell.org/network/ Networking-related facilities
participants (1)
-
network