On Wed, May 08, 2024 at 12:05:49AM +0000, Derrick Stolee via GitGitGadget wrote: > From: Derrick Stolee <stolee@xxxxxxxxx> > > During the latest v2.45.0 update, 'scalar reconfigure --all' started to > segfault on my machine. Breaking it down via the debugger, it was > faulting on a NULL reference to the_hash_algo, which is a macro pointing > to the_repository->hash_algo. > > In my case, this is due to one of my repositories having a detached HEAD, > which requires get_oid_hex() to parse that the HEAD reference is valid. > Another way to cause a failure is to use the "includeIf.onbranch" config > key, which will lead to a BUG() statement. > > My first inclination was to try to refactor cmd_reconfigure() to execute > 'git for-each-repo' instead of this loop. In addition to the difficulty > of executing 'scalar reconfigure' within 'git for-each-repo', it would > be difficult to perform the clean-up logic for non-existent repos if we > relied on that child process. > > Instead, I chose to move the temporary repo to be within the loop and > reinstate the_repository to its old value after we are done performing > logic on the current array item. > > Add tests to t9210-scalar.sh to test 'scalar reconfigure --all' with > multiple registered repos. There are two different ways that the old > use of the_repository could trigger bugs. These issues are being solved > independently to be more careful about the_repository being > uninitialized, but the change in this patch around the use of > the_repository is still a good safety precaution. > > Co-authored-by: Patrick Steinhardt <ps@xxxxxx> > Signed-off-by: Patrick Steinhardt <ps@xxxxxx> > Signed-off-by: Derrick Stolee <stolee@xxxxxxxxx> Thanks, this version looks good to me! Patrick
Attachment:
signature.asc
Description: PGP signature