Skip to content
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

Add NoSameOwner option when unpacking tars #7386

Merged
merged 1 commit into from
Sep 10, 2022

Conversation

mxpv
Copy link
Member

@mxpv mxpv commented Sep 10, 2022

When unpacking a TAR archive, containerd preserves file's owner: https://github.com/containerd/containerd/blob/main/archive/tar.go#L384

In some cases this behavior is not desired. In current implementation we avoid Lchown on Windows. Another case when this should be skipped is when using native snapshotter on darwin and running as non-root user.

This PR extracts a generic option - WithNoSameOwner (same as tar --no-same-owner) to skip Lchown when its not required.

Signed-off-by: Maksym Pavlenko pavlenko.maksym@gmail.com

When unpacking a TAR archive, containerd preserves file's owner:
https://github.com/containerd/containerd/blob/main/archive/tar.go#L384

In some cases this behavior is not desired. In current implementation we
avoid `Lchown` on Windows. Another case when this should be skipped is
when using native snapshotter on darwin and running as non-root user.

This PR extracts a generic option - `WithNoSameOwner` (same as
`tar --no-same-owner`) to skip `Lchown` when its not required.

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
@dmcgowan dmcgowan added this to New in Code Review via automation Sep 10, 2022
@dmcgowan dmcgowan moved this from New to Ready For Review in Code Review Sep 10, 2022
@samuelkarp samuelkarp merged commit f4095a6 into containerd:main Sep 10, 2022
Code Review automation moved this from Ready For Review to Done Sep 10, 2022
@mxpv mxpv deleted the no-same-owner branch September 10, 2022 16:10
@@ -38,7 +38,7 @@ import (
"github.com/containerd/containerd/mount"
"github.com/containerd/containerd/platforms"
"github.com/containerd/containerd/plugin"
digest "github.com/opencontainers/go-digest"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@@ -27,7 +27,7 @@ import (
"io"
"time"

winio "github.com/Microsoft/go-winio"
"github.com/Microsoft/go-winio"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants