All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Miguel Ángel Arruga Vivas" <rosen644835@gmail.com>
To: Daniel Kiper <daniel.kiper@oracle.com>,
	Glenn Washburn <development@efficientek.com>
Cc: grub-devel@gnu.org
Subject: Re: GRUB 2.06~rc1 released
Date: Mon, 22 Mar 2021 16:31:19 +0100	[thread overview]
Message-ID: <87ft0nryrc.fsf@gmail.com> (raw)
In-Reply-To: <20210312195745.42xh57cmbk5lxspd@tomti.i.net-space.pl> (Daniel Kiper's message of "Fri, 12 Mar 2021 20:57:45 +0100")


[-- Attachment #1.1: Type: text/plain, Size: 633 bytes --]

Hi,

Daniel Kiper <daniel.kiper@oracle.com> writes:

> Translators can use http://alpha.gnu.org/pub/gnu/grub/grub-2.06~rc1.pot for translation.
> The pot signature is available at http://alpha.gnu.org/pub/gnu/grub/grub-2.06~rc1.pot.sig

Sorry for the delay to report, but during translation I noticed that two
messages from the POT file have a problem related to the usage of
PRI[ux]GRUB_UINT64_T on format strings. This isn't supported by GNU
Gettext as explained on its manual[1], therefore the strings aren't
extracted properly by xgettext.

The attached patch provides a trivial solution close to the one proposed
by the manual.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: i18n-patch --]
[-- Type: text/x-patch, Size: 7120 bytes --]

From 750ab1afaf54c61d14419b7a5610856879f4851c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
 <rosen644835@gmail.com>
Date: Mon, 22 Mar 2021 16:12:41 +0100
Subject: [PATCH] i18n: Format large integers before the translation message.

GNU gettext only supports C99 macros for integral types, more specific
macros should be used to format the number to a string before the
internationalization, as explained on the section of gettext's manual
"Preparing Strings":
<http://www.gnu.org/software/gettext/manual/html_node/Preparing-Strings.html#No-string-concatenation>
---
 grub-core/disk/luks2.c             |  5 ++++-
 grub-core/efiemu/i386/loadcore64.c | 14 ++++++++++----
 grub-core/kern/arm64/dl.c          | 12 ++++++++----
 grub-core/kern/ia64/dl.c           | 12 ++++++++----
 grub-core/kern/riscv/dl.c          | 13 +++++++++----
 grub-core/kern/sparc64/dl.c        | 11 +++++++----
 grub-core/kern/x86_64/dl.c         | 12 ++++++++----
 7 files changed, 54 insertions(+), 25 deletions(-)

diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
index 125e8609a..5525e3c66 100644
--- a/grub-core/disk/luks2.c
+++ b/grub-core/disk/luks2.c
@@ -612,6 +612,7 @@ luks2_recover_key (grub_disk_t source,
   /* Try all keyslot */
   for (json_idx = 0; json_idx < size; json_idx++)
     {
+      char indexstr[21]; /* log10 (2^64) ~ 20, plus nul character.  */
       typeof (source->total_sectors) max_crypt_sectors = 0;
 
       grub_errno = GRUB_ERR_NONE;
@@ -732,11 +733,13 @@ luks2_recover_key (grub_disk_t source,
 	  continue;
 	}
 
+      grub_snprintf (indexstr, sizeof (indexstr) - 1, "%" PRIuGRUB_UINT64_T,
+		     keyslot.idx);
       /*
        * TRANSLATORS: It's a cryptographic key slot: one element of an array
        * where each element is either empty or holds a key.
        */
-      grub_printf_ (N_("Slot \"%" PRIuGRUB_UINT64_T "\" opened\n"), keyslot.idx);
+      grub_printf_ (N_("Slot \"%s\" opened\n"), indexstr);
 
       candidate_key_len = keyslot.key_size;
       break;
diff --git a/grub-core/efiemu/i386/loadcore64.c b/grub-core/efiemu/i386/loadcore64.c
index 7316efc39..ea0b207c2 100644
--- a/grub-core/efiemu/i386/loadcore64.c
+++ b/grub-core/efiemu/i386/loadcore64.c
@@ -121,10 +121,16 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs,
 		      return err;
                     break;
 		  default:
-		    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-				       N_("relocation 0x%" PRIxGRUB_UINT64_T
-					  " is not implemented yet"),
-				       ELF_R_TYPE (rel->r_info));
+		    {
+		      char rel_info[17]; /* log16 (2^64) = 16, plus nul.  */
+		      grub_snprintf (rel_info, sizeof (rel_info) - 1,
+				     "%" PRIxGRUB_UINT64_T,
+				     ELF_R_TYPE (rel->r_info));
+		      return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+					 N_("relocation 0x%s"
+					    " is not implemented yet"),
+					 rel_info);
+		    }
 		  }
 	      }
 	  }
diff --git a/grub-core/kern/arm64/dl.c b/grub-core/kern/arm64/dl.c
index 401672374..566bb84e0 100644
--- a/grub-core/kern/arm64/dl.c
+++ b/grub-core/kern/arm64/dl.c
@@ -183,10 +183,14 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
 	  break;
 
 	default:
