From 82e3080305d7b935991abdf0f9ede57826738806 Mon Sep 17 00:00:00 2001 From: Itxaka Date: Tue, 10 Dec 2024 16:15:30 +0100 Subject: [PATCH] Dont auto select default entry if tries are 0 Basically, an entry marked as "bad" should not be autochoosen no matter what, as the probability of it still being broken is high after retrying and exhausting the retries. Others should come first and assesment re-enabled after fixing it. Signed-off-by: Itxaka --- src/boot/boot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/boot/boot.c b/src/boot/boot.c index 4ef519d4040..759f0f9ea33 100644 --- a/src/boot/boot.c +++ b/src/boot/boot.c @@ -1783,13 +1783,13 @@ static void config_select_default_entry(Config *config) { assert(config); i = config_find_entry(config, config->entry_oneshot); - if (i != IDX_INVALID) { + if (i != IDX_INVALID || config->entries[i]->tries_left != 0) { config->idx_default = i; return; } i = config_find_entry(config, config->use_saved_entry_efivar ? config->entry_saved : config->entry_default_efivar); - if (i != IDX_INVALID) { + if (i != IDX_INVALID || config->entries[i]->tries_left != 0) { config->idx_default = i; config->idx_default_efivar = i; return; @@ -1800,14 +1800,14 @@ static void config_select_default_entry(Config *config) { i = config->use_saved_entry_efivar ? IDX_INVALID : config_find_entry(config, config->entry_saved); else i = config_find_entry(config, config->entry_default_config); - if (i != IDX_INVALID) { + if (i != IDX_INVALID || config->entries[i]->tries_left != 0) { config->idx_default = i; return; } /* select the first suitable entry */ for (i = 0; i < config->n_entries; i++) - if (config->entries[i]->type != LOADER_AUTO && !config->entries[i]->call) { + if (config->entries[i]->type != LOADER_AUTO && !config->entries[i]->call && config->entries[i]->tries_left != 0) { config->idx_default = i; return; }