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

[RFC PATCH 0/3] trace2: log "signal" end events if we invoke BUG()

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 26, 2022, 00:30 UTC
Message-ID
<RFC-cover-0.3-00000000000-20220525T234908Z-avarab@gmail.com>

Josh Steadmon noted in the Review Club tonight/today/yesterday (depending on the TZ) that he'd encountered trace2 event streams without an "exit" event, which as discussed can be seen from usage.c is due to our invoking of abort() there.

This RFC series aims to rectify that, first we back out of test-tool specific behavior for BUG() in 1/3, and in 3/3 define abort() to be a wrapper macro like what we do for exit() already.

I'm not sure about the direction of emitting such a "signal" event, should we just "fake it" and emit an "exit" event? Probably not, but I'm not confident in that. For one is the exit code (as in what a shell would get from $?) when we're killed with SIGABRT guaranteed to be portable?

But hopefully this gets the ball rolling on a good fix for this by starting a discussion about what we should be doing here.

One alternate way of dealing with this would be to first split up the "error" event so that we don't emit "error" for all of BUG(), die(), error() and warning(), and to instead split those up into "BUG", "die", "error", "warning".

Once we did that we could pretty much declare that the current behavior before this series is a feature, and that anyone parsing trace2 output needs to deal with the stream potentially ending in a "BUG" event.

Any such event parser will need to deal with at least:
    "start" -> ["exit" | "signal"] (with this series)
So perhaps it's OK to simply say that consumers should expect?
   # Or "error" now, but then you can't distinguish "BUG()" from the
   # rest.
    "start" -> ["exit" | "BUG"]

I think I like that less, but it's worth pointing out as an alternative. The implementation would certainly be smaller than this proposed RFC.

Ævar Arnfjörð Bjarmason (3):
  test-tool: don't fake up BUG() exits as code 99
  refs API: rename "abort" callback to avoid macro clash
  trace2: emit "signal" events after calling BUG()
 Documentation/technical/api-trace2.txt | 13 +++++++++----
 git-compat-util.h                      |  9 +++++++++
 refs/debug.c                           |  4 ++--
 refs/files-backend.c                   |  4 ++--
 refs/iterator.c                        |  8 ++++----
 refs/packed-backend.c                  |  2 +-
 refs/ref-cache.c                       |  2 +-
 refs/refs-internal.h                   |  2 +-
 t/helper/test-tool.c                   |  1 -
 t/t0210-trace2-normal.sh               |  5 ++---
 t/t1406-submodule-ref-store.sh         | 10 +++++-----
 t/test-lib-functions.sh                | 13 +++++++++++++
 trace2.c                               | 19 +++++++++++++++++++
 trace2.h                               |  8 ++++++++
 trace2/tr2_tgt.h                       |  3 +++
 trace2/tr2_tgt_event.c                 | 11 +++++++++--
 trace2/tr2_tgt_normal.c                | 11 +++++++++--
 trace2/tr2_tgt_perf.c                  | 11 +++++++++--
 usage.c                                |  5 -----
 19 files changed, 106 insertions(+), 35 deletions(-)
-- 
2.36.1.1046.g586767a6996
Next: Ævar Arnfjörð Bjarmason
Message 1 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.