[GHC] #929: Strange buffering behaviour in GHCi
GHC
trac at galois.com
Tue Oct 10 07:18:35 EDT 2006
#929: Strange buffering behaviour in GHCi
-------------------------+--------------------------------------------------
Reporter: simonmar | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 6.6.1
Component: GHCi | Version: 6.5
Severity: normal | Keywords:
Os: Unknown | Difficulty: Unknown
Architecture: Unknown |
-------------------------+--------------------------------------------------
Reported by Clifford Beshers on haskell at haskell.org:
ghci starts with !NoBuffering behavior, even though the mode appears to
be
!LineBuffering. Setting it once fixes the problem.
I've included a ghci session that demonstrates the bug by showing the
change in
behavior when pressing Control-D in response to each call to getLine.
The results
are identical for 6.4.1 and 6.6 rc1.
{{{
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version 6.4.1, for Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Loading package base-1.0 ... linking ... done.
Prelude> :m +System.IO
Prelude System.IO> hGetBuffering stdin >>= print
LineBuffering
Prelude System.IO> getLine >>= print
^D
"\EOT"
Prelude System.IO> hSetBuffering stdin NoBuffering >> hGetBuffering stdin
>>= print
NoBuffering
Prelude System.IO> getLine >>= print
^D
"\EOT"
Prelude System.IO> hSetBuffering stdin LineBuffering >> hGetBuffering
stdin >>= print
LineBuffering
Prelude System.IO> getLine >>= print
*** Exception: <stdin>: hGetLine: end of file
Prelude System.IO>
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version 6.5.20060831, for
Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Loading package base ... linking ... done.
Prelude> :m +System.IO
Prelude System.IO> hGetBuffering stdin >>= print
LineBuffering
Prelude System.IO> getLine >>= print
^D
"\EOT"
Prelude System.IO> hSetBuffering stdin NoBuffering >> hGetBuffering stdin
>>= print
NoBuffering
Prelude System.IO> getLine >>= print
^D
"\EOT"
Prelude System.IO> hSetBuffering stdin LineBuffering >> hGetBuffering
stdin >>= print
LineBuffering
Prelude System.IO> getLine >>= print
*** Exception: <stdin>: hGetLine: end of file
Prelude System.IO>
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/929>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list