Re: [PATCH] trace2: tolerate failed timestamp formatting
From: Junio C Hamano <hidden>
Date: 2026-07-20 14:29:54
Derrick Stolee [off-list ref] writes:
quoted
Would it make more sense to fix the xsnprintf()/libintl boundary and treat Trace2 reentrancy separately? I still can't explain why the allocation failed, so there may be another GfW-specific piece I’m missing.I think that your suggested change has merits and should be pursued. I'll explore it a bit to confirm.
That band-aid may be a good idea, but I would prefer not to see the conditional in a common source file like 'wrapper.c'. Somewhere MinGW-specific would be more appropriate, would it not?
The other justification I'd like to make in my patch is that the xsnprintf() calls die() and the trace2 machinery should be die()-free whenever possible. Solving both possible causes is likely the right long-term approach.
That is indeed worth considering. You mention a few calls to xstrdup() that can potentially abort, and I agree that anything that triggers malloc() and notices that we are out of memory can probably do little better than to die. But are there other operations that may cause us to exit, even though we are not in an unrecoverable state (such as an out-of-memory condition)? Thanks.