[GHC] #454: hPutBuf doesn't respect LineBuffering
GHC
trac at galois.com
Fri Oct 20 10:14:30 EDT 2006
#454: hPutBuf doesn't respect LineBuffering
----------------------------+-----------------------------------------------
Reporter: simonmar | Owner: simonmar
Type: bug | Status: assigned
Priority: low | Milestone: 6.8
Component: libraries/base | Version: 6.4
Severity: normal | Resolution: None
Keywords: | Difficulty: Unknown
Testcase: | Architecture: Unknown
Os: Unknown |
----------------------------+-----------------------------------------------
Changes (by igloo):
* architecture: => Unknown
* difficulty: => Unknown
* milestone: => 6.8
* testcase: =>
* os: => Unknown
Old description:
> {{{
> On 15 April 2005 02:39, Ian Lynagh wrote:
>
> > If I run this program:
> >
> > --------------------------------------------------
> > import System.Cmd (system)
> > import Foreign.C.String (castCharToCChar)
> > import Foreign.Marshal.Array (newArray)
> > import System.IO (hSetBinaryMode, hPutBuf, stdout,
> hSetBuffering,
> > BufferMode(..))
> >
> > main = do hSetBinaryMode stdout True
> > hSetBuffering stdout LineBuffering
> > p <- newArray (map castCharToCChar "foo\n")
> > hPutBuf stdout p 4
> > system "sleep 5"
> > putStr "bar\n"
> > --------------------------------------------------
> >
> > compiled by GHC then it waits 5 seconds and then
> prints foo and bar
> > together.
> >
> > With hugs, foo is printed and then 5 seconds later
> bar is printed, as
> > I would expect.
>
> True, the implementation doesn't respect LineBuffering
> (though it does
> respect the other buffering modes, I believe). That's
> a bug.
>
> }}}
New description:
{{{
On 15 April 2005 02:39, Ian Lynagh wrote:
> If I run this program:
>
> --------------------------------------------------
> import System.Cmd (system)
> import Foreign.C.String (castCharToCChar)
> import Foreign.Marshal.Array (newArray)
> import System.IO (hSetBinaryMode, hPutBuf, stdout,
hSetBuffering,
> BufferMode(..))
>
> main = do hSetBinaryMode stdout True
> hSetBuffering stdout LineBuffering
> p <- newArray (map castCharToCChar "foo\n")
> hPutBuf stdout p 4
> system "sleep 5"
> putStr "bar\n"
> --------------------------------------------------
>
> compiled by GHC then it waits 5 seconds and then
prints foo and bar
> together.
>
> With hugs, foo is printed and then 5 seconds later
bar is printed, as
> I would expect.
True, the implementation doesn't respect LineBuffering
(though it does
respect the other buffering modes, I believe). That's
a bug.
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/454>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list