Skip to content

smart_pkt: parse object-format when it is the last capability - #7348

Open
DanConwayDev wants to merge 1 commit into
libgit2:mainfrom
DanConwayDev:fix/object-format-last-capability
Open

smart_pkt: parse object-format when it is the last capability#7348
DanConwayDev wants to merge 1 commit into
libgit2:mainfrom
DanConwayDev:fix/object-format-last-capability

Conversation

@DanConwayDev

Copy link
Copy Markdown
Contributor

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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant