Skip to content

Erofs counterparts - #385

Merged
Johan-Liebert1 merged 7 commits into
composefs:mainfrom
Johan-Liebert1:erofs-counterparts
Aug 31, 2026
Merged

Erofs counterparts#385
Johan-Liebert1 merged 7 commits into
composefs:mainfrom
Johan-Liebert1:erofs-counterparts

Conversation

@Johan-Liebert1

@Johan-Liebert1 Johan-Liebert1 commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

oci/repo: Add function to return EROFS counterparts

Add an extension trait to Repository which contains a single fuction
which receives an EROFS image's fsverity and returns the non-bootable
counterpart if the passed in image was a bootable one and vice-versa.

Traverses all oci image refs to find the image and its counterparts


cli: Add option to get erofs counterparts


Add tests for erofs-counterparts


This simplifies bootc-dev/bootc#2380

Comment thread crates/composefs-oci/src/oci_image.rs Outdated
Comment thread crates/composefs-oci/src/oci_image.rs Outdated
Comment thread crates/composefs-oci/src/oci_image.rs Outdated

@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.

Looks sane, though...I probably would have preferred exposing/reusing the existing APIs we already have to query images via varlink too, then we wouldn't need a new struct.

Comment thread crates/composefs-oci/src/oci_image.rs Outdated
Comment thread crates/composefs-oci/src/oci_image.rs Outdated
}
}

/// Extension trait that adds OCI EROFS counterpart lookups to [`Repository`].

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.

Wait why can't this just be part of the existing oci interface

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think it makes more sense to call this as repo.list_erofs_images. I'd've liked to had have this in the impl Repository itself, but that crate is stripped off of any oci features.

Also yeah, the can just be list_erofs_images(repo). I'll go with this since this matches the APIs we currently have

///
/// Returns an empty vec if `id` does not match any known EROFS
/// image ref in this image
pub fn linked_erofs_images(&self, id: &ObjectID) -> Vec<LinkedErofsImage<ObjectID>> {

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.

From a type system perspective I think Option<Vec1<...>> would be cleaner (yes another crate, but it's well maintained)

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.

Or since this is somewhat specialized anyways, it could just be default_image_from_bootable(id) -> Option<id>...

@Johan-Liebert1 Johan-Liebert1 Aug 27, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

From a type system perspective I think Option<Vec1<...>> would be cleaner

Someone could use this api to query whether an OCI image is linked to an erofs image or not, so Vec1 would not work out here

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.

Hmmmm wait do we ever have a use case for not generating an erofs image for an OCI?

cgwalters
cgwalters previously approved these changes Aug 27, 2026
pub xattr_mode: Option<XattrFiltering>,
}

impl<ObjectID: FsVerityHashValue> Serialize for LinkedErofsImage<ObjectID> {

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.

why the manual Serialize impl?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's mainly for the CLI command output, and id's serialization is just raw bytes

@cgwalters
cgwalters added this pull request to the merge queue Aug 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 27, 2026
@cgwalters
cgwalters added this pull request to the merge queue Aug 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 28, 2026
@Johan-Liebert1
Johan-Liebert1 added this pull request to the merge queue Aug 31, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 31, 2026
Add an extension trait to Repository which contains a single fuction
which receives an EROFS image's fsverity and returns the non-bootable
counterpart if the passed in image was a bootable one and vice-versa.

Traverses all oci image refs to find the image and its counterparts

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Generated by ClaudeCode

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
…tructs

Return LinkedErofsImage structs (with id, bootable, version, xattr_mode)
instead of raw ObjectIDs, and return all EROFS images linked to the same
OCI image rather than only the opposite-category counterparts.

Add has_erofs_id() and all_erofs_images() helpers on OciImage

Assisted-By: Claude Code (Opus)

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Following the format of other oci APIs, convert this to a function that
accepts a repository as a parameter

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Fix the following

```rust
error: using `chunks_exact` with a constant chunk size
   --> crates/composefs-ostree/src/delta.rs:578:22
    |
578 |                     .chunks_exact(OBJTYPE_CSUM_LEN)
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `as_chunks` instead: `as_chunks::<OBJTYPE_CSUM_LEN>().0.iter()`
```

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Symlink .filez objects in ostree archive-z2 repos contain only the
sized variant header with no compressed content after it.  The code
unconditionally wrapped the remaining file data in DeflateDecoder,
which works on zlib-ng-compat (Fedora) but fails with "incomplete
deflate stream" on standard zlib (Ubuntu CI) because an empty input
is not a valid deflate stream.

For LocalRepo, compare the header size against the file size and
return an empty reader when there is no remaining data.  For
RemoteRepo, check the parsed header mode for symlinks and skip
decompression entirely.

Assisted-by: AI

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
@Johan-Liebert1

Copy link
Copy Markdown
Collaborator Author

Fixed some CI errors

@Johan-Liebert1
Johan-Liebert1 added this pull request to the merge queue Aug 31, 2026
Merged via the queue into composefs:main with commit 6331b70 Aug 31, 2026
19 checks passed
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