Skip to contentSkip to conversation

blsuki: fix misc comments/issues

PATCH In review Radoslav Kolev via Grub-devel 2 participants 7 messages Dec 19, 2025 – Dec 20, 2025

lore
Share & tools
lore
#0 lore raw

v3 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 expected) 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 always falls back to the device pointed by $root, even if another one was specified via the -p option.

v2:
* Moved the no arguments check to caller functions
* Added description of typo fix in patch #1

v3:
* Added more details in commit message of patch#2
* Rephrased error in patch#5 from "no arguments expected, see --help" to "unexpected argument(s) found, see --help" and added more details in commit message

Radoslav Kolev (5):
blsuki: fix typo in entry parameter description
blsuki: fix position of DIR parameter in 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 | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 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 v3 1/5 blsuki: fix typo in entry parameter description

change "specificUKII entries" to "specific UKI entries"

---
 grub-core/commands/blsuki.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/commands/blsuki.c +1 -1
index a169e3f59..3e4fa0bb3 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 v3 2/5 blsuki: fix position of DIR parameter in blscfg command summary

In reply to Radoslav Kolev via Grub-devel

The DIR parameter in the example should be specified after the -p|--path option instead of after -f|fallback.

---
 grub-core/commands/blsuki.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/commands/blsuki.c +1 -1
index 3e4fa0bb3..c107f4bb3 100644
@@ -1480,7 +1480,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 v3 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 c107f4bb3..e8e6aeebc 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 v3 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 e8e6aeebc..bfc4ef6d8 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 v3 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 positional arguments, but current implementation switched to parameters. For example what used to be "blscfg (hd0,gpt2)/..." now should be "blscfg --path (hd0,gpt2)/...)". In case of old configs/scripts still supplying positional arguments we will now error out instead of just ignoring them and falling back to defaults silently.

---
 grub-core/commands/blsuki.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
grub-core/commands/blsuki.c +6 -2
index bfc4ef6d8..4133d3111 100644
@@ -1458,9 +1458,11 @@ 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)))
 {
+  if (argc != 0)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unexpected argument(s) found, see --help"));
   return blsuki_cmd (ctxt, BLSUKI_BLS_CMD);
 }
 
@@ -1468,9 +1470,11 @@ 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)))
 {
+  if (argc != 0)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unexpected argument(s) found, see --help"));
   return blsuki_cmd (ctxt, BLSUKI_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
In reply to Radoslav Kolev via Grub-devel
Quoted 18 lines · Radoslav Kolev via Grub-devel

A number of small fixes to comments/description in the blsuki command. Also add a check that no arguments are supplied (none are expected) 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 always falls back to the device pointed by $root, even if another one was specified via the -p option.

v2:
* Moved the no arguments check to caller functions
* Added description of typo fix in patch #1

v3:
* Added more details in commit message of patch#2
* Rephrased error in patch#5 from "no arguments expected, see --help" to "unexpected argument(s) found, see --help" and added more details in commit message

Quoted 6 lines

Radoslav Kolev (5):
blsuki: fix typo in entry parameter description
blsuki: fix position of DIR parameter in 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

For all patches Reviewed-by: Daniel Kiper <[email protected]>...

Daniel

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