From: Derrick Stolee <stolee@gmail.com>
To: Jeff King <peff@peff.net>, phillip.wood@dunelm.org.uk
Cc: Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org, gitster@pobox.com, newren@gmail.com
Subject: Re: [PATCH 0/6] [RFC] Create a 'safe' strbuf API
Date: Tue, 6 Oct 2026 10:33:57 -0400 [thread overview]
Message-ID: <0f466dc6-f9c5-48ee-bb94-f3e8a951ee5d@gmail.com> (raw)
In-Reply-To: <20260923194628.GA44327@coredump.intra.peff.net>
On 9/23/2026 3:46 PM, Jeff King wrote:
> On Sat, Sep 19, 2026 at 04:23:41PM +0100, Phillip Wood wrote:
>
>>> The goal of this short RFC, such as it is, is to get some feedback on
>>> whether this is a worthwhile direction to pursue or if I should abandon this
>>> idea of having this definition of "safe" for some APIs. This decision may
>>> also determine if we should abandon ds/trace2-tolerate-failed-timestamps or
>>> leave the existing behavior as-is.
> Yeah, I don't love the term "safe" here for two reasons:
...> So what I had imagined when seeing the initial subject lines was not
> strbufs who report malloc errors, but rather strbuf-like functions that
> operate on a fixed-size buffer (with either a static max-size like 4k,
> or perhaps a per-variable max-size recorded in the struct).
>
> You can still run into errors, of course; we might run out of room in
> the buffer. But we'd see those cases deterministically for a given
> input, rather than occasionally when races or other external factors
> cause malloc to unexpectedly fail.
>
>> For the strbuf API having to check for failure on every function call does
>> not sound attractive, I think having a sticky error bit like the stdio
>> functions so that one can build a string and check there have been no
>> failures once just before using it would be a nicer approach.
>
> Agreed. I think that is a good approach for the static_strbuf idea
> above, too.
Thanks for taking the time to consider the RFC. Sorry I'm so late in
responding, but I find your feedback insightful. It requires starting
over on this direction, but I don't currently have time to do so.
Maybe I'll give this a try again in the future, but I'll set it down
for now.
Thanks,
-Stolee
prev parent reply other threads:[~2026-10-06 14:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 13:02 [PATCH 0/6] [RFC] Create a 'safe' strbuf API Derrick Stolee via GitGitGadget
2026-09-18 13:02 ` [PATCH 1/6] strbuf: add header for 'safe' API Derrick Stolee via GitGitGadget
2026-09-21 21:18 ` Junio C Hamano
2026-09-23 19:25 ` Mark C. Chu-Carroll
2026-09-23 20:14 ` Junio C Hamano
2026-09-18 13:02 ` [PATCH 2/6] wrapper: initialize GIT_ALLOC_LIMIT proactively Derrick Stolee via GitGitGadget
2026-09-18 13:02 ` [PATCH 3/6] wrapper: create safe_memory_limit_check() Derrick Stolee via GitGitGadget
2026-09-21 21:24 ` Junio C Hamano
2026-09-18 13:02 ` [PATCH 4/6] strbuf-safe: add sstrbuf_grow() Derrick Stolee via GitGitGadget
2026-09-21 21:29 ` Junio C Hamano
2026-09-18 13:02 ` [PATCH 5/6] json-writer: include strbuf-safe.h Derrick Stolee via GitGitGadget
2026-09-18 13:02 ` [PATCH 6/6] strbuf-safe: add init and release methods Derrick Stolee via GitGitGadget
2026-09-21 21:44 ` Junio C Hamano
2026-09-21 22:34 ` Junio C Hamano
2026-09-19 15:23 ` [PATCH 0/6] [RFC] Create a 'safe' strbuf API Phillip Wood
2026-09-23 19:46 ` Jeff King
2026-10-06 14:33 ` Derrick Stolee [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=0f466dc6-f9c5-48ee-bb94-f3e8a951ee5d@gmail.com \
--to=stolee@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=phillip.wood@dunelm.org.uk \
/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