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>
The function grub_snprintf is used to print the numeric values to a intermediate string buffer and the internationalized message contains a string format directive instead. --- grub-core/disk/luks2.c | 5 ++++- grub-core/efiemu/i386/loadcore64.c | 13 +++++++++---- grub-core/kern/arm64/dl.c | 13 +++++++++---- grub-core/kern/ia64/dl.c | 13 +++++++++---- grub-core/kern/riscv/dl.c | 14 ++++++++++---- grub-core/kern/sparc64/dl.c | 12 ++++++++---- grub-core/kern/x86_64/dl.c | 13 +++++++++---- 7 files changed, 58 insertions(+), 25 deletions(-) diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index 125e8609a..5bedbd6f9 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..2d1d8245a 100644 --- a/grub-core/efiemu/i386/loadcore64.c +++ b/grub-core/efiemu/i386/loadcore64.c @@ -121,10 +121,15 @@ 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..f612871b9 100644 --- a/grub-core/kern/arm64/dl.c +++ b/grub-core/kern/arm64/dl.c @@ -183,10 +183,15 @@ 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..ec65d5890 100644 --- a/grub-core/kern/ia64/dl.c +++ b/grub-core/kern/ia64/dl.c @@ -136,10 +136,15 @@ 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..53a00fb46 100644 --- a/grub-core/kern/riscv/dl.c +++ b/grub-core/kern/riscv/dl.c @@ -330,10 +330,16 @@ 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..975fca88d 100644 --- a/grub-core/kern/sparc64/dl.c +++ b/grub-core/kern/sparc64/dl.c @@ -176,10 +176,14 @@ 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..c371aa8de 100644 --- a/grub-core/kern/x86_64/dl.c +++ b/grub-core/kern/x86_64/dl.c @@ -106,10 +106,15 @@ 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 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel