From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 0/6] getwholeline should clear the buffer upon EOF
Date: Fri, 4 Dec 2026 16:49:20 +0100 [thread overview]
Message-ID: <axLhAERdAK4Wd3u9@pks.im> (raw)
In-Reply-To: <20261122140347.41990-1-gitster@pobox.com>
On Sun, Nov 22, 2026 at 06:03:41AM -0800, Junio C Hamano wrote:
> This series, which is structured in a somewhat unusual way, addresses
> various issues that are caused by a long-standing API bug that the
> strbuf_getwholeline() family of functions shared for quite some time.
>
> When they see feof() on their input stream, they immediately return
> EOF without reading anything (which is good), but they do not clear
> the output buffer. It is not strictly *wrong* per se, but it proved
> to be a rather error-prone API contract, as we see in the early part
> of this series.
Yeah, all of this makes sense to me. I think the best argument for this
series is that it also aligns the behaviour of `strbuf_getwholeline()`
with its `strbuf_getwholeline_fd()` variant, which already used to reset
the buffer. Quite surprising that those two variants had different
behaviour.
I didn't really have anything that warrants a reroll. Thanks!
Patrick
prev parent reply other threads:[~2026-12-04 15:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 14:03 [PATCH 0/6] getwholeline should clear the buffer upon EOF Junio C Hamano
2026-11-22 14:03 ` [PATCH 1/6] mailinfo: do not call handle_body() when headers end at EOF Junio C Hamano
2026-11-22 14:03 ` [PATCH 2/6] t4201: demonstrate shortlog reusing stale buffer on EOF Junio C Hamano
2026-12-04 15:47 ` Patrick Steinhardt
2026-11-22 14:03 ` [PATCH 3/6] t7301: demonstrate "clean -i" ask mode deleting past EOF Junio C Hamano
2026-12-04 15:47 ` Patrick Steinhardt
2026-11-22 14:03 ` [PATCH 4/6] t9300: demonstrate fast-import re-parsing heredoc delimiter at EOF Junio C Hamano
2026-11-22 14:03 ` [PATCH 5/6] strbuf_getwholeline(): clear strbuf upon EOF Junio C Hamano
2026-12-04 15:47 ` Patrick Steinhardt
2026-11-22 14:03 ` [PATCH 6/6] t7301, t9300: test EOF loops fixed by clearing " Junio C Hamano
2026-11-23 15:37 ` [PATCH 0/6] getwholeline should clear the buffer " Junio C Hamano
2026-12-04 15:49 ` Patrick Steinhardt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=axLhAERdAK4Wd3u9@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox