Fix: Avoid a hard panic and use a recoverable error instead#307
Merged
Conversation
Collaborator
|
Needs |
Issue: Arch Linux container build where pacman -Syu in a
downstream stage installs a newer kernel version
(with nativevmlinuz in /usr/lib/modules/<kver>/) but no
corresponding initramfs.
UsrLibModulesVmlinuz::load_all calls self.initramfs.unwrap() which
panics instead of returning an error when a kernel directory has
vmlinuz but no initramfs
fix: change unwrap() to ok_or_else(|| anyhow!("no initramfs for
kernel {kver}")) and propagate
Two tests:
- test_into_type1_with_initramfs — verifies the right path produces
entries with the correct vmlinuz and initramfs
- test_into_type1_without_initramfs_returns_error — verifies None
initramfs returns an error containing "no initramfs" rather than
panic
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
auto-merge was automatically disabled
June 5, 2026 05:44
Head branch was pushed to by a user without write access
f7470e4 to
0857e8b
Compare
Johan-Liebert1
approved these changes
Jun 5, 2026
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.
Issue: Arch Linux container build where pacman -Syu in a downstream stage installs a newer kernel version
(with nativevmlinuz in
/usr/lib/modules/<kver>/) but no correspondinginitramfs.UsrLibModulesVmlinuz::load_allcallsself.initramfs.unwrap()which panics instead of returning an error when a kernel directory has vmlinuz but no initramfsfix: change
unwrap()took_or_else(|| anyhow!("no initramfs for kernel {kver}"))and propagateTwo tests:
test_into_type1_with_initramfs— verifies the right path produces entries with the correct vmlinuz and initramfstest_into_type1_without_initramfs_returns_error— verifies None initramfs returns an error containing "no initramfs" rather than panic