Bug 28051 - Unextractable messages in the code
Summary: Unextractable messages in the code
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.38
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-04 09:41 UTC by Yuri Chornoivan
Modified: 2021-07-07 09:29 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Chornoivan 2021-07-04 09:41:52 UTC
There are several unextractable Gettext messages in the new code due to the undocumented usage of quotation marks.

grep '%"' gas.pot

msgid "%"
msgid "0x%"
msgid "%s out of domain (%"
msgid "%s out of range (%"
msgid "value 0x%"

grep '%"' bfd.pot

msgid "%pB: TLS relocation at (0x%"
msgid "%pB: TLS local relocation at (0x%"
msgid "%pB: relocatation (%d) at (0x%"
msgid "%pB: stripping non-representable symbol '%s' (value %"
msgid "%pB: error: erratum 843419 immediate 0x%"

Example of the code (from gas/config/tc-i386.c:2564):

as_warn (_("%"BFD_VMA_FMT"x shortened to %"BFD_VMA_FMT"x"),

Here, the extracted message is just "%" because of the quotation mark that is just right after the percent sign.

Thanks in advance for fixing the code to make the messages extractable and translatable.
Comment 1 Sourceware Commits 2021-07-07 09:27:23 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ffa5352c0c0f735541e69fe6d9a192d82e7d418c

commit ffa5352c0c0f735541e69fe6d9a192d82e7d418c
Author: Nick Clifton <nickc@redhat.com>
Date:   Wed Jul 7 10:25:41 2021 +0100

    Fix problems translating messages when a percentage sign appears at the end of a string.
    
            PR 28051
    gas     * config/tc-i386.c (offset_in_range): Reformat error messages in
            order to fix problems when translating.
            (md_assemble): Likewise.
            * messages.c (as_internal_value_out_of_range): Likewise.
            * read.c (emit_expr_with_reloc): Likewise.
            * testsuite/gas/all/overflow.l Change expected output format.
            * po/gas.pot: Regenerate.
    
    bfd     * coff-rs6000.c (xcoff_reloc_type_tls): Reformat error messages in
            order to fix problems when translating.
            * cofflink.c (_bfd_coff_write_global_sym): Likewise.
            * elfnn-aarch64.c (_bfd_aarch64_erratum_843419_branch_to_stub):
            Likewise.
            * po/bfd.pot: Regenerate.
Comment 2 Nick Clifton 2021-07-07 09:29:12 UTC
Hi Yuri,

  Thanks for raising this problem.  I have checked in a patch to the mainline
  sources to fix the issue, but I have decided to leave the 2.37 branch alone
  as I do not want to derail the translation efforts that are currently
  underway.

Cheers
  Nick