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

builder/dockerfile: ADD with best-effort xattrs #47175

Merged
merged 1 commit into from Feb 22, 2024

Conversation

corhere
Copy link
Contributor

@corhere corhere commented Jan 22, 2024

Archives being unpacked by Dockerfiles may have been created on other OSes with different conventions and semantics for xattrs, making them impossible to apply when extracting. Restore the old best-effort xattr behaviour users have come to depend on in the classic builder.

Buildkit will need to opt into best-effort xattr behaviour separately.

- What I did

- How I did it

- How to verify it
TODO regression test

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah
Copy link
Member

thaJeztah commented Jan 22, 2024

Thinking of this; I wonder if we're trying too much here. While we could copy these attributes; they may not be portable when pushing the image. ISTR there even was code that explicitly excludes xattrs (with a limited set of allowed ones) for portability 🤔 (but I'd have to dig where). So perhaps we shouldn't even do so; otherwise we may end up with attributes that are available locally, but that get discarded after pushing / pulling the image.

Here's some prior tickets / comments that seem relevant related to that;

@corhere
Copy link
Contributor Author

corhere commented Jan 22, 2024

We've been copying xattrs when ADDing a tarball for the past ten years, as far as I can tell. How is reverting to the existing pre-v25 behaviour "trying too much"?

@corhere corhere force-pushed the best-effort-xattrs-classic-builder branch from b647e79 to ab6d760 Compare January 22, 2024 23:12
Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

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

Doesn't this affect the pull flows as well (and load, import, build context transfer in legacy builer etc)? Does it make sense to add new WithBestEffortXattrs rather than just restoring the old xattr behavior.

Archives being unpacked by Dockerfiles may have been created on other
OSes with different conventions and semantics for xattrs, making them
impossible to apply when extracting. Restore the old best-effort xattr
behaviour users have come to depend on in the classic builder.

The (archive.Archiver).UntarPath function does not allow the options
passed to Untar to be customized. It also happens to be a trivial
wrapper around the Untar function. Inline the function body and add the
option.

Signed-off-by: Cory Snider <csnider@mirantis.com>
@corhere
Copy link
Contributor Author

corhere commented Feb 12, 2024

Adding a parameter—even a variadic one—is an API breaking change, and therefore would be unsuitable for backporting to v25. I'm going to rewrite this PR to not touch the pkg/archive API

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah thaJeztah merged commit 1ffaf46 into moby:master Feb 22, 2024
126 checks passed
@corhere corhere deleted the best-effort-xattrs-classic-builder branch February 22, 2024 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants