Hi, On Dec/07/2009, Vladimir '??-coder/phcoder' Serbinenko wrote: > Colin Watson wrote: > > Ubuntu's GCC enables -Wformat-security by default. This causes GCC to > > (IMO rightly!) complain about constructs such as this: > > > > grub_printf (_("foo")); > > > > ... because it's all too easy for a translator to (usually accidentally) > > insert % sequences which would cause printf to behave incorrectly. This > > should instead be: > > > > grub_printf ("%s", _("foo")); > > > > Patch follows. I can't help thinking that this would be easier with a > > grub_puts, but perhaps that isn't worth it given the relatively small > > number of occurrences here? > > > > Also, should the line in notify_execution_failure instead be: > > > > - grub_printf (_("Failed to boot default entries.\n")); > > + grub_printf ("%s\n", _("Failed to boot default entries.")); > > > > ... to get rid of the unsightly \n in this translated string? > > > This warning is simply wrong in this context. And silencing it is > against gettext manual. Read > http://www.gnu.org/software/hello/manual/gettext/Preparing-Strings.html > http://www.gnu.org/software/hello/manual/gettext/c_002dformat-Flag.html#c_002dformat-Flag
other solution that I like even more (but I have a problem to implement): use --flag=_:1:pass-c-format . So all strings will be c-format and msgfmt will check the number of parameters (even if the string doesn't have %C, will be c-format and msgfmt should complain if msgstr has a new %C) -- Carles Pina i Estany http://pinux.info _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel