-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
layer: clarify wording around applying changesets #317
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“removing the file” → “(recursively) removing the file”? Most of the discussion in the GNU docs you linked is for “folks would be mad if we blew away a full tree and replaced it with a broken symlink”. That makes sense for working filesystems, but we're building the rootfs from scratch here, so losing information is not a concern. However, you don't want folks blindly using
unlink
, having it fail because the target is a directory and either dying or leaving it in place. We do want them to get that old thing off the filesystem (whatever it takes ;), and the “(recursively)” hint may be enough to get that across.Or maybe it's sufficient as it stands :p.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open to adding "recursively" as long as that is actually what is expected here - @vbatts @stevvooe ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cannot act recursively. It must only act on the immediate resource. For example, a link should not be followed.
There are some ordering requirements for this to work correctly. Let's take the following directories from the applying layer:
/a/b
should probably come before/a/b/c
for this to work correctly. If/a/b/d
is encountered, it needs to be left alone, unless the layer above specifies a removal.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stevvooe what is supposed to happen if
/a/b/
is a directory and a changeset contains/a/b
as a file?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I supposed I missed the distinction here. I think we need to be clear that this is recursive only when the lstat (shallow) type of the resource is dir.
If
/a/b/...
exists, a non-directory entry/a/b
would cause removal, recursively. Further entries prefixed with an already encountered, non-directory entry, would be ignored or cause an error.If
/a/b/
exists and a new directory entries/a/b/...
are encountered, the result will be a union of the two directory trees, unless whiteouts apply.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's only not a recursive delete when both the existing entry (lstat) and tar entry are dirs. See the implementation in opencontainers/image-tools#42 for machine-readable phrasing.
Yes.
Already-encountered-ness has nothing to do with it. I think we should just unpack as we read through the tarball. Only the current
.wh.*
handling jumps the tar order, and the remove-before-unpacking behavior is for non-whiteout entries.This is true even without the “directory” limit on
/a/b/…
. If the filesystem has/a/b/c
and an/a/b/not-c
entry is found in the tarball, then the result will have both/a/b/c
and/a/b/not-c
. If an/a/b
entry is found in the tarball, then it's just a metadata clobber (the result will still have/a/b/c
).