Skip to content

wip: zstd:chunked support via oci-client - #137

Draft
allisonkarlitskaya wants to merge 2 commits into
composefs:mainfrom
allisonkarlitskaya:zstd-chunked
Draft

wip: zstd:chunked support via oci-client#137
allisonkarlitskaya wants to merge 2 commits into
composefs:mainfrom
allisonkarlitskaya:zstd-chunked

Conversation

@allisonkarlitskaya

Copy link
Copy Markdown
Collaborator

No description provided.

This code pulls images via containers-image-proxy-rs (which is a
wrapper around skopeo).  It's a bit too large to have it in the
top-level lib.rs, and we're about to add an alternate implementation, so
split it out.

We keep a pull() function in place for compatibility reasons to avoid
needing to update all callers: we will start using this function to
dispatch to the correct implementation depending on the reference
format.

Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
This is based on the "pull" example in the zstd-chunked-rs repository.

Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
@cgwalters

Copy link
Copy Markdown
Collaborator

There's some cool code here, and I think it's really useful actually to have this as an option even if it's hidden/experimental just to use as a comparison.

The main issue is really c/image (the important part of skopeo here) vs oci-client as expanded on in https://github.com/containers/containers-image-proxy-rs/?tab=readme-ov-file#why and it's for that reason I can't imagine using this by default in bootc at least anytime in the nearly visible future. Things like ECR credential helpers are highly load bearing. OTOH, other folks could reasonably make other choices.

@allisonkarlitskaya

Copy link
Copy Markdown
Collaborator Author

Ya. My first instinct is to stick this behind a feature flag (and maybe also do the same with the skopeo and potential-future-oci-dir paths)... it could be useful for the kind of scenario where we don't need the skopeo features.

In terms of those features, I feel like:

  • depending on the registry alias stuff for use-cases like bootc is probably not a reasonable best practice anyway
  • the auth stuff is hard, but also not required by a large number of our existing users
  • signing is a whole other conversation: if we want to do things like validation of the images we mount based on container signatures we're going to need support for this in the higher layers anyway so we can check it at runtime.

I feel like we could maybe close some of these gaps by adding some code to skopeo to do the work of resolving registry aliases, taking care of the initial authentication, etc. and call out to that.

I'm also sort of of the (optimistic) opinion that maybe we can have a Rust-based stack for all of this stuff at some point, and honestly, the sooner the better... and although this piece of code here leaves a lot of the other questions unanswered, it's maybe one part of moving towards a world where we could image a feasible solution to that puzzle...

@cgwalters cgwalters left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The first commit here though seems sane to me, let's split it into its own PR and get it in?

@allisonkarlitskaya

Copy link
Copy Markdown
Collaborator Author

The first commit here though seems sane to me, let's split it into its own PR and get it in?

#138

@allisonkarlitskaya

Copy link
Copy Markdown
Collaborator Author

So the biggest unanswered question here is what to do about the sha256-to-fsverity mapping. It's currently stored as raw sha256:abc123 -> symlinks directly in the objects directory, but that's fairly clearly not intended to stay.

My initial impulse was to store symlinks in the repository, but: this is just about the worst possible thing we can do. There's no actual benefit to being able to follow sha256 symlinks into the object files and this is only used for zstd:chunked. I'd actually prefer something more like an sqlite database storing sha256->fs-verity mappings. Also: it might make sense to store that in /var/cache or ~/.cache instead of directly in the repository.

@alexlarsson is currently trying to solve a very similar issue for the ostree mapping...

chaserhkj added a commit to chaserhkj/containers that referenced this pull request Jan 5, 2026
andrewdunndev added a commit to andrewdunndev/composefs-rs that referenced this pull request Aug 26, 2026
zstd:chunked layers are multi-frame zstd streams (one frame per chunk,
plus skippable framing metadata), and gzip layers may legally contain
multiple members. The decoders stop at the first frame or member
boundary, so such layers import a truncated tar and fail with
"unexpected EOF reading tar entry" (bootc-dev/bootc#2408).

Enable multiple_members(true) on both decoders so the full stream
decodes; libzstd skips skippable frames natively at any position. This
is full-pull correctness only: nothing exploits the chunked TOC for
partial pulls, which remains composefs#137.

Raise the async-compression floor to 0.4.43, which fixed an infinite
loop on a corrupt later frame with multiple_members enabled
(Nullus157/async-compression#470); older versions could hang on a
malformed blob once the flag is on.

Generated-by: AI
Signed-off-by: Andrew Dunn <andrew@dunn.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants