#2109: hIsEOF blocks when applied to a non-closed socket with no input available
--------------------------------------+-------------------------------------
Reporter: Mads | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: libraries/base | Version: 6.8.2
Severity: normal | Resolution: invalid
Keywords: hIsEOF blocks sockets | Testcase:
Architecture: x86 | Os: Linux
--------------------------------------+-------------------------------------
Changes (by mads):
* status: new => closed
* resolution: => invalid
Comment:
When reporting this bug I thought that hIsEOF should return False, in the
case described in the bug report. However, this may lead to trouble.
Consider the following program:
do isEOF <- hIsEOF someHandle
when (not isEOF) (hGetLine someHandle >>= ...)
this program could fail, if "someHandle" was closed between the first and
second line.
Also I re-read the documentation for hIsEOF and it starts with:
"For a readable handle hdl, ..."
(http://haskell.org/ghc/docs/latest/html/libraries/base/System-
IO.html#v%3AhIsEOF)
so arguably the documentation actually says that hIsEOF may block.
However, it would be nice, if the documentation said explicitly that
hIsEOF could block.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2109#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs