[ ghc-Bugs-734716 ] ghc-5.05: handle closed by hselect
SourceForge.net
noreply at sourceforge.net
Tue May 13 06:03:34 EDT 2003
Bugs item #734716, was opened at 2003-05-08 08:52
Message generated for change (Comment added) made by nobody
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=734716&group_id=8032
Category: hslibs/util
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: ghc-5.05: handle closed by hselect
Initial Comment:
The included program, compiled with ghc-5.05 fails with the error
Fail: illegal operation
Action: hGetChar
Handle: {loc=<socket: 4>,type=duplex (read-
write),binary=True,buffering=none}
Reason: handle is closed
File: <socket: 4>
The error occurs on both Mac OS X 10.2.6 and FreeBSD 4.7.
The program works as expected when compiled with ghc-5.04.2.
module Main where
import Select
import Network
import Network.Socket
import IO
portId = (PortNumber portNum)
portNum = 9099
main = do
sock <- listenOn portId
(handle,_,_) <- Network.accept sock
putStrLn ("Read")
c <- (hGetChar handle)
putStrLn ("Got: " ++ show c)
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2003-05-13 03:03
Message:
Logged In: NO
Somehow the only important line (hSelect) got lost in the submission.
module Main where
import Select
import Network
import Network.Socket
import IO
portId = (PortNumber portNum)
portNum = 9099
main = do
sock <- listenOn portId
(handle,_,_) <- Network.accept sock
hSelect [handle] [] [] Nothing
putStrLn ("Read")
c <- (hGetChar handle)
putStrLn ("Got: " ++ show c)
Compiled with ghc --make M1 -o M1 -package network -package util this
fails with
Fail: illegal operation
Action: hGetChar
Handle: {loc=<socket: 4>,type=duplex (read-
write),binary=True,buffering=block (1024)}
Reason: handle is closed
File: <socket: 4>
----------------------------------------------------------------------
Comment By: Volker Stolz (volkersf)
Date: 2003-05-10 08:22
Message:
Logged In: YES
user_id=126328
Do you mean hGetChar instead of hSelect? The Select-module is in the deprecated hslibs-branch and you do not use it in your program.
It works fine with recent ghc-5.05 from CVS on FreeBSD 4.8-STABLE if I comment out the 'import Select' and compile with -package network.
Maybe you should update your snapshot and try again.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=734716&group_id=8032
More information about the Glasgow-haskell-bugs
mailing list