[BUG] git rev-list --missing=allow-promisor
- From
Andrew Olsen <andrew.olsen@koordinates.com>
- Date
- Aug 10, 2022, 21:33 UTC
- Message-ID
- <CAPJmHpVssKshapGYDF-ifU1fts-jFTC-HqxnjN8meSMP3weB4g@mail.gmail.com>
Steps to reproduce: 1. Create a git repository with missing+promised blobs. For example, I did this: git clone git@github.com:git/git.git git-no-blobs --filter=blob:none --depth=1 --bare
--filter=blob:none - don't fetch any blobs --depth=1 - we don't need git's entire history, just one commit is fine --bare - this avoids git fetching any blobs as part of the checkout operation
2. In this repository, run: git rev-list HEAD --objects --missing=allow-promisor
Expected outcome: git rev-list prints the paths and OIDs of all the objects
Actual outcome: Any of the following: a) git rev-list prints the paths and OIDs of all the objects b) git rev-list fails with "fatal: malformed mode in tree entry" c) git rev-list fails with "fatal: too-short tree object"
Diagnosis: With missing=allow-promisor, when git encounters a missing object, it calls is_promisor on it, which in turn calls add_promisor_object on lots of things. In this line in add_promisor_object, the buffer of the tree that we are currently traversing is freed: https://github.com/git/git/blob/master/packfile.c#L2242 This clearly causes problems but not in a deterministic way.