fix(archive): handle whiteout ancestors during root path resolution - #38
Open
dinoallo wants to merge 1 commit into
Open
fix(archive): handle whiteout ancestors during root path resolution#38dinoallo wants to merge 1 commit into
dinoallo wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens archive.Apply (naive tar apply) against overlay/OCI whiteout edge cases where non-directory ancestors (notably overlay whiteout character devices) can cause fs.RootPath or metadata replay to fail, and adds regression coverage for those scenarios.
Changes:
- Add
rootPathReplacingWhiteoutAncestorto retryfs.RootPathafter detecting and replacing an overlay whiteout ancestor viamkparent. - Make directory mtime replay tolerant of directories that no longer exist / are no longer directories, and ignore
ENOTDIRwhen copying lower-parent directory attributes. - Add Linux tests covering whiteout ancestors, delayed mtime replay with removal, and lower-parent
ENOTDIRhandling.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
archive/tar.go |
Adjust root path resolution and parent creation logic to handle overlay whiteout ancestors and tolerate ENOENT/ENOTDIR during delayed metadata replay / lower-parent attribute copy. |
archive/tar_linux_test.go |
Add regression tests for removed-directory mtime replay and lower-parent ENOTDIR behavior (plus existing overlay whiteout ancestor coverage). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
317
to
331
| for _, hdr := range dirs { | ||
| path, err := fs.RootPath(root, hdr.Name) | ||
| if err != nil { | ||
| if isNotExistOrNotDir(err) { | ||
| continue | ||
| } | ||
| return 0, err | ||
| } | ||
| if err := chtimes(path, boundTime(latestTime(hdr.AccessTime, hdr.ModTime)), boundTime(hdr.ModTime)); err != nil { | ||
| if isNotExistOrNotDir(err) { | ||
| continue | ||
| } | ||
| return 0, err | ||
| } | ||
| } |
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.
Background
Archive apply can still fail with ENOTDIR when the destination already contains an overlay whiteout ancestor.
fs.RootPathresolves parent paths beforemkparentruns, so a path like.vscode-server/clican fail while.vscode-serveris still ac 0,0whiteout.Changes
Risks / Notes
Only overlay whiteout character devices are replaced. Regular files, symlinks, and non-whiteout device nodes remain non-directory parents and continue to fail.