On Tue, Aug 25, 2026 at 01:34:53PM -0700, Junio C Hamano wrote: > "Derrick Stolee via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > > > From: Derrick Stolee <stolee@xxxxxxxxx> > > > > We have universally-banned functions listed in banned.h since > > c8af66ab8ad (automatically ban strcpy(), 2018年07月26日), but some layers of > > the code should be more strict than others. > > > > One such example is the trace2 API which runs during atexit() and can > > prove to cause die()-handler recursion problems if it calls die(). > > > > Create a new banned-die.h header file that will ban some Git methods > > that call die(). Include that in all trace2 API implementation files. > > This currently only bans die() itself, and that was already not used. > > > > It would be reasonable to name this file trace2/tr2_banned.h to be > > specific to the trace2 API, but it seems like such a restriction would > > be valuable to put in some other areas of the code, so adding it at the > > root of the tree seems like a good long-term approach. > > In other words, the functions banned by including this file are not > listed because they are banned from being used in trace2 API, but > because they may lead to die(). There may be some other traits that > we might want to avoid in certain subset of our code, and we may > have similar banned-frotz.h header to prevent direct or indirect use > of frotz. Which makes sense to me. > > Would the same approach work for the_hash_algo and the_repository, I > wonder? Don't we already do this? If `USE_THE_REPOSITORY_VARIABLE` is not defined then we hide several function declarations where we know that they depend on `the_repository`. It's not perfect as we still expose functions that do rely on it implicitly, but it's easy to remove more function declarations over time by just adding another ifdef. Maybe we should follow a similar approach with functions that die? Patrick