diff: avoid segfault with freed entries #835
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is also going upstream as part of gitgitgadget#2027.
However, I found out about this segfault due to a reproducible error happening in the 1JS monorepo's PR build pipelines. After trying to uncover a repro by adding tracing to my own fork and using that version within the pipeline, I was finally able to get a reproducer in a 1JS Codespace. Debugging with a locally-build version of Git helped me find the situation to fix this.
1JS has a workaround for this issue by running
git statusbefore the necessary build step that runs thegit diffcommand. That refresh of the index prevents the freed diff queue items, preventing the issue. This reduces the urgency somewhat, but I also don't know where else this could be impacting users.I'm recommending this version on top of the
vfs-2.52.0branch so we can get this fixed more quickly for an upcoming release of microsoft/git.