This repository has been archived by the owner on Jun 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 116
Properly handle opaque whiteout entries in layer flattener #110
Open
JoshRosen
wants to merge
5
commits into
google:master
Choose a base branch
from
JoshRosen:handle-opaque-whiteouts-in-flattener
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Properly handle opaque whiteout entries in layer flattener #110
JoshRosen
wants to merge
5
commits into
google:master
from
JoshRosen:handle-opaque-whiteouts-in-flattener
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
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
JoshRosen
force-pushed
the
handle-opaque-whiteouts-in-flattener
branch
from
September 22, 2018 07:18
7ea40dc
to
8e4699d
Compare
JoshRosen
force-pushed
the
handle-opaque-whiteouts-in-flattener
branch
from
September 22, 2018 07:19
8e4699d
to
496d266
Compare
I consider this a work-in-progress until the following TODOs and questions are resolved:
|
JoshRosen
changed the title
Properly handle opaque whiteout entries in flattener
Properly handle opaque whiteout entries in Docker image layer flattener
Sep 24, 2018
JoshRosen
changed the title
Properly handle opaque whiteout entries in Docker image layer flattener
Properly handle opaque whiteout entries in layer flattener
Sep 24, 2018
JoshRosen
added a commit
to databricks/containerregistry
that referenced
this pull request
Sep 24, 2018
…flattener Flattened version of upstream PR google#110
I signed it! |
CLAs look good, thanks! |
@KaylaNguyen, do you have any time to take a look at this? We ran into this bug again the other day. |
Bump on this PR |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR fixes a bug in the flattener's handling of layers with opaque whiteout entries (
.wh..wh..opq
files). This bug could lead to deleted files re-appearing in flattened output.Bug symptoms
According to the OCI spec on whiteouts:
The existing flattening logic does not take these files into account, leading to weird anomalies when flattening images where directories are deleted in lower layers and re-created in higher layers. As an example, imagine that I have a Dockerfile which looks something like this:
Per the spec, these filesystem changes can be represented via the following tar layers:
and
The expected flattened layer output is
The current flattening implementation does not respect the
.wh..wh..opq
file, so the flattened output incorrectly contains both the old and new files:Handling of opaque whiteout files seems to be a problem for other projects, too; see sylabs/singularity#1962 and moby/moby#34300, for example.
Solution
This PR addresses this problem by modifying the client v2.2's flattening function to properly account for opaque whiteout files. The flattener now tracks the set of directories in higher layers which have opaque whiteouts.
Testing
I added a new unit test suite
client_v2_2
and wrote tests for theextract()
flattening function.