-
Notifications
You must be signed in to change notification settings - Fork 100
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
oci: tar extract: full opaque whiteout support #229
Merged
Merged
Conversation
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
We can handle generating opaque whiteouts in the future (because we technically shouldn't be generating them). |
24d9b2f
to
a65367b
Compare
The OCI specification makes it clear that we MUST NOT allow users to have a rootfs that contains '.wh.'-prefixed files. While we cannot prevent them from creating such a rootfs, we can abort when we see it. Also add a test to ensure that this doesn't regress. In addition we error out if we see opaque whiteouts. This is a temporary patch in this series, and will be replaced with full opaque whiteout support in a future commit. Signed-off-by: Aleksa Sarai <[email protected]>
The previous clobbering code was overly complicated and duplicated. While this is technically a no-op change, it makes it clearer what the clobbering semantics actually are (everything gets clobbered except previously-directories that will remain a directory after the extraction). Signed-off-by: Aleksa Sarai <[email protected]>
Rather than looping over Readdirnames, just get them all in the first place. The Go stdlib appears to use both the "get all" and "get some" interfaces of Readdirnames for similar operations (RemoveAll and Walk respectively). It doesn't make sense to use different operations, as they also make the implementation seem more complicated than necessary. Also refactor out the Readdirnames code so that it can be used by Walk in a future patch. Signed-off-by: Aleksa Sarai <[email protected]>
This adds a filepath.Walk implementation to unpriv, that works unprivileged. At the moment the WalkFunc is Wrap'd internally, though this results in the function being called more than once if there's a permission error. This might not be ideal for all users, but it is more transparent I guess? Also add Walk to the fseval interfaces so we can use Walk in oci/layer for the purposes of handling opaque whiteouts. Signed-off-by: Aleksa Sarai <[email protected]>
a65367b
to
b3e56ca
Compare
Add full opaque whiteout support, including the handling of new files present in the upper layer (and thus should not be removed). The code implementing this is fairly fragile and has to deal with a lot of really annoying edge cases, so many new tests were added for this portion. There are a few semantics differences found between unpriv.Walk and filepath.Walk by this patch (especially when it comes to handling ENOENT during the walk). These semantics have been fixed in the WalkFunc used, but probably deserve a refactor in future. Signed-off-by: Aleksa Sarai <[email protected]>
b3e56ca
to
08da5c6
Compare
LGTM. |
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.
Add full opaque whiteout support, including the handling of new files
present in the upper layer (and thus should not be removed). The code
implementing this is fairly fragile and has to deal with a lot of really
annoying edge cases, so many new tests were added for this portion.
There are a few semantics differences found between unpriv.Walk and
filepath.Walk by this patch (especially when it comes to handling ENOENT
during the walk). These semantics have been fixed in the WalkFunc used,
but probably deserve a refactor in future.
Closes #224
Signed-off-by: Aleksa Sarai [email protected]