Skip to content

overlayWhiteoutConverter: fixes and cleanups - #52

Merged
thaJeztah merged 3 commits into
moby:mainfrom
thaJeztah:cleanup_whiteout
Jul 20, 2026
Merged

overlayWhiteoutConverter: fixes and cleanups#52
thaJeztah merged 3 commits into
moby:mainfrom
thaJeztah:cleanup_whiteout

Conversation

@thaJeztah

@thaJeztah thaJeztah commented Jul 20, 2026

Copy link
Copy Markdown
Member

overlayWhiteoutConverter: fixes and cleanups

overlayWhiteoutConverter: store xattr name as field

Store xattr to use when constructing the converter based on whether
we're running with user-namespaces enabled.

overlayWhiteoutConverter.ConvertRead: minor cleanups

  • touch-up comments
  • explicitly return nil-error
  • use strings.CutPrefix instead of manually

overlayWhiteoutConverter.ConvertRead: reject malformed whiteout names

Rewrite to use a switch, and reject whiteout entries whose basename is
exactly ".wh." without a filepath.

Such entries do not identify a whiteout target and would otherwise result
in attempting a filesystem operation on the parent directory (or an empty
path), failing with a less informative filesystem error.

Also reject malformed entries whose target resolves to "." or "..". Archive
path traversal remains handled by Untar's normal path validation.

Store xattr to use when constructing the converter based on whether
we're running with user-namespaces enabled.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- touch-up comments
- explicitly return nil-error
- use strings.CutPrefix instead of manually

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@codecov-commenter

codecov-commenter commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.50%. Comparing base (2cd730e) to head (0a0e9fd).
⚠️ Report is 51 commits behind head on main.

Files with missing lines Patch % Lines
archive_linux.go 80.95% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #52      +/-   ##
==========================================
- Coverage   66.35%   65.50%   -0.85%     
==========================================
  Files          42       42              
  Lines        2027     2038      +11     
==========================================
- Hits         1345     1335      -10     
- Misses        497      531      +34     
+ Partials      185      172      -13     

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

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.

Pull request overview

This PR refines the Linux overlay whiteout conversion logic used during tar pack/unpack, making behavior safer and more explicit when encountering malformed or AUFS-internal whiteout entries.

Changes:

  • Introduces a constructor for overlayWhiteoutConverter that stores the selected opaque xattr name (trusted.overlay.opaque vs user.overlay.opaque) once.
  • Refactors ConvertRead into a switch, improving readability and explicitly returning nil errors on non-error paths.
  • Rejects malformed .wh. entries and ignores AUFS .wh..wh.plnk hardlink metadata so it isn’t mis-converted into an overlay whiteout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread archive_linux.go Outdated

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.

Pull request overview

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

Comment thread archive_linux.go
Comment thread archive_linux.go Outdated
Comment thread archive_linux.go Outdated
Rewrite to use a switch, and reject whiteout entries whose basename is
exactly ".wh." without a filepath.

Such entries do not identify a whiteout target and would otherwise result
in attempting a filesystem operation on the parent directory (or an empty
path), failing with a less informative filesystem error.

Also reject malformed entries whose target resolves to "." or "..".
Archive path traversal remains handled by Untar's normal path validation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
thaJeztah requested a review from Copilot July 20, 2026 12:16
@thaJeztah
thaJeztah marked this pull request as ready for review July 20, 2026 12:17

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.

Pull request overview

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

@thaJeztah
thaJeztah requested a review from vvoland July 20, 2026 13:10
@thaJeztah thaJeztah self-assigned this Jul 20, 2026
@thaJeztah
thaJeztah merged commit b0638ec into moby:main Jul 20, 2026
12 checks passed
@thaJeztah
thaJeztah deleted the cleanup_whiteout branch July 20, 2026 15:09
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