Skip to contentSkip to conversation

blsuki: fix misc comments/issues

PATCH Superseded Radoslav Kolev via Grub-devel 2 participants 7 messages Nov 21, 2025 – Nov 22, 2025

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover blsuki: fix misc comments/issues

A number of small fixes to comments/description in the blsuki command. Also add a check that no arguments are supplied (none are expecded) and if any are found display an error instead of ignoring them silently.

The only change in behaviour is in the fallback case for blscfg, where currently it also falls back to the device pointed by $root, even if another one was specified via the -p option.

Radoslav Kolev (5):
blsuki: fix typo in entry parameter description
blsuki: fix blscfg command summary
blsuki: use specified device in case of fallback
blsuki: fix default location in commment to /loader/entries
blsuki: error out if unexpected arguments are supplied

 grub-core/commands/blsuki.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
Signature · 7 lines
2.51.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw

PATCH 1/5 blsuki: fix typo in entry parameter description

---
 grub-core/commands/blsuki.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/commands/blsuki.c +1 -1
index d089dec62..8837e11c9 100644
@@ -88,7 +88,7 @@ static const struct grub_arg_option uki_opt[] =
     {"enable-fallback", 'f', 0, "Fallback to the default BLS path if --path fails to find UKI entries.", 0, ARG_TYPE_NONE},
     {"show-default", 'd', 0, N_("Allow the default UKI entry to be added to the GRUB menu."), 0, ARG_TYPE_NONE},
     {"show-non-default", 'n', 0, N_("Allow the non-default UKI entries to be added to the GRUB menu."), 0, ARG_TYPE_NONE},
-    {"entry", 'e', 0, N_("Allow specificUKII entries to be added to the GRUB menu."), N_("FILE"), ARG_TYPE_FILE},
+    {"entry", 'e', 0, N_("Allow specific UKI entries to be added to the GRUB menu."), N_("FILE"), ARG_TYPE_FILE},
     {0, 0, 0, 0, 0, 0}
   };
 #endif
Signature · 7 lines
2.51.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#2 lore raw

PATCH 2/5 blsuki: fix blscfg command summary

In reply to Radoslav Kolev via Grub-devel
---
 grub-core/commands/blsuki.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/commands/blsuki.c +1 -1
