From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Bagas Sanjaya <bagasdotme@gmail.com>,
Abhradeep Chakraborty <chakrabortyabhradeep79@gmail.com>,
Josh Steadmon <steadmon@google.com>,
Glen Choo <chooglen@google.com>,
Andrei Rybak <rybak.a.v@gmail.com>,
Emily Shaffer <emilyshaffer@google.com>
Subject: Re: [PATCH v2 2/6] usage.c: add a non-fatal bug() function to go with BUG()
Date: Wed, 01 Jun 2022 11:50:04 -0700 [thread overview]
Message-ID: <xmqqo7zcrzfn.fsf@gitster.g> (raw)
In-Reply-To: <patch-v2-2.6-2d0527f86dc-20220531T164806Z-avarab@gmail.com> (=?utf-8?B?IsOGdmFyIEFybmZqw7Zyw7A=?= Bjarmason"'s message of "Tue, 31 May 2022 18:58:44 +0200")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> Unlike the code this replaces we'll log to trace2 with this new bug()
> function (as with other usage.c functions, including BUG()),
I do not terribly mind repeated fprintf(stderr, ...) or error() in a
loop, but this aspect of the change is probably among the two things
that make the series shine (the other obviously being bug_if() which
allows us to lose the "did we see any bug?" counter).
> Any caller to bug() can follow up such calls with BUG_if_bug(),
> which will BUG() out (i.e. abort()) if there were any preceding calls
> to bug(), callers can also decide not to call BUG_if_bug() and leave
> the resulting BUG() invocation until exit() time. There are currently
> no bug() API users that don't call BUG_if_bug() themselves after a
> for-loop, but allowing for not calling BUG_if_bug() keeps the API
> flexible. As the tests and documentation here show we'll catch missing
> BUG_if_bug() invocations in our exit() wrapper.
OK.
> I'd previously proposed this as part of another series[1], in that
> use-case we ended thinking a BUG() would be better (and eventually
> 96e41f58fe1 (fsck: report invalid object type-path combinations,
> 2021-10-01) ended up with neither). Here though we'll end up
> converting various existing code that was already doing what we're
> doing better with this new API.
I think the last paragraph is an after-three-dash material.
next prev parent reply other threads:[~2022-06-01 18:50 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-21 17:14 [PATCH 0/5] usage API: add and use a bug() + BUG_if_bug() Ævar Arnfjörð Bjarmason
2022-05-21 17:14 ` [PATCH 1/5] usage.c: add a non-fatal bug() function to go with BUG() Ævar Arnfjörð Bjarmason
2022-05-25 20:55 ` Junio C Hamano
2022-05-26 4:17 ` Junio C Hamano
2022-05-26 7:59 ` Ævar Arnfjörð Bjarmason
2022-05-26 16:55 ` Junio C Hamano
2022-05-26 18:29 ` Ævar Arnfjörð Bjarmason
2022-05-26 18:55 ` Junio C Hamano
2022-05-31 16:52 ` Ævar Arnfjörð Bjarmason
2022-05-27 17:03 ` Josh Steadmon
2022-05-27 19:05 ` Junio C Hamano
2022-05-21 17:14 ` [PATCH 2/5] parse-options.c: use new bug() API for optbug() Ævar Arnfjörð Bjarmason
2022-05-27 17:03 ` Josh Steadmon
2022-05-21 17:14 ` [PATCH 3/5] parse-options.c: use optbug() instead of BUG() "opts" check Ævar Arnfjörð Bjarmason
2022-05-25 21:05 ` Junio C Hamano
2022-05-21 17:14 ` [PATCH 4/5] receive-pack: use bug() and BUG_if_bug() Ævar Arnfjörð Bjarmason
2022-05-25 21:15 ` Junio C Hamano
2022-05-27 17:04 ` Josh Steadmon
2022-05-27 22:53 ` Andrei Rybak
2022-05-21 17:14 ` [PATCH 5/5] cache-tree.c: " Ævar Arnfjörð Bjarmason
2022-05-27 21:29 ` Glen Choo
2022-05-27 17:02 ` [PATCH 0/5] usage API: add and use a bug() + BUG_if_bug() Josh Steadmon
2022-05-31 16:58 ` [PATCH v2 0/6] " Ævar Arnfjörð Bjarmason
2022-05-31 16:58 ` [PATCH v2 1/6] common-main.o: move non-trace2 exit() behavior out of trace2.c Ævar Arnfjörð Bjarmason
2022-06-01 18:37 ` Junio C Hamano
2022-05-31 16:58 ` [PATCH v2 2/6] usage.c: add a non-fatal bug() function to go with BUG() Ævar Arnfjörð Bjarmason
2022-05-31 18:18 ` Glen Choo
2022-06-01 18:50 ` Junio C Hamano [this message]
2022-05-31 16:58 ` [PATCH v2 3/6] parse-options.c: use new bug() API for optbug() Ævar Arnfjörð Bjarmason
2022-05-31 16:58 ` [PATCH v2 4/6] parse-options.c: use optbug() instead of BUG() "opts" check Ævar Arnfjörð Bjarmason
2022-05-31 17:38 ` Josh Steadmon
2022-06-01 18:55 ` Junio C Hamano
2022-05-31 16:58 ` [PATCH v2 5/6] receive-pack: use bug() and BUG_if_bug() Ævar Arnfjörð Bjarmason
2022-05-31 16:58 ` [PATCH v2 6/6] cache-tree.c: " Ævar Arnfjörð Bjarmason
2022-06-01 18:52 ` Junio C Hamano
2022-05-31 17:39 ` [PATCH v2 0/6] usage API: add and use a bug() + BUG_if_bug() Josh Steadmon
2022-06-02 12:25 ` [PATCH v3 " Ævar Arnfjörð Bjarmason
2022-06-02 12:25 ` [PATCH v3 1/6] common-main.o: move non-trace2 exit() behavior out of trace2.c Ævar Arnfjörð Bjarmason
2022-06-03 1:19 ` Junio C Hamano
2022-06-07 20:09 ` Josh Steadmon
2022-06-07 21:12 ` Ævar Arnfjörð Bjarmason
2022-06-07 22:05 ` Josh Steadmon
2022-06-02 12:25 ` [PATCH v3 2/6] usage.c: add a non-fatal bug() function to go with BUG() Ævar Arnfjörð Bjarmason
2022-06-02 12:25 ` [PATCH v3 3/6] parse-options.c: use new bug() API for optbug() Ævar Arnfjörð Bjarmason
2022-06-02 12:25 ` [PATCH v3 4/6] parse-options.c: use optbug() instead of BUG() "opts" check Ævar Arnfjörð Bjarmason
2022-06-02 12:25 ` [PATCH v3 5/6] receive-pack: use bug() and BUG_if_bug() Ævar Arnfjörð Bjarmason
2022-06-02 12:25 ` [PATCH v3 6/6] cache-tree.c: " Ævar Arnfjörð Bjarmason
2022-06-02 19:54 ` Junio C Hamano
2022-06-02 16:56 ` [PATCH v3 0/6] usage API: add and use a bug() + BUG_if_bug() Glen Choo
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=xmqqo7zcrzfn.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=bagasdotme@gmail.com \
--cc=chakrabortyabhradeep79@gmail.com \
--cc=chooglen@google.com \
--cc=emilyshaffer@google.com \
--cc=git@vger.kernel.org \
--cc=rybak.a.v@gmail.com \
--cc=steadmon@google.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;
as well as URLs for NNTP newsgroup(s).