From a059f9b2abc4c2f7eb9d3defb3b1468ec106e7c9 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. (cherry picked from commit 4301ad00ef715885be5c3bdf84c152030b7d36ff) (cherry picked from commit e67e5145675b1849a554aeab4a32badd7d260f9f) --- src/boot/boot.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/boot/boot.c b/src/boot/boot.c index 053a79dd460..570fb18ce21 100644 --- a/src/boot/boot.c +++ b/src/boot/boot.c @@ -1359,6 +1359,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->path = xstrdup16(path); @@ -1531,7 +1535,9 @@ static void boot_entry_add_type1( return; entry->device = device; - entry->id = xstrdup16(file); + + if (!entry->id) + entry->id = xstrdup16(file); strtolower16(entry->id); config_add_entry(config, entry); -- 2.47.3