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

Re: [RFC PATCH 1/3] test-tool: don't fake up BUG() exits as code 99

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 3, 2022, 23:05 UTC
Message-ID
<220604.8635glxs3g.gmgdl@evledraar.gmail.com>
In-Reply-To
<xmqqczfpe9ua.fsf@gitster.g>
On Fri, Jun 03 2022, Junio C Hamano wrote:
Show 21 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>>> However, in doing so we've been fooling ourselves when it comes to
>>> what trace2 events we log. The events tested for in
>>> 0a9dde4a04c (usage: trace2 BUG() invocations, 2021-02-05) are not the
>>> real ones, but those that we emit only from the "test-tool".
>>
>> I can fully agree with the above reasoning, i.e. let's test what we
>> do use in production, instead of something nobody uses for real, if
>> we were adding a test for BUG() in vacuum, but why did we have to
>> "fake" it in the first place?
>> ...
>> Are we sure that the reason no longer applies?  How do we know?  We
>> would want to explain that to future developers in the proposed log
>> message, I would think.
>
> We can flip it the other way around.  
>
> I do not think I ever saw anybody asked anybody on this list who got
> a BUG() message to use the coredump to do something useful.  Don't
> modern distros ship with "ulimit -c 0" these days?
I think that part of it was just a side-effect of SIGABRT.
> It might be possible that a better direction is to introduce
> GIT_ABORT_ON_BUG environment or core.abortOnBUG configuration that
> chooses between abort() and exit(99), or something like that, and
> then we switch to use the latter by default over time?

I think the reason for abort() was what's covered in raise(3), i.e. it's a one-stop-shop to getting "stop it" behavior both under threading and non-threading, which as e.g. exit(3) discusses wouldn't be thread-safe with it.

But perhaps that was all premature worrying, we're mostly running non-threaded, and to the extent that we ever BUG() running into exit(3) threading issues is probably the least of our worries.

So perhaps we should drop abort() entirely, I don't know. These proposed patches tried not to do that, but just to log things when we did so.

Previous: Junio C HamanoNext: Jeff King
Message 6 of 16 in “trace2: log "signal" end events if we invoke BUG()”
  1. 0/3 trace2: log "signal" end events if we invoke BUG()Ævar Arnfjörð Bjarmason, May 26, 2022
  2. 2/3 refs API: rename "abort" callback to avoid macro clashÆvar Arnfjörð Bjarmason, May 26, 2022
  3. 1/3 test-tool: don't fake up BUG() exits as code 99Ævar Arnfjörð Bjarmason, May 26, 2022
  4. Junio C HamanoJun 3, 2022
  5. Junio C HamanoJun 3, 2022
  6. Ævar Arnfjörð BjarmasonJun 3, 2022
  7. Jeff KingJun 8, 2022
  8. Junio C HamanoJun 8, 2022
  9. Ævar Arnfjörð BjarmasonJun 9, 2022
  10. Jeff KingJun 9, 2022
  11. Ævar Arnfjörð BjarmasonJun 3, 2022
  12. 3/3 trace2: emit "signal" events after calling BUG()Ævar Arnfjörð Bjarmason, May 26, 2022
  13. Bagas SanjayaMay 26, 2022
  14. Josh SteadmonMay 31, 2022
  15. Junio C HamanoMay 26, 2022
  16. Josh SteadmonMay 31, 2022

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.