[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Build failures on Ubuntu due to gettext
From: |
Carles Pina i Estany |
Subject: |
Re: Build failures on Ubuntu due to gettext |
Date: |
Mon, 7 Dec 2009 22:46:30 +0000 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi,
On Dec/07/2009, Colin Watson wrote:
> On Mon, Dec 07, 2009 at 08:14:08PM +0000, Carles Pina i Estany wrote:
> > a) It's a bit of false security because it's not fixing the case of file
> > normal/menu_text.c, line 191 (search the string "Use the %C and %C keys
> > to") or menu_text.c line 374 (search for "The highlighted entry")
> > (I agree that it's better than before... but not very solid)
>
> Forget security, in this case; let's just think of it as a way to avoid
Ok, I'll forget about security (even when the name is not helping to
forget about security :-) )
> > b) How would you translate and handle:
> > grub_printf (_("Hello %s"), name);
>
> -Wformat-security doesn't interfere with that. As its documentation
> says:
>
> At present, this warns about calls to `printf' and `scanf' functions
> where the format string is not a string literal and there are no
> format arguments, as in `printf (foo);'.
I see now (not before)
> > Using any different number of %X from msgid and msgstr ishalting
> > msgfmt (so, if msgid contains 1 %s and 2 %d, msgstr
> > has to contain the same)
>
> That only works for strings with the "c-format" attribute, which
> xgettext only applies (and should only apply) to msgids that contain
> "%". It helps for the string you mentioned earlier with %C in the msgid,
right. Actually I was expecting that all strings in a C file would
has c-format, but it's not the case:
----
#: normal/menu_entry.c:840
#, c-format
msgid "Possible %s are:"
#: normal/menu_entry.c:1003
msgid "Booting a command list"
----
And confirmed: if the translator adds %C in the second string
("Booting a command list") msgfmt -c is not complaining.
So I would apply your patch, after understanding that it's only for
strings that doesn't have any %C (and in my opinion xgettext could
add the c-format if it's in a C file, but we will not discuss it here
now :-) , I guess that in some cases would not be correct)
Your patch conflicts with my one (Subject: gettext: grub_printf_ and N_)
but it's not a big problem. If you commit before I would adapt
my one, else I would adapt your one.
--
Carles Pina i Estany
http://pinux.info
Re: Build failures on Ubuntu due to gettext, Vladimir 'φ-coder/phcoder' Serbinenko, 2009/12/07