From b4e765279bee6ba3449380b04a6f6ceed0225f6f Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Sat, 26 Sep 2026 20:17:22 -0700 Subject: [PATCH] fix(autoconfigure): don't treat an empty BLS entries directory as BLS BLS was detected when reading \loader\entries produced any item, but a FAT directory always lists "." first, so an empty entries directory counted as having entries. On an ESP with a leftover empty entries directory, Linux autoconfiguration was skipped and no Linux entries were shown. Only count the directory when it has a .conf file. --- crates/boot/src/autoconfigure/bls.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/crates/boot/src/autoconfigure/bls.rs b/crates/boot/src/autoconfigure/bls.rs index 3a45871..f321b41 100644 --- a/crates/boot/src/autoconfigure/bls.rs +++ b/crates/boot/src/autoconfigure/bls.rs @@ -46,12 +46,22 @@ pub fn scan( .context("unable to check for BLS loader.conf file")?; // Whether we have an entries directory. - // We actually iterate the entries to see if there are any. + // We actually iterate the entries to see if there are any entry files, as the + // directory itself always has the "." and ".." items, even when it is empty. let has_entries_dir = filesystem .read_dir(bls_entries_path) - .ok() - .and_then(|mut iterator| iterator.next()) - .map(|entry| entry.is_ok()) + .map(|mut iterator| { + iterator.any(|entry| { + entry.is_ok_and(|entry| { + entry.is_regular_file() + && entry + .file_name() + .to_string() + .to_lowercase() + .ends_with(".conf") + }) + }) + }) .unwrap_or(false); // Detect if a BLS supported configuration is on this filesystem.