git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: latest clone/pull of git.git problems with setlinebuf.

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 4, 2008, 04:25 UTC
Message-ID
<7vhc8w8rme.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LNX.1.10.0809032157200.21167@suse104.zenez.com>
Boyd Lynn Gerber <gerberb@zenez.com> writes:
Show 8 quoted lines
> On Wed, 3 Sep 2008, Junio C Hamano wrote:
> ...
>> Ah, ok.  I should have noticed that setlinebuf() was outside POSIX (it is
>> not usable on older BSDs either).
>>
>> Let's see if we can replace it with setvbuf() which is POSIX.
>
> This fixes the problem. on both OS's.

By the way, have you actually exercised the codepath, or does your above "fixes" mean "compiles"?

I knew it would compile on a system with POSIX setvbuf(), but I was unsure about the size argument. I know for glibc giving <NULL, 0> would be equivalent to setlinebuf(), but POSIX itself leaves what exactly happens to the size argument quite vague, saying only "otherwise [when buf is a null pointer], size may determine the size of a buffer allocated by the setvbuf() function." Does size=0 mean it allocates very little, and while it tries to line buffer the output, because the buffer is so small that it fails to buffer an entire line causing early flushing of the stream?

Previous: Boyd Lynn GerberNext: Boyd Lynn Gerber
Message 7 of 9 in “latest clone/pull of git.git problems with setlinebuf.”
  1. Boyd Lynn GerberSep 4, 2008
  2. Boyd Lynn GerberSep 4, 2008
  3. Avery PennarunSep 4, 2008
  4. Boyd Lynn GerberSep 4, 2008
  5. Junio C HamanoSep 4, 2008
  6. Boyd Lynn GerberSep 4, 2008
  7. Junio C HamanoSep 4, 2008
  8. Boyd Lynn GerberSep 4, 2008
  9. Boyd Lynn GerberSep 4, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.