From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NHeHO-0004rg-Vx for mharc-grub-devel@gnu.org; Mon, 07 Dec 2009 09:09:35 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NHeHN-0004r2-A2 for grub-devel@gnu.org; Mon, 07 Dec 2009 09:09:33 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NHeHI-0004oy-J6 for grub-devel@gnu.org; Mon, 07 Dec 2009 09:09:32 -0500 Received: from [199.232.76.173] (port=45018 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NHeHI-0004oj-Dh for grub-devel@gnu.org; Mon, 07 Dec 2009 09:09:28 -0500 Received: from smarthost03.mail.zen.net.uk ([212.23.3.142]:60480) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NHeHI-0000W9-22 for grub-devel@gnu.org; Mon, 07 Dec 2009 09:09:28 -0500 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost03.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1NHeHG-0003TT-Ic for grub-devel@gnu.org; Mon, 07 Dec 2009 14:09:26 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 3.36 #1 (Debian)) for grub-devel@gnu.org id 1NHeHD-0006ZO-00; Mon, 07 Dec 2009 14:09:23 +0000 Date: Mon, 7 Dec 2009 14:09:23 +0000 From: Colin Watson To: grub-devel@gnu.org Message-ID: <20091207140923.GA6439@riva.ucam.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost03-IP: [82.69.40.219] X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Build failures on Ubuntu due to gettext X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 14:09:33 -0000 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? 2009-12-07 Colin Watson * 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, -- Colin Watson [cjwatson@ubuntu.com]