fix: ensure archive dir is copied deterministically - #301
Merged
Tonisal-byte merged 3 commits intoJul 28, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves reproducibility when extracting and repacking archives by making directory and file permissions deterministic (independent of the host process umask), which helps ensure byte-for-byte stable repacked outputs.
Changes:
- Replace
MkdirAllcalls during extraction with anensureDirectoryhelper that tracks and later restores deterministic modes for implicitly-created directories. - Explicitly
Chmodextracted regular files after creation to restore archived permission bits (avoiding umask-induced differences). - Add regression tests to validate determinism across
GOMAXPROCS(zstd) and restrictive umask (Linux).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/utils/archive/archive.go | Ensures implicit directories and extracted files end up with deterministic permission bits regardless of umask. |
| internal/utils/archive/archive_test.go | Adds a regression test asserting zstd deterministic output doesn’t vary with GOMAXPROCS; enhances tar fixture helper to support per-entry modes. |
| internal/utils/archive/archive_linux_test.go | Adds a Linux-only regression test asserting extraction/repack output is independent of process umask and that modes are preserved. |
Tonisal-byte
force-pushed
the
asalinas/deterministic-archive-fix
branch
from
July 28, 2026 17:04
2d405b7 to
c090df8
Compare
dmcilvaney
reviewed
Jul 28, 2026
dmcilvaney
reviewed
Jul 28, 2026
| @@ -0,0 +1,76 @@ | |||
| // Copyright (c) Microsoft Corporation. | |||
Contributor
There was a problem hiding this comment.
nit: file name doesn't make a lot of sense.
dmcilvaney
approved these changes
Jul 28, 2026
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.
No description provided.