feat: add deterministic tarball extract and repack utility#223
Open
Tonisal-byte wants to merge 7 commits into
Open
feat: add deterministic tarball extract and repack utility#223Tonisal-byte wants to merge 7 commits into
Tonisal-byte wants to merge 7 commits into
Conversation
Add internal/utils/tarball package providing: - DetectCompression: detect archive compression from filename - Extract: decompress and extract tar archives (gzip, bzip2, xz, zstd) - RepackDeterministic: create byte-reproducible archives with pinned timestamps, zeroed owner/group, GNU format, and sorted entries - ResolveExtractRoot: find single top-level directory in extracted tree Designed for reproducible builds, matching the tar --sort=name --mtime=@0 --owner=0 --group=0 --format=gnu convention used by source modification scripts in the Azure Linux project.
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new internal/utils/tarball utility to extract and deterministically repack tar archives for reproducible builds.
Changes:
- Introduces deterministic repacking (stable ordering, fixed timestamps, zeroed ownership metadata) and multi-format compression handling.
- Adds extraction utilities with basic path traversal rejection and extract-root resolution.
- Adds Go tests covering compression detection, extract-root resolution, and a gzip extract/repack roundtrip.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| internal/utils/tarball/tarball.go | Implements tar extraction + deterministic repacking with compression helpers. |
| internal/utils/tarball/tarball_test.go | Adds unit tests for compression detection, extract-root logic, and gzip roundtrip determinism. |
Member
|
@Tonisal-byte -- I left some feedback on the instance of this in the other PR. My request would be not to duplicate the changes between the two, or leave the later ones in draft. I know GitHub stacked PRs will help with some of that, but for now it's hard to know which PR to leave feedback on which parts of the code. |
a5e505a to
d5d7c0f
Compare
| content = string(body) | ||
| } | ||
|
|
||
| entriesByName[header.Name] = entryInfo{header: header, content: content} |
Contributor
Author
There was a problem hiding this comment.
Same as above, going to ignore
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.
Adds a tarball utility package for deterministic extraction and repacking of source archives.
This is part 1 of 2 in the tarball overlay feature stack.