Keep unique linux assets based on content hash - #66
Conversation
1ec95b9 to
a64e3cf
Compare
|
Converting to draft as we finalize the exact convention for shipping conflicts as separate files. |
a64e3cf to
a62c550
Compare
a62c550 to
ce44791
Compare
ce44791 to
85cb794
Compare
ermo
left a comment
There was a problem hiding this comment.
Loving the snafu contexts.
Have a few questions related to the method that appears to be the load-bearing functionality, though. =)
| .insert(asset); | ||
| } | ||
|
|
||
| fn get_with_context<'b>( |
There was a problem hiding this comment.
| fn get_with_context<'b>( | |
| /// (explain why this is a clever way of doing things) | |
| fn get_with_context<'b>( |
| num_conflicts: 0, | ||
| conflict_index: 0, | ||
| }), | ||
| len => { |
There was a problem hiding this comment.
My brain is too stupid to understand what this does. Help?
There was a problem hiding this comment.
It's a catch-all pattern match which binds the value to that var. So anything not 0 or 1 will get caught by this as len var.
ae8d145 to
69ccfc2
Compare
|
@tarkah, this looks good to me except for one thing. Looking at what Since you're hashing them all up front now, when the copy detection pass runs through blsforme/blsforme/src/bootloader/systemd_boot/mod.rs Lines 277 to 283 in 63f8d31 files_identical():
blsforme/blsforme/src/file_utils.rs Lines 70 to 75 in 63f8d31
blsforme/blsforme/src/file_utils.rs Lines 41 to 60 in 63f8d31 I'm not sure if we're super worried about this, but that doubles the source I/O per boot sync, which depending on the system and how many states there are (the system I'm writing this on has 204 states), it could be negligible to several seconds anytime a successful |
69ccfc2 to
63d0d72
Compare
Yup, I am aware of this but I've purposely tried to minimize any alterations to the existing flows & logic. I think we can clean this up in a future wider refactor. The good news is we only ever pass in up to 5 states from moss and blake3 be pretty quick so I don't see this as much of a blocker currently. |
63d0d72 to
44114c7
Compare
44114c7 to
a2844d3
Compare
Resolves #64
This computes blake3 over all installable kernel files & ensures that "conflicts" (same file name / different hash) across entries get written out & linked so that we don't clobber a previous entry's assets w/ assets that have fundamentally changed within the same kernel version.
To ensure all conflicts get written out, we append a conflict id suffix to each file ONLY if conflicts exist. If no conflicts exist, the file has no suffix / looks as it did before.
The suffix is just a deterministic conflict id based on the stable sort of each conflicting assets blake3 hash -> its index into that conflict array. So rerunning will always produce the same suffix & linkage from the entry without leaking any implementation detail.
Test
I've clobbered my current state initrd with
echo "1" >> /usr/lib/kernel/7.1.5-46.stable/50-default.initrd. I have two states sharing this kernel version, so this should now produce 2 distinct assets & each entry should link to the correct one:Looks good!