Skip to content

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

Merged
thaJeztah merged 1 commit intomoby:masterfrom
corhere:best-effort-xattrs-classic-builder
Feb 22, 2024
Merged

builder/dockerfile: ADD with best-effort xattrs#47175
thaJeztah merged 1 commit intomoby:masterfrom
corhere:best-effort-xattrs-classic-builder

Conversation

@corhere
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 <[email protected]>
@corhere
Copy link
Copy Markdown
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
Copy Markdown
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

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.

6 participants