Skip to contentSkip to conversation

Various fixes nice to have in the GRUB 2.06 release

PATCH In review Daniel Kiper 2 participants 8 messages Apr 14, 2021 – Apr 26, 2021

lore
Share & tools
lore
#0 lore raw

cover Various fixes nice to have in the GRUB 2.06 release

Hey,

As in subject...

Daniel

 docs/grub-dev.texi            |  2 +-
 docs/grub.texi                |  4 +++-
 grub-core/commands/ls.c       |  2 +-
 grub-core/commands/terminal.c | 10 +++++-----
 grub-core/kern/efi/mm.c       | 10 +++++++---
 grub-core/term/terminfo.c     |  4 ++--
 6 files changed, 19 insertions(+), 13 deletions(-)

Daniel Kiper (3):
i18n: Format large integers before the translation message - take 2
i18n: Align N_() formatting with the rest of GRUB code term/terminfo: Fix the terminfo command help and documentation

#1 lore raw

PATCH 1/3 i18n: Format large integers before the translation message - take 2

This is an additional fix which has been missing from the commit 837fe48de (i18n: Format large integers before the translation message).

---
 grub-core/kern/efi/mm.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
grub-core/kern/efi/mm.c +7 -3
index 0cdb063bb..9838fb2f5 100644
@@ -126,10 +126,14 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address,
   /* Limit the memory access to less than 4GB for 32-bit platforms.  */
   if (address > GRUB_EFI_MAX_USABLE_ADDRESS)
     {
+      char inv_addr[17], max_addr[17]; /* log16(2^64) = 16, plus NUL. */
+
+      grub_snprintf (inv_addr, sizeof (inv_addr) - 1, "%" PRIxGRUB_UINT64_T,
+		     address);
+      grub_snprintf (max_addr, sizeof (max_addr) - 1, "%" PRIxGRUB_UINT64_T,
+		     (grub_efi_uint64_t) GRUB_EFI_MAX_USABLE_ADDRESS);
       grub_error (GRUB_ERR_BAD_ARGUMENT,
-		  N_("invalid memory address (0x%" PRIxGRUB_UINT64_T
-                     " > 0x%" PRIxGRUB_UINT64_T ")"),
-		  address, (grub_efi_uint64_t) GRUB_EFI_MAX_USABLE_ADDRESS);
+		  N_("invalid memory address (0x%s > 0x%s)"), inv_addr, max_addr);
       return NULL;
     }
 
Signature · 1 line
2.11.0
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 2.06 RELEASE 1/3] i18n: Format large integers before the translation message - take 2

Quoted 5 lines · Daniel Kiper

This is an additional fix which has been missing from the commit 837fe48de (i18n: Format large integers before the translation message).

---

Looks good to me.

Best regards,

Signature · 3 lines
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat
#3 lore raw

PATCH 2/3 i18n: Align N_() formatting with the rest of GRUB code

In reply to Daniel Kiper
---
 grub-core/commands/ls.c       |  2 +-
 grub-core/commands/terminal.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
grub-core/commands/ls.c +1 -1
index 326d2d6b4..8e98c73cc 100644
@@ -70,7 +70,7 @@ grub_ls_list_devices (int longlist)
     FOR_NET_APP_LEVEL (proto)
     {
       if (first)
-	grub_puts_ (N_ ("Network protocols:"));
+	grub_puts_ (N_("Network protocols:"));
       first = 0;
       grub_printf ("%s ", proto->name);
     }
grub-core/commands/terminal.c +5 -5
index 3002186d2..37e0ab8b1 100644
@@ -87,7 +87,7 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled,
     i++;
 
   if (i == argc)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no terminal specified"));
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("no terminal specified"));
 
   for (; i < argc; i++)
     {
@@ -241,8 +241,8 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
 			 (struct abstract_terminal **) (void *) &grub_term_inputs,
 			 (struct abstract_terminal **) (void *) &grub_term_inputs_disabled,
 			 grub_term_input_autoload,
-			 N_ ("Active input terminals:"),
-			 N_ ("Available input terminals:"));
+			 N_("Active input terminals:"),
+			 N_("Available input terminals:"));
 }
 
 static grub_err_t
@@ -258,8 +258,8 @@ grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
 			 (struct abstract_terminal **) (void *) &grub_term_outputs,
 			 (struct abstract_terminal **) (void *) &grub_term_outputs_disabled,
 			 grub_term_output_autoload,
-			 N_ ("Active output terminals:"),
-			 N_ ("Available output terminals:"));
+			 N_("Active output terminals:"),
+			 N_("Available output terminals:"));
 }
 
 static grub_command_t cmd_terminal_input, cmd_terminal_output;
Signature · 1 line
2.11.0
Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2.06 RELEASE 2/3] i18n: Align N_() formatting with the rest of GRUB code

Quoted 11 lines · Daniel Kiper
---
 grub-core/commands/ls.c       |  2 +-
 grub-core/commands/terminal.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
grub-core/commands/ls.c +0 -0
index 326d2d6b4..8e98c73cc 100644

