Skip to content

archive: test chmod fallback without procfs in chroot - #105

Merged
vvoland merged 1 commit into
moby:mainfrom
thaJeztah:test_chrooted_chmod_fallback
Aug 4, 2026
Merged

vvoland merged 1 commit into
moby:mainfrom
thaJeztah:test_chrooted_chmod_fallback

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

Add a regression test that runs the chmod fallback after switching into a temporary root without procfs mounted.

This reproduces the environment used by chrootarchive, where resolving an O_PATH descriptor through /proc/self/fd is unavailable.

@codecov-commenter

codecov-commenter commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.17%. Comparing base (216738e) to head (3daca2a).
⚠️ Report is 76 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #105      +/-   ##
==========================================
- Coverage   65.81%   64.17%   -1.65%     
==========================================
  Files          42       44       +2     
  Lines        2039     3045    +1006     
==========================================
+ Hits         1342     1954     +612     
- Misses        519      877     +358     
- Partials      178      214      +36     

☔ 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.

Add a regression test that runs the chmod fallback after switching into a
temporary root without procfs mounted.

This reproduces the environment used by chrootarchive, where resolving an
O_PATH descriptor through /proc/self/fd is unavailable.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
thaJeztah force-pushed the test_chrooted_chmod_fallback branch from 8e3c767 to 3daca2a Compare August 4, 2026 17:20
@thaJeztah
thaJeztah marked this pull request as ready for review August 4, 2026 17:23
@thaJeztah

Copy link
Copy Markdown
Member Author

verified in the other PR; currently failing with that fix;

=== RUN   TestChmodNoSymlinkFallbackInChrootWithoutProc
    archive_linux_chrooted_test.go:75: assertion failed: error is not nil: chmod target-dir/target-file: via /proc/self/fd/7: no such file or directory
--- FAIL: TestChmodNoSymlinkFallbackInChrootWithoutProc (0.00s)

}
defer unix.Close(parentFD)

if err := chmodNoSymlinkFallback(parentFD, filepath.Base(name), name, 0o644); err != nil {

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.

For a follow up, we should consider reshaping the test suite so we run more cases in this setup

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.

Yeah, I think we should look at moving some of these components to an internal/ package, so that we can more easily re-use or differentiate the underlying components, instead of making chrootarchive just wrap the whole thing.

@vvoland
vvoland merged commit 9af1c40 into moby:main Aug 4, 2026
12 checks passed
@thaJeztah
thaJeztah deleted the test_chrooted_chmod_fallback branch August 4, 2026 17:29
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