Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260402122029.GM1827@brightrain.aerifal.cx>
Date: Thu, 2 Apr 2026 08:20:30 -0400
From: Rich Felker <dalias@...c.org>
To: Collin Funk <collin.funk1@...il.com>
Cc: musl@...ts.openwall.com, Bruno Haible <bruno@...sp.org>
Subject: Re: standard output is always line buffered for the first line

On Wed, Apr 01, 2026 at 10:04:06PM -0700, Collin Funk wrote:
> Hi,
> 
> POSIX states the following about standard output [1]:
> 
>     When opened, stderr shall not be fully buffered; stdin and stdout
>     shall be fully buffered if and only if the file descriptor
>     associated with the stream is determined not to be associated with
>     an interactive device.
> 
> This is not the case on musl, where the first line is always line
> buffered.

Fully-buffered does not imply any requirement not to produce output on
the underlying fd before the buffer is "full". The notion of "full" is
not even defined. The implementation is free to choose how much, if
any, of the buffer to use before writing it out; completely
unbuffered is even a conforming implementation of "fully buffered"
mode.

The only requirements are that output not be delayed in line-buffered
or unbuffered modes. Fully-buffered just places an allowance on the
implementation (and a requirement on the application to accept that
allowance), not any requirement on the implementation.

This code is behaving exactly as it was intended to.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.