-
Notifications
You must be signed in to change notification settings - Fork 231
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
Don't call UpdateLayerIDMap when creating a layer with no parent #1735
Conversation
I am fine with this change, I've tested it and seems to work well |
LGTM |
@mtrmac ready to go forward with this? |
Yes, I think this makes sense to merge. |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: giuseppe, mtrmac The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold |
@mtrmac do you want to change the commit message or do we keep the "RFC:" tag there? |
Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
AFAICS this call is intended to "remap" the parent layer's contents to the desired IDMappings; but when there is no parent layer, there is nothing to remap. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
585047e
to
58bb757
Compare
Oops, fixed the commit title. Thanks. |
/lgtm |
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
After containers/storage#1735 , we don't need the conditional, so remove it. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
After containers/storage#1735 , we don't need the condition, so remove it. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
After containers/storage#1735 , we don't need the condition, so remove it. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Warning: I don’t really know what I’m doing.
AFAICS this call is intended to "remap" the parent layer's contents to the desired IDMappings; but when there is no parent layer, there is nothing to remap.
Motivation: I’m trying to get c/image tests of c/storage working completely unprivileged.
On macOS that actually works out of the box (where some potentially relevant points are that after #811 ,
pkg/chrootarchive
does not chroot on Darwin, and thatpkg/idtools.SafeChown
does not really chown on Darwin).On Linux, the out-of-the-box setup starts initializing
vfs
by chowning to (0, 0), and that fails. There is some pre-existing code in https://github.com/containers/image/blob/6bf0d1f0ae6682a5dd9a9d07d41f78be160d4383/storage/storage_test.go#L69-L78 to avoid that by remapping (“user-to-current”), and that part seems to work on Linux…… but with the “user-to-current” ID maps, on macOS, layer creation fails of the first (no-parent) layer fails, because the current logic gets the ID map from the new layer from the store’s configuration (”user-to-current”), but defaults the ID map of the (nonexistent) parent to empty, sees a difference, and triggers
UpdateLayerIDMap
. And that tries to really chroot, and fails.(Ultimately, on Linux, layer extraction seems to always chroot, so I am failing with my overall goal. Anyway, this seems to be conceptually the right thing to do.)
So, this entirely avoids the
UpdateLayerIDMap
call. Again, warning: I don’t know what I’m doing.Some alternatives:
Store.PutLayer
sets the ID maps from its options; but the nonexistent-parent ID map is set to entirely empty. Instead,Store.PutLayer
could calllayerStore.create
with new options providing the store’s ID map to use as the nonexistent-parent ID map value. That would have the same effect, except thatlayerStore.create
would think there is a “parent ID map”. I think that’s more invasive, and conceptually a bit less correct (there is no parent, so there is no parent ID map at all).UpdateLayerIDMap
implementation should follow in steps of Limited support for operating on images on macOS #811 and not chroot, even if it is called.@nalind @giuseppe PTAL