Conversation
Two of the packfile tests build a small pack in memory and then point into it with byte offsets written as constants. Those constants only hold if zlib turns "Hello" into 17 bytes and "Hello!\n" into 19, which was true through Go 1.26. Go 1.27 breaks that. It writes these short inputs as a stored block, so each comes out one byte longer. The OFS_DELTA test then points one byte past the base object's header and lands on the zlib header byte, which decodes as an OBJ_REF_DELTA. The index lookup fails with "object not found in index" and the test panics on the nil object. The REF_DELTA test has the same problem with its index entry. Both values are now computed from len(compressed), so the tests stop depending on how many bytes the compressor emits. Tested with Go 1.25.0, 1.26.0 and 1.27.1.
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.
Two tests in pack/packfile_test.go fail under Go 1.27. I hit this
building the Debian package, where
TestPackObjectReturnsObjectWithDeltaBaseOffset panics with a nil
pointer dereference.
Both tests hardcode offsets that assume zlib compresses "Hello" to 17
bytes and "Hello!\n" to 19. Go 1.27 emits 18 and 20, so the offsets
land on the wrong bytes. This computes them from len(compressed)
instead.
go test ./...passes with Go 1.25.0, 1.26.0 and 1.27.1. CI onlycovers 1.25 and 1.26 right now, so it won't show the original failure.
Adding 1.27.x to the matrix could be a separate change.