Skip to content

archive: fix breakout error type assertions - #69

Merged
vvoland merged 1 commit into
moby:mainfrom
thaJeztah:better_breakouterror
Jul 22, 2026
Merged

archive: fix breakout error type assertions#69
vvoland merged 1 commit into
moby:mainfrom
thaJeztah:better_breakouterror

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

breakoutError was an interface alias, causing errors.As() to match any non-nil error instead of only archive breakout errors.

Replace it with a concrete wrapper type while preserving the existing breakoutError(err) helper.

Copilot AI review requested due to automatic review settings July 22, 2026 12:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@thaJeztah
thaJeztah force-pushed the better_breakouterror branch from 54214c1 to 93d8e8c Compare July 22, 2026 12:50
Copilot AI review requested due to automatic review settings July 22, 2026 12:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@thaJeztah

Copy link
Copy Markdown
Member Author

Ugh; looks like it's failing; genuine issue?

=== RUN   TestUntarInvalidFilenames
breakoutError: "../victim/dotdot" is outside of "/tmp/docker-TestUntarInvalidFilenames3988746858/dest"
    archive_test.go:715: i=1. chown /tmp/docker-TestUntarInvalidFilenames4151018550/dest/victim: operation not permitted
--- FAIL: TestUntarInvalidFilenames (0.00s)
=== RUN   TestApplyLayerInvalidFilenames
breakoutError: "../victim/dotdot" is outside of "/tmp/docker-TestApplyLayerInvalidFilenames3137305891/dest"
    diff_test.go:33: i=1. chown /tmp/docker-TestApplyLayerInvalidFilenames1340603028/dest/victim: operation not permitted
--- FAIL: TestApplyLayerInvalidFilenames (0.00s)
=== RUN   TestUntarInvalidFilenames
breakoutError: "../victim/dotdot" is outside of "/tmp/docker-TestUntarInvalidFilenames3988746858/dest"
    archive_test.go:715: i=1. chown /tmp/docker-TestUntarInvalidFilenames4151018550/dest/victim: operation not permitted
--- FAIL: TestUntarInvalidFilenames (0.00s)

Copilot AI review requested due to automatic review settings July 22, 2026 13:27
@thaJeztah
thaJeztah force-pushed the better_breakouterror branch from 93d8e8c to f0d2a95 Compare July 22, 2026 13:27

This comment was marked as off-topic.

@thaJeztah
thaJeztah marked this pull request as draft July 22, 2026 13:27
@thaJeztah
thaJeztah force-pushed the better_breakouterror branch from f0d2a95 to 010af54 Compare July 22, 2026 13:58
Copilot AI review requested due to automatic review settings July 22, 2026 13:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 22, 2026 14:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread archive.go Outdated
Comment on lines +958 to +963
// Avoid an unnecessary chown for the common non-remapped root-owned
// (0:0) case, where newly created implied directories are expected to
// already have the requested ownership.
if uid == 0 && gid == 0 {
return os.MkdirAll(parentPath, ImpliedDirectoryMode)
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

OK; that didn't work; user.MkdirAllAndChown does not only CHOWN, but also CHMOD implicitly, so skipping CHOWN also skips that, causing umask to be relevant again;

=== RUN   TestImpliedDirectoryPermissions
=== RUN   TestImpliedDirectoryPermissions/umask=022
=== RUN   TestImpliedDirectoryPermissions/umask=027
    archive_unix_test.go:118: assertion failed: -rwxr-x--- (fs.FileMode) != -rwxr-xr-x (expected fs.FileMode)
    archive_unix_test.go:119: assertion failed: -rwxr-x--- (fs.FileMode) != -rwxr-xr-x (expected fs.FileMode)
    archive_unix_test.go:120: assertion failed: -rwxr-x--- (fs.FileMode) != -rwxr-xr-x (expected fs.FileMode)
--- FAIL: TestImpliedDirectoryPermissions (0.00s)
    --- PASS: TestImpliedDirectoryPermissions/umask=022 (0.00s)
    --- FAIL: TestImpliedDirectoryPermissions/umask=027 (0.00s)

That makes the case stronger to re-design the API for moby/sys/user to allow those things being specified separately;

Copilot AI review requested due to automatic review settings July 22, 2026 14:51
@thaJeztah
thaJeztah force-pushed the better_breakouterror branch from 4bbd747 to 2cd5a3d Compare July 22, 2026 14:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 22, 2026 14:58
@thaJeztah
thaJeztah force-pushed the better_breakouterror branch from 2cd5a3d to a1cd8dd Compare July 22, 2026 14:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

breakoutError was an interface alias, causing errors.As() to match any
non-nil error instead of only archive breakout errors.

Replace it with a concrete wrapper type while preserving the existing
breakoutError(err) helper.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
thaJeztah force-pushed the better_breakouterror branch from a1cd8dd to fcf3799 Compare July 22, 2026 15:34
Copilot AI review requested due to automatic review settings July 22, 2026 15:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@thaJeztah
thaJeztah marked this pull request as ready for review July 22, 2026 15:34
@vvoland
vvoland merged commit deb5836 into moby:main Jul 22, 2026
12 checks passed
@thaJeztah
thaJeztah deleted the better_breakouterror branch July 22, 2026 16:20
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.96%. Comparing base (dd9eb37) to head (fcf3799).
⚠️ Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #69      +/-   ##
==========================================
+ Coverage   65.93%   65.96%   +0.03%     
==========================================
  Files          42       42              
  Lines        2037     2039       +2     
==========================================
+ Hits         1343     1345       +2     
  Misses        517      517              
  Partials      177      177              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

4 participants