composefs/bls: Properly reuse kernel + initrd duplicates#1796
Merged
cgwalters merged 1 commit intobootc-dev:mainfrom Nov 21, 2025
Merged
composefs/bls: Properly reuse kernel + initrd duplicates#1796cgwalters merged 1 commit intobootc-dev:mainfrom
cgwalters merged 1 commit intobootc-dev:mainfrom
Conversation
Function `find_vmlinuz_initrd_duplicates` returns all the deployment ids that match the current deployment's kernel + initrd SHA256 sum, but only would actually exist on disk, every other deployment's BLS Config would simply be pointing to one single directory. We were incorrectly picking the first entry out of the returned list, which might or might not exist as an actual directory containing the kernel. Fix the bug by iterating over all directory entries in `/boot` or `/EFI/Linux` and checking if the deployment id in the list actually exists on the disk or not Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request correctly fixes a bug where duplicate kernel/initrd entries were not handled properly, by ensuring that the code now verifies the existence of a deployment directory on disk before using it. The logic is sound. I've added one suggestion to refactor a block of code to be more idiomatic and improve readability by using a closure.
cgwalters
approved these changes
Nov 21, 2025
Collaborator
cgwalters
left a comment
There was a problem hiding this comment.
Looks sane, though I didn't do a deeper analysis. This one clearly wants a test case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Function
find_vmlinuz_initrd_duplicatesreturns all the deployment ids that match the current deployment's kernel + initrd SHA256 sum, but only would actually exist on disk, every other deployment's BLS Config would simply be pointing to one single directory.We were incorrectly picking the first entry out of the returned list, which might or might not exist as an actual directory containing the kernel.
Fix the bug by iterating over all directory entries in
/bootor/EFI/Linuxand checking if the deployment id in the list actually exists on the disk or not