Skip to content

Add repr(c) for SplitStream header structs#266

Merged
cgwalters merged 1 commit intocomposefs:mainfrom
Johan-Liebert1:repr-c
Mar 17, 2026
Merged

Add repr(c) for SplitStream header structs#266
cgwalters merged 1 commit intocomposefs:mainfrom
Johan-Liebert1:repr-c

Conversation

@Johan-Liebert1
Copy link
Collaborator

While trying out #263 locally, I found that Rust is rearranging the SplitStreamHeader struct's fields to the following

[32, 0, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0,
83, 112, 108, 105, 116, 83, 116, 114, 101, 97, 109, 0, 2, 12]

The first two U64 are the start and end of the field info when info is the last field in the struct; then comes the flags which is the third field...

We probably don't want this undeterministic behaviour, which might also change from arch to arch

While trying out composefs#263
locally, I found that Rust is rearranging the SplitStreamHeader
struct's fields to the following

```
[32, 0, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0,
83, 112, 108, 105, 116, 83, 116, 114, 101, 97, 109, 0, 2, 12]
```

The first two U64 are the start and end of the field `info` when `info`
is the last field in the struct; then comes the flags which is the third
field...

We probably don't want this undeterministic behaviour, which might also
change from arch to arch

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

This has the very unfortunate effect of breaking any previously created repos

@cgwalters
Copy link
Collaborator

We probably don't want this undeterministic behaviour, which might also change from arch to arch

Yes...though... per https://docs.rs/zerocopy/latest/zerocopy/derive.IntoBytes.html while we clearly should have been using #[repr(C)], it's not clear to me if it's actually defined or not

@cgwalters
Copy link
Collaborator

OK I think #263 is also format breaking (will verify).

My 2c is let's change bootc to detect this case and fall back to re-fetching the image?

@cgwalters
Copy link
Collaborator

I also have a pending PR for #181 so basically - detect meta.json and if not fall back to re-fetch?

@cgwalters cgwalters added this pull request to the merge queue Mar 17, 2026
Merged via the queue into composefs:main with commit b7dc270 Mar 17, 2026
20 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