From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NHmkW-0000tw-6j for mharc-grub-devel@gnu.org; Mon, 07 Dec 2009 18:12:12 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NHmkU-0000rV-KA for grub-devel@gnu.org; Mon, 07 Dec 2009 18:12:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NHmkP-0000kg-Ty for grub-devel@gnu.org; Mon, 07 Dec 2009 18:12:10 -0500 Received: from [199.232.76.173] (port=51799 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NHmkP-0000kT-QD for grub-devel@gnu.org; Mon, 07 Dec 2009 18:12:05 -0500 Received: from smarthost02.mail.zen.net.uk ([212.23.3.141]:58669) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NHmkP-0001Ob-L6 for grub-devel@gnu.org; Mon, 07 Dec 2009 18:12:05 -0500 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost02.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1NHmkO-0001sf-Cb for grub-devel@gnu.org; Mon, 07 Dec 2009 23:12:04 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 3.36 #1 (Debian)) for grub-devel@gnu.org id 1NHmkO-0002k0-00; Mon, 07 Dec 2009 23:12:04 +0000 Date: Mon, 7 Dec 2009 23:12:03 +0000 From: Colin Watson To: The development of GNU GRUB Message-ID: <20091207231203.GK6439@riva.ucam.org> References: <20091207140923.GA6439@riva.ucam.org> <4B1D7C04.1000503@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4B1D7C04.1000503@gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost02-IP: [82.69.40.219] X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: 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 23:12:10 -0000 On Mon, Dec 07, 2009 at 11:04:52PM +0100, 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. I disagree. I have seen many practical problems caused by this coding style. > And silencing it is against gettext manual. Read > http://www.gnu.org/software/hello/manual/gettext/Preparing-Strings.html I see nothing relevant in that link. (I am familiar with gettext already, having been using it for many years in other free software projects.) > http://www.gnu.org/software/hello/manual/gettext/c_002dformat-Flag.html#c_002dformat-Flag That suggests one available option for tweaking the way gettext handles such strings, but it does not prescribe any particular solution to the problem. Indeed, it says "Of course one would normally use fputs", which is just as valid a solution as adding the c-format flag, and quite possibly more valid since it's a heck of a lot easier to maintain. We don't have fputs in GRUB right now, so grub_printf ("%s", _(...)) is perfectly valid too, in just the same way that fputs is. IME, forcing no-c-format is much more useful than forcing c-format. In short, it is not true that "silencing it is against gettext manual", but thank you for providing me with links that if anything support my position. ;-) Vladimir, please can you be a little less terse in your objections in future? For example, it is often helpful to quote specific text rather than vague URLs. If you would like arbitration on whether my approach is "correct" as per the gettext maintainers, I'm happy to bring it up with them. Thanks, -- Colin Watson [cjwatson@ubuntu.com]