Commit 4c3e68f
Fix: Avoid a hard panic and use a recoverable error instead
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>1 parent ed0da92 commit 4c3e68f
2 files changed
Lines changed: 56 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
460 | | - | |
461 | | - | |
| 460 | + | |
| 461 | + | |
462 | 462 | | |
463 | 463 | | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
464 | 472 | | |
465 | 473 | | |
466 | 474 | | |
| |||
474 | 482 | | |
475 | 483 | | |
476 | 484 | | |
477 | | - | |
| 485 | + | |
478 | 486 | | |
479 | 487 | | |
480 | 488 | | |
481 | 489 | | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
| 490 | + | |
486 | 491 | | |
487 | | - | |
| 492 | + | |
488 | 493 | | |
489 | 494 | | |
490 | 495 | | |
| |||
580 | 585 | | |
581 | 586 | | |
582 | 587 | | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
583 | 630 | | |
584 | 631 | | |
585 | 632 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
0 commit comments