Ticket #454 (closed bug: fixed)

Opened 8 years ago

Last modified 4 years ago

hPutBuf doesn't respect LineBuffering

Reported by: simonmar Owned by:
Priority: low Milestone: 6.12.1
Component: libraries/base Version: 6.4
Keywords: Cc: rich.neswold@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by igloo) (diff)

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.


Change History

Changed 7 years ago by igloo

  • difficulty set to Unknown
  • milestone set to 6.8
  • os set to Unknown
  • architecture set to Unknown
  • description modified (diff)

Changed 6 years ago by guest

  • cc rich.neswold@… added

Changed 6 years ago by igloo

  • owner simonmar deleted
  • status changed from assigned to new
  • milestone changed from 6.8 branch to _|_

Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple

Changed 4 years ago by simonmar

  • status changed from new to closed
  • resolution changed from None to fixed
  • milestone changed from _|_ to 6.12.1

The new IO library now treats LineBuffering like NoBuffering in hPutBuf. Arguably LineBuffering makes little sense for a byte-oriented API, since the newline character might be encoded arbitrarily.

Note: See TracTickets for help on using tickets.