grub-core/commands/ls.c grub_ls_list_devices (int longlist) · line 73

Quoted 5 lines
grub-core/commands/ls.c +1 -1
@@ -70,7 +70,7 @@ grub_ls_list_devices (int longlist)
     FOR_NET_APP_LEVEL (proto)
     {
       if (first)
-	grub_puts_ (N_ ("Network protocols:"));
+	grub_puts_ (N_("Network protocols:"));

Is part of the coding style that functions calls should have a space between the function name and the parenthesis but not when using macros ? I haven't found anything about it in the docs/grub-dev.texi file.

But it's true that this change makes it consistent with the rest of the GRUB codebase, so the patch looks good to me.

Best regards,

Signature · 3 lines
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat
#5 lore raw

Re: [PATCH 2.06 RELEASE 2/3] i18n: Align N_() formatting with the rest of GRUB code

Quoted 7 lines · Javier Martinez Canillas
Quoted 6 lines · Daniel Kiper
---
 grub-core/commands/ls.c       |  2 +-
 grub-core/commands/terminal.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
Quoted 14 lines

grub-core/commands/ls.c grub_ls_list_devices (int longlist) · line 73

Quoted 10 lines
grub-core/commands/ls.c +1 -1
index 326d2d6b4..8e98c73cc 100644
@@ -70,7 +70,7 @@ grub_ls_list_devices (int longlist)
     FOR_NET_APP_LEVEL (proto)
     {
       if (first)
-	grub_puts_ (N_ ("Network protocols:"));
+	grub_puts_ (N_("Network protocols:"));

Is part of the coding style that functions calls should have a space between the function name and the parenthesis but not when using macros ? I haven't found anything about it in the docs/grub-dev.texi file.

As I can see from the code the translation macros are exception from the "extra space" rule.

Quoted 4 lines

But it's true that this change makes it consistent with the rest of the GRUB codebase, so the patch looks good to me.

Thanks a lot!

Daniel

#6 lore raw

PATCH 3/3 term/terminfo: Fix the terminfo command help and documentation

In reply to Daniel Kiper

Additionally, fix the terminfo spelling mistake in the GRUB development documentation.

---
 docs/grub-dev.texi        | 2 +-
 docs/grub.texi            | 4 +++-
 grub-core/term/terminfo.c | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)
docs/grub-dev.texi +1 -1
index a834b3a9c..6c629a23e 100644
@@ -820,7 +820,7 @@ Of video is loongson (kern/mips/loongson/init.c). Note that terminfo has
 to be inited in 2 stages: one before (to get at least rudimentary console
 as early as possible) and another after the heap (to get full-featured console).
 For the input there are string of keys, terminfo and direct hardware. For string
-of keys look at i386-pc (same files), for termino ieee1275 (same files) and for
+of keys look at i386-pc (same files), for terminfo ieee1275 (same files) and for
 hardware loongson (kern/mips/loongson/init.c and term/at_keyboard.c).
 
 For the timer you'll need to call grub_install_get_time_ms (...) with as sole
docs/grub.texi +3 -1
index e2c58415a..f8b4b3b21 100644
@@ -3934,7 +3934,7 @@ names active.
 @node terminfo
 @subsection terminfo
 
-@deffn Command terminfo [-a|-u|-v] [term]
+@deffn Command terminfo [@option{-a}|@option{-u}|@option{-v}] [@option{-g WxH}] [term] [type]
 Define the capabilities of your terminal by giving the name of an entry in
 the terminfo database, which should correspond roughly to a @samp{TERM}
 environment variable in Unix.
@@ -3951,6 +3951,8 @@ specifies logically-ordered UTF-8; and @option{-v} specifies
 emulator without bidirectional text support will display right-to-left text
 in the proper order; this is not really proper UTF-8, but a workaround).
 
+The @option{-g} (@option{--geometry}) can be used to specify terminal geometry.
+
 If no option or terminal type is specified, the current terminal type is
 printed.
 @end deffn
grub-core/term/terminfo.c +2 -2
index cd7200803..85ecf06b4 100644
@@ -785,8 +785,8 @@ static grub_extcmd_t cmd;
 GRUB_MOD_INIT(terminfo)
 {
   cmd = grub_register_extcmd ("terminfo", grub_cmd_terminfo, 0,
-			      N_("[[-a|-u|-v] [-g WxH] TERM [TYPE]]"),
-			      N_("Set terminfo type of TERM  to TYPE.\n"),
+			      N_("[[-a|-u|-v] [-g WxH] [TERM] [TYPE]]"),
+			      N_("Set terminfo type of TERM to TYPE.\n"),
 			      options);
 }
 
Signature · 1 line
2.11.0
Reviewed-by on v1 3/3
#7 lore raw

Re: [PATCH 2.06 RELEASE 3/3] term/terminfo: Fix the terminfo command help and documentation

Quoted 5 lines · Daniel Kiper

Additionally, fix the terminfo spelling mistake in the GRUB development documentation.

---

Best regards,

Signature · 3 lines
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat