All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: Build failures on Ubuntu due to gettext
Date: Mon, 07 Dec 2009 23:04:52 +0100	[thread overview]
Message-ID: <4B1D7C04.1000503@gmail.com> (raw)
In-Reply-To: <20091207140923.GA6439@riva.ucam.org>

[-- Attachment #1: Type: text/plain, Size: 3280 bytes --]

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
> 2009-12-07  Colin Watson  <cjwatson@ubuntu.com>
>
> 	* normal/menu_entry.c (run): Don't pass the result of gettext as
> 	the first argument to grub_printf, appeasing -Wformat-security.
> 	(grub_menu_entry_run): Likewise.
> 	* normal/menu_text.c (grub_wait_after_message): Likewise.
> 	(print_message): Likewise.
> 	(notify_execution_failure): Likewise.
>
> === modified file 'normal/menu_entry.c'
> --- normal/menu_entry.c	2009-12-05 11:25:07 +0000
> +++ normal/menu_entry.c	2009-12-07 14:02:20 +0000
> @@ -1000,7 +1000,7 @@ run (struct screen *screen)
>  
>    grub_cls ();
>    grub_printf ("  ");
> -  grub_printf (_("Booting a command list"));
> +  grub_printf ("%s", _("Booting a command list"));
>    grub_printf ("\n\n");
>  
>  
> @@ -1182,6 +1182,6 @@ grub_menu_entry_run (grub_menu_entry_t e
>    grub_print_error ();
>    grub_errno = GRUB_ERR_NONE;
>    grub_putchar ('\n');
> -  grub_printf (_("Press any key to continue..."));
> +  grub_printf ("%s", _("Press any key to continue..."));
>    (void) grub_getkey ();
>  }
>
> === modified file 'normal/menu_text.c'
> --- normal/menu_text.c	2009-12-05 11:25:07 +0000
> +++ normal/menu_text.c	2009-12-07 14:02:45 +0000
> @@ -40,7 +40,7 @@ void
>  grub_wait_after_message (void)
>  {
>    grub_putchar ('\n');
> -  grub_printf (_("Press any key to continue..."));
> +  grub_printf ("%s", _("Press any key to continue..."));
>    (void) grub_getkey ();
>    grub_putchar ('\n');
>  }
> @@ -206,7 +206,7 @@ entry is highlighted.");
>        if (nested)
>          {
>            grub_printf ("\n        ");
> -          grub_printf (_("ESC to return previous menu."));
> +          grub_printf ("%s", _("ESC to return previous menu."));
>          }
>      }
>  }
> @@ -655,7 +655,7 @@ notify_execution_failure (void *userdata
>        grub_errno = GRUB_ERR_NONE;
>      }
>    grub_printf ("\n  ");
> -  grub_printf (_("Failed to boot default entries.\n"));
> +  grub_printf ("%s", _("Failed to boot default entries.\n"));
>    grub_wait_after_message ();
>  }
>  
>
> Thanks,
>
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]

  parent reply	other threads:[~2009-12-07 22:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-07 14:09 Build failures on Ubuntu due to gettext Colin Watson
2009-12-07 20:14 ` Carles Pina i Estany
2009-12-07 20:54   ` Colin Watson
2009-12-07 22:46     ` Carles Pina i Estany
2009-12-07 23:25       ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-07 23:57         ` Colin Watson
2009-12-07 23:38       ` Carles Pina i Estany
2009-12-07 23:59         ` Colin Watson
2009-12-08  0:00       ` Colin Watson
2009-12-08  0:14         ` Carles Pina i Estany
2009-12-07 22:04 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2009-12-07 23:12   ` Colin Watson
2009-12-07 23:38     ` Colin Watson
2009-12-07 23:59       ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-08  0:10         ` Colin Watson
2009-12-08  0:15           ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-09 23:57             ` Carles Pina i Estany
2009-12-10  0:07               ` Carles Pina i Estany
2009-12-10  0:38                 ` Carles Pina i Estany
2009-12-10  1:10           ` Robert Millan
2009-12-11  0:04             ` Carles Pina i Estany
2009-12-07 23:18   ` Carles Pina i Estany

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=4B1D7C04.1000503@gmail.com \
    --to=phcoder@gmail.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.