From dd35c2153bbff5d68c773b744be894a298d67746 Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Sat, 26 Sep 2026 18:13:38 -0700 Subject: [PATCH] fix(bls): skip unreadable or invalid BLS entries A single BLS entry that could not be read, was not valid UTF-8, or failed to parse aborted entry generation and therefore the whole boot, contrary to the generator's documented best-effort behavior. Log a warning and skip the entry instead. --- crates/boot/src/generators/bls.rs | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/crates/boot/src/generators/bls.rs b/crates/boot/src/generators/bls.rs index 2dbadb6..bf9bb8c 100644 --- a/crates/boot/src/generators/bls.rs +++ b/crates/boot/src/generators/bls.rs @@ -10,6 +10,7 @@ use anyhow::{Context, Result}; use core::{cmp::Ordering, str::FromStr}; use edera_sprout_bls::{BlsEntry, sort_bls}; use edera_sprout_config::generators::bls::BlsConfiguration; +use log::warn; use uefi::{ cstr16, fs::{FileSystem, PathBuf}, @@ -105,15 +106,33 @@ pub fn generate(context: Rc, bls: &BlsConfiguration) -> Result content, + Err(error) => { + warn!("unable to read bls entry {}: {}", name, error); + continue; + } + }; // Parse the entry file as a UTF-8 string. - let content = String::from_utf8(content).context("unable to read bls entry as utf8")?; + let content = match String::from_utf8(content) { + Ok(content) => content, + Err(error) => { + warn!("unable to read bls entry {} as utf8: {}", name, error); + continue; + } + }; // Parse the entry file as a BLS entry. - let entry = BlsEntry::from_str(&content).context("unable to parse bls entry")?; + let entry = match BlsEntry::from_str(&content) { + Ok(entry) => entry, + Err(error) => { + warn!("unable to parse bls entry {}: {}", name, error); + continue; + } + }; // Ignore entries that are not valid for Sprout. if !entry.is_valid() {