Repository navigation
fix(initrd): make file mount merges atomic and reject conflicts - #1194
Open
shubhamrai9122-creator wants to merge 1 commit into
Open
shubhamrai9122-creator wants to merge 1 commit into
shubhamrai9122-creator wants to merge 1 commit into
Conversation
MergeFileMountsIntoInitrd truncated the initrd at its trailer before writing any new record, so a failed merge left the archive without a trailer and restarting the same container failed too. Write the merged archive to a temporary file next to the initrd and rename it over the initrd on success, keeping the owner and mode of the initrd. Destinations were also not checked against the existing entries. A file below a regular file, or a file over a directory, merged successfully and the guest only failed at boot. Record the type of each entry while inspecting the archive and reject these destinations with a clear error. Symlinks are still accepted as parents, since they may point at a directory. Fixes: urunc-dev#1107 Signed-off-by: Shubham Kumar <shubhamrai9122@gmail.com>
✅ Deploy Preview for urunc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This branch has not been deployed
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.
Description
MergeFileMountsIntoInitrdnow writes the merged archive to a temporary file next to the initrd and renames it over the initrd on success, keeping its owner and mode. A failed merge leaves the initrd untouched.It also rejects a file below a regular file, or a file over a directory, with a clear error instead of letting the guest fail at boot. Symlinks are still accepted as parents because they may point at a directory.
TestMergeFileMountsIntoInitrdasserted that the initrd stayed the same file. I removed that assertion because the issue asks for a rename.Related issues
How was this tested?
In a
golang:1.27Linux container on arm64:go test ./pkg/unikontainers/initrd/passes as root and as a non-root user.main.go test ./pkg/unikontainers/passes as a non-root user. As root,TestCopyFileandTestMoveFilefail, but they fail the same way onmain.golangci-lintv2.15, the version CI uses, reports 0 issues for./pkg/unikontainers/initrd/....make lintuses a v2.9 image that can't load this Go version, so I ran v2.15 directly.I didn't run the e2e tests because they need a Linux host with containerd and the hypervisors installed.
LLM usage
Claude Opus 5.5 (
claude-opus-5-5) assisted with the code, the tests and this description.Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).