From 4301ad00ef715885be5c3bdf84c152030b7d36ff Mon Sep 17 00:00:00 2001 From: Danilo Spinella Date: Thu, 11 Sep 2025 10:51:27 +0200 Subject: [PATCH] boot: Strip boot counter from entry id When boot counter is found in the boot entry filename, strip it from the id to match bootctl id. Fixes #38813. --- src/boot/boot.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/boot/boot.c b/src/boot/boot.c index e1119589c90..eabfd6b6b2e 100644 --- a/src/boot/boot.c +++ b/src/boot/boot.c @@ -1165,6 +1165,10 @@ static void boot_entry_parse_tries( if (!strcaseeq16(counter, suffix)) return; + entry->id = xasprintf("%.*ls%ls", + (int) prefix_len - 1, + file, + suffix); entry->tries_left = tries_left; entry->tries_done = tries_done; entry->directory = xstrdup16(directory); @@ -1395,13 +1399,16 @@ static void boot_entry_add_type1( } entry->device = device; - entry->id = xstrdup16(file); - strtolower16(entry->id); - - config_add_entry(config, entry); if (path) boot_entry_parse_tries(entry, path, file, u".conf"); + + if (!entry->id) + entry->id = xstrdup16(file); + + strtolower16(entry->id); + + config_add_entry(config, entry); TAKE_PTR(entry); } -- 2.47.3