-	  return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-			     N_("relocation 0x%" PRIxGRUB_UINT64_T
-				" is not implemented yet"),
-			     ELF_R_TYPE (rel->r_info));
+	  {
+	    char rel_info[17]; /* log16 (2^64) = 16, plus nul.  */
+	    grub_snprintf (rel_info, sizeof (rel_info) - 1,
+			   "%" PRIxGRUB_UINT64_T, ELF_R_TYPE (rel->r_info));
+	    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+			       N_("relocation 0x%s is not implemented yet"),
+			       rel_info);
+	  }
 	}
     }
 
diff --git a/grub-core/kern/ia64/dl.c b/grub-core/kern/ia64/dl.c
index b19706c50..248e35e2c 100644
--- a/grub-core/kern/ia64/dl.c
+++ b/grub-core/kern/ia64/dl.c
@@ -136,10 +136,14 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
 	case R_IA64_LDXMOV:
 	  break;
 	default:
-	  return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-			     N_("relocation 0x%" PRIxGRUB_UINT64_T
-				" is not implemented yet"),
-			     ELF_R_TYPE (rel->r_info));
+	  {
+	    char rel_info[17]; /* log16 (2^64) = 16, plus nul.  */
+	    grub_snprintf (rel_info, sizeof (rel_info) - 1,
+			   "%" PRIxGRUB_UINT64_T, ELF_R_TYPE (rel->r_info));
+	    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+			       N_("relocation 0x%s is not implemented yet"),
+			       rel_info);
+	  }
 	}
     }
   return GRUB_ERR_NONE;
diff --git a/grub-core/kern/riscv/dl.c b/grub-core/kern/riscv/dl.c
index d78297eee..024486bda 100644
--- a/grub-core/kern/riscv/dl.c
+++ b/grub-core/kern/riscv/dl.c
@@ -330,10 +330,15 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
 	case R_RISCV_RELAX:
 	  break;
 	default:
-	  return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-			     N_("relocation 0x%" PRIxGRUB_UINT64_T
-				" is not implemented yet"),
-			     (grub_uint64_t) ELF_R_TYPE (rel->r_info));
+	  {
+	    char rel_info[17]; /* log16 (2^64) = 16, plus nul.  */
+	    grub_snprintf (rel_info, sizeof (rel_info) - 1,
+			   "%" PRIxGRUB_UINT64_T,
+			   (grub_uint64_t) ELF_R_TYPE (rel->r_info));
+	    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+			       N_("relocation 0x%s is not implemented yet"),
+			       rel_info);
+	  }
 	}
     }
 
diff --git a/grub-core/kern/sparc64/dl.c b/grub-core/kern/sparc64/dl.c
index bbcce8ed5..a20171f1a 100644
--- a/grub-core/kern/sparc64/dl.c
+++ b/grub-core/kern/sparc64/dl.c
@@ -176,10 +176,13 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
 	       & 0x1fff);
 	  break;
 	default:
-	  return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-			     N_("relocation 0x%" PRIxGRUB_UINT64_T
-				" is not implemented yet"),
-			     ELF_R_TYPE (rel->r_info));
+	  {
+	    char rel_info[17]; /* log16 (2^64) = 16, plus nul.  */
+	    grub_snprintf (rel_info, sizeof (rel_info) - 1,
+			   "%" PRIxGRUB_UINT64_T, ELF_R_TYPE (rel->r_info));
+	    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+			       N_("relocation 0x%s is not implemented yet"),
+			       rel_info);
 	}
     }
 
diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c
index 1af5a0eeb..a8c8e90b1 100644
--- a/grub-core/kern/x86_64/dl.c
+++ b/grub-core/kern/x86_64/dl.c
@@ -106,10 +106,14 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
 	  break;
 
 	default:
-	  return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-			     N_("relocation 0x%" PRIxGRUB_UINT64_T
-			        " is not implemented yet"),
-			     ELF_R_TYPE (rel->r_info));
+	  {
+	    char rel_info[17]; /* log16 (2^64) = 16, plus nul.  */
+	    grub_snprintf (rel_info, sizeof (rel_info) - 1,
+			   "%" PRIxGRUB_UINT64_T, ELF_R_TYPE (rel->r_info));
+	    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+			       N_("relocation 0x%s is not implemented yet"),
+			       rel_info);
+	  }
 	}
     }
 
-- 
2.30.0


[-- Attachment #1.3: Type: text/plain, Size: 127 bytes --]


Best regards,
Miguel

[1] http://www.gnu.org/software/gettext/manual/html_node/Preparing-Strings.html#No-string-concatenation

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

  parent reply	other threads:[~2021-03-22 15:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 19:57 GRUB 2.06~rc1 released Daniel Kiper
2021-03-12 20:22 ` Vladimir 'phcoder' Serbinenko
2021-03-12 21:30 ` Bruce Dubbs
2021-03-12 23:25   ` Glenn Washburn
2021-03-12 23:48     ` Bruce Dubbs
2021-03-13 22:13       ` Bruce Dubbs
2021-03-14  5:08         ` Glenn Washburn
2021-03-14  4:40       ` Glenn Washburn
2021-03-22 15:31 ` Miguel Ángel Arruga Vivas [this message]
2021-03-23 14:31   ` Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ft0nryrc.fsf@gmail.com \
    --to=rosen644835@gmail.com \
    --cc=daniel.kiper@oracle.com \
    --cc=development@efficientek.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.