Skip to content

fix: ensure archive dir is copied deterministically - #301

Merged
Tonisal-byte merged 3 commits into
microsoft:mainfrom
Tonisal-byte:asalinas/deterministic-archive-fix
Jul 28, 2026
Merged

fix: ensure archive dir is copied deterministically#301
Tonisal-byte merged 3 commits into
microsoft:mainfrom
Tonisal-byte:asalinas/deterministic-archive-fix

Conversation

@Tonisal-byte

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 28, 2026 16:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MkdirAll calls during extraction with an ensureDirectory helper that tracks and later restores deterministic modes for implicitly-created directories.
  • Explicitly Chmod extracted 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.

Copilot AI review requested due to automatic review settings July 28, 2026 17:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Comment thread internal/utils/archive/archive.go Outdated
Copilot AI review requested due to automatic review settings July 28, 2026 20:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@@ -0,0 +1,76 @@
// Copyright (c) Microsoft Corporation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: file name doesn't make a lot of sense.

@Tonisal-byte
Tonisal-byte merged commit 4042732 into microsoft:main Jul 28, 2026
19 checks passed
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.

3 participants