index 8837e11c9..cdd8dcc1e 100644
@@ -1476,7 +1476,7 @@ static grub_extcmd_t uki_cmd;
 GRUB_MOD_INIT(blsuki)
 {
   bls_cmd = grub_register_extcmd ("blscfg", grub_cmd_blscfg, 0,
-				  N_("[-p|--path] [-f|--enable-fallback] DIR [-d|--show-default] [-n|--show-non-default] [-e|--entry] FILE"),
+				  N_("[-p|--path] DIR [-f|--enable-fallback] [-d|--show-default] [-n|--show-non-default] [-e|--entry] FILE"),
 				  N_("Import Boot Loader Specification snippets."),
 				  bls_opt);
 #ifdef GRUB_MACHINE_EFI
Signature · 7 lines
2.51.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#3 lore raw

PATCH 3/5 blsuki: use specified device in case of fallback

In reply to Radoslav Kolev via Grub-devel

Currently if the fallback option is enabled and no files are found in the specified directory it searches the default (loader/conf) directory but always in the device set by the root environment variable. It makes more sense and also the comment in the code implies, that the default directory on the current device should be searched.

---
 grub-core/commands/blsuki.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/commands/blsuki.c +1 -1
index cdd8dcc1e..e930b7312 100644
@@ -1231,7 +1231,7 @@ blsuki_find_entry (struct find_entry_info *info, bool enable_fallback, enum blsu
 	  tmp = blsuki_update_boot_device (default_dir);
 	  tmp = grub_stpcpy (tmp, cmd_dir);
 
-	  blsuki_set_find_entry_info (info, default_dir, NULL, cmd_type);
+	  blsuki_set_find_entry_info (info, default_dir, info->devid, cmd_type);
 	  grub_dprintf ("blsuki", "Entries weren't found in %s, fallback to %s\n",
 			read_entry_info.dirname, info->dirname);
 	  fallback = true;
Signature · 7 lines
2.51.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#4 lore raw

PATCH 4/5 blsuki: fix default location in commment to /loader/entries

In reply to Radoslav Kolev via Grub-devel
---
 grub-core/commands/blsuki.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/commands/blsuki.c +1 -1
index e930b7312..0fd4458e6 100644
@@ -1210,7 +1210,7 @@ blsuki_find_entry (struct find_entry_info *info, bool enable_fallback, enum blsu
 
       /*
        * If we aren't able to find BLS entries in the directory given by info->dirname,
-       * we can fallback to the default location "/boot/loader/entries/" and see if we
+       * we can fallback to the default location of "/loader/entries/" and see if we
        * can find the files there. If we can't find UKI entries, fallback to
        * "/EFI/Linux" on the EFI system partition.
        */
Signature · 7 lines
2.51.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#5 lore raw

PATCH 5/5 blsuki: error out if unexpected arguments are supplied

In reply to Radoslav Kolev via Grub-devel

This can be especially helpful, as the Fedora version of the blscfg actually made use of arguments. In case of old configs/scripts the new implementation will now error out instead of falling back to defaults silently.

---
 grub-core/commands/blsuki.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
grub-core/commands/blsuki.c +7 -5
index 0fd4458e6..9911bcbe8 100644
@@ -1409,7 +1409,7 @@ blsuki_create_entries (bool show_default, bool show_non_default, char *entry_id,
 }
 
 static grub_err_t
-blsuki_cmd (grub_extcmd_context_t ctxt, enum blsuki_cmd_type cmd_type)
+blsuki_cmd (grub_extcmd_context_t ctxt, int argc, enum blsuki_cmd_type cmd_type)
 {
   grub_err_t err;
   struct grub_arg_list *state = ctxt->state;
@@ -1420,6 +1420,8 @@ blsuki_cmd (grub_extcmd_context_t ctxt, enum blsuki_cmd_type cmd_type)
   bool show_non_default = false;
   bool all = true;
   entries = NULL;
+  if (argc != 0)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("no arguments expected, see --help"));
 
   if (state[0].set)
     path = state[0].arg;
@@ -1454,20 +1456,20 @@ blsuki_cmd (grub_extcmd_context_t ctxt, enum blsuki_cmd_type cmd_type)
 }
 
 static grub_err_t
-grub_cmd_blscfg (grub_extcmd_context_t ctxt, int argc __attribute__ ((unused)),
+grub_cmd_blscfg (grub_extcmd_context_t ctxt, int argc,
 		 char **args __attribute__ ((unused)))
 {
-  return blsuki_cmd (ctxt, BLSUKI_BLS_CMD);
+  return blsuki_cmd (ctxt, argc, BLSUKI_BLS_CMD);
 }
 
 static grub_extcmd_t bls_cmd;
 
 #ifdef GRUB_MACHINE_EFI
 static grub_err_t
-grub_cmd_uki (grub_extcmd_context_t ctxt, int argc __attribute__ ((unused)),
+grub_cmd_uki (grub_extcmd_context_t ctxt, int argc,
 		 char **args __attribute__ ((unused)))
 {
-  return blsuki_cmd (ctxt, BLSUKI_UKI_CMD);
+  return blsuki_cmd (ctxt, argc, BLSUKI_UKI_CMD);
 }
 
 static grub_extcmd_t uki_cmd;
Signature · 7 lines
2.51.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#6 lore raw

Re: [PATCH 5/5] blsuki: error out if unexpected arguments are supplied

Quoted 24 lines · Radoslav Kolev via Grub-devel

This can be especially helpful, as the Fedora version of the blscfg actually made use of arguments. In case of old configs/scripts the new implementation will now error out instead of falling back to defaults silently.

---
 grub-core/commands/blsuki.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
grub-core/commands/blsuki.c +1 -1
index 0fd4458e6..9911bcbe8 100644
@@ -1409,7 +1409,7 @@ blsuki_create_entries (bool show_default, bool show_non_default, char *entry_id,
 }
 
 static grub_err_t
-blsuki_cmd (grub_extcmd_context_t ctxt, enum blsuki_cmd_type cmd_type)
+blsuki_cmd (grub_extcmd_context_t ctxt, int argc, enum blsuki_cmd_type cmd_type)
 {
   grub_err_t err;
   struct grub_arg_list *state = ctxt->state;

grub-core/commands/blsuki.c blsuki_cmd (grub_extcmd_context_t ctxt, enum blsuki_cmd_type cmd_type) · line 1424

Quoted 5 lines
grub-core/commands/blsuki.c +2 -0
@@ -1420,6 +1420,8 @@ blsuki_cmd (grub_extcmd_context_t ctxt, enum blsuki_cmd_type cmd_type)
   bool show_non_default = false;
   bool all = true;
   entries = NULL;
+  if (argc != 0)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("no arguments expected, see --help"));

Please check this in the caller instead of callee.

Other patches LGTM. Though I think patch #1 should have at least one sentence of explanation what has to be fixed. Otherwise it is not obvious at first sight what is going on there...

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel