Message ID | pull.1069.v3.git.1639575968.gitgitgadget@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | sparse-checkout: fix segfault on malformed patterns | expand |
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes: > This series fixes some issues with parsing sparse-checkout patterns when > core.sparseCheckoutCone is enabled but the sparse-checkout file itself > contains patterns that don't match the cone mode format. > > The first patch fixes a segfault first reported in [1]. The other two > patches are from an earlier submission [2] that never got picked up and I > lost track of. There was another patch involving 'git sparse-checkout init > --cone' that isn't necessary, especially with Elijah doing some work in that > space right now. Thanks. The segfault fix matters even more with Elijah's "we can flip between modes" feature, right? > [1] https://github.com/git-for-windows/git/issues/3498 [2] > https://lore.kernel.org/git/pull.1043.git.1632160658.gitgitgadget@gmail.com > > Thanks, -Stolee > > > Updates in v2 and v3 > ==================== > > * I intended to fix a typo in a patch, but accidentally sent the amend! > commit in v2 > * v3 has the typo fix properly squashed in. > * Added Elijah's review. > > Derrick Stolee (3): > sparse-checkout: fix segfault on malformed patterns > sparse-checkout: fix OOM error with mixed patterns > sparse-checkout: refuse to add to bad patterns > > builtin/sparse-checkout.c | 5 ++++- > dir.c | 5 +---- > t/t1091-sparse-checkout-builtin.sh | 31 +++++++++++++++++++++++++++++- > 3 files changed, 35 insertions(+), 6 deletions(-) > > > base-commit: abe6bb3905392d5eb6b01fa6e54d7e784e0522aa > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1069%2Fderrickstolee%2Fsparse-checkout%2Finput-bug-v3 > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1069/derrickstolee/sparse-checkout/input-bug-v3 > Pull-Request: https://github.com/gitgitgadget/git/pull/1069 > > Range-diff vs v2: > > 1: a0e3dd335c9 ! 1: 1744a26845f sparse-checkout: fix segfault on malformed patterns > @@ Commit message > there is additional logic that attempts to remove the line from the hashset > and free the data. This leads to a segfault in the 'git sparse-checkout > list' command because it iterates over the contents of the hashset, which is > - no invalid. > + now invalid. > > The fix here is to stop trying to remove from the hashset. Better to leave > bad data in the sparse-checkout matching logic (with a warning) than to > 2: 86fbf130c03 = 2: a2fe867222e sparse-checkout: fix OOM error with mixed patterns > 3: 5d096e380a4 = 3: a0e5a942ae0 sparse-checkout: refuse to add to bad patterns > 4: 7bacb3760f3 < -: ----------- amend! sparse-checkout: fix segfault on malformed patterns
On 12/15/2021 3:43 PM, Junio C Hamano wrote: > "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes: > >> This series fixes some issues with parsing sparse-checkout patterns when >> core.sparseCheckoutCone is enabled but the sparse-checkout file itself >> contains patterns that don't match the cone mode format. >> >> The first patch fixes a segfault first reported in [1]. The other two >> patches are from an earlier submission [2] that never got picked up and I >> lost track of. There was another patch involving 'git sparse-checkout init >> --cone' that isn't necessary, especially with Elijah doing some work in that >> space right now. > > Thanks. The segfault fix matters even more with Elijah's "we can > flip between modes" feature, right? Generally, I think segfaults are a higher priority, but this one is hard to find in the wild, I think. I'll send a v4 today and hopefully it makes it an easy decision for you. Thanks, -Stolee
Derrick Stolee <stolee@gmail.com> writes: >> Thanks. The segfault fix matters even more with Elijah's "we can >> flip between modes" feature, right? > > Generally, I think segfaults are a higher priority, but this one is hard > to find in the wild, I think. I'll send a v4 today and hopefully it makes > it an easy decision for you. I agree about the priority and I was assuming that the topics do not have semantic conflicts we cannot reconcile, but I do not offhand recall what the other topic did when there patterns unsuitable in the cone mode when transitioning to the cone mode (or vice-versa for that matter).