smart_pkt: parse object-format when it is the last capability - #7348
Open
DanConwayDev wants to merge 1 commit into
Open
smart_pkt: parse object-format when it is the last capability#7348DanConwayDev wants to merge 1 commit into
DanConwayDev wants to merge 1 commit into
Conversation
set_data assumed a space or NUL follows an object-format capability value and hit `GIT_ASSERT(eos)` otherwise, surfacing to users as "unrecoverable internal error: 'eos'". Some servers (e.g. tangled.org) advertise object-format as the final capability with nothing after it; git parses such advertisements fine. Treat a trailing newline or the end of the pkt-line as valid terminators for the object-format value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a ref advertisement lists object-format=... as the final capability with no trailing space or NUL, set_data fails GIT_ASSERT(eos) and the operation errors with unrecoverable internal error: 'eos'. Some servers (e.g. tangled.org) advertise this shape; git parses it fine. A newline-terminated advertisement ending in object-format=... hits the same assert, so this isn't specific to one server. Reproduces on main and v1.9.
Treat a trailing newline or the end of the pkt-line as valid terminators for the object-format value, and add regression tests covering each terminator variant. The new tests fail on unpatched main with the 'eos' assert and pass with this change.
Context: this broke pushes for users of ngit, a libgit2-based git remote helper so I added a fallback to use git for this operation until this is fixed. See https://gitworkshop.dev/nevent1qqsfamrgatjyyxgdquvsykfw9plgq3yhnk2a6qfg3y20xw6p2whxpnqpz3mhxue69uhhyetvv9ujumn8d96zuer9wcccnyv5