GNU bug report logs - #11470
bug in 8.17 pot file

Previous Next

Package: coreutils;

Reported by: Toomas Soome <Toomas.Soome <at> Elion.ee>

Date: Mon, 14 May 2012 17:52:01 UTC

Severity: normal

Merged with 11471, 11472, 11483, 11494, 11740

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11470 in the body.
You can then email your comments to 11470 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#11470; Package coreutils. (Mon, 14 May 2012 17:52:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Toomas Soome <Toomas.Soome <at> Elion.ee>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 14 May 2012 17:52:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Toomas Soome <Toomas.Soome <at> Elion.ee>
To: "bug-coreutils <at> gnu.org" <bug-coreutils <at> gnu.org>
Subject: bug in 8.17 pot file
Date: Mon, 14 May 2012 17:22:19 +0000

hi!

the entry:

#: src/fmt.c:285
#, c-format
msgid ""
"  -t, --tagged-paragraph    indentation of first line different from second\n"
"  -u, --uniform-spacing     one space between words, two after sentences\n"
"  -w, --width=WIDTH         maximum line width (default of 75 columns)\n"
"  -g, --goal=WIDTH          goal width (default of 93% of width)\n"

has unescaped %. the sequence "% o" will be interpreted by printf and it would expect an argument... and obviously the msgfmt will choke as well.

toomas





Information forwarded to bug-coreutils <at> gnu.org:
bug#11470; Package coreutils. (Mon, 14 May 2012 17:57:01 GMT) Full text and rfc822 format available.

Message #8 received at 11470 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Toomas Soome <Toomas.Soome <at> Elion.ee>
Cc: 11470 <at> debbugs.gnu.org
Subject: Re: bug#11470: bug in 8.17 pot file
Date: Mon, 14 May 2012 11:55:46 -0600
[Message part 1 (text/plain, inline)]
On 05/14/2012 11:22 AM, Toomas Soome wrote:
> 
> 
> hi!
> 
> the entry:
> 
> #: src/fmt.c:285
> #, c-format
> msgid ""
> "  -t, --tagged-paragraph    indentation of first line different from second\n"
> "  -u, --uniform-spacing     one space between words, two after sentences\n"
> "  -w, --width=WIDTH         maximum line width (default of 75 columns)\n"
> "  -g, --goal=WIDTH          goal width (default of 93% of width)\n"
> 
> has unescaped %. the sequence "% o" will be interpreted by printf and it would expect an argument... and obviously the msgfmt will choke as well.

Thanks for the report.  However, looking at format.c, we are printing
this string via fputs(), and not fprintf(), so it is _not_ an unescaped
%.  Apparently, the '#, c-format' marking in the .pot file is the real
bug, and we should figure out why xgettext put it there.

-- 
Eric Blake   eblake <at> redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Merged 11470 11471. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Mon, 14 May 2012 18:38:03 GMT) Full text and rfc822 format available.

Merged 11470 11471 11472. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Mon, 14 May 2012 22:04:02 GMT) Full text and rfc822 format available.

Merged 11470 11471 11472 11483. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Wed, 16 May 2012 04:18:02 GMT) Full text and rfc822 format available.

Reply sent to Jim Meyering <jim <at> meyering.net>:
You have taken responsibility. (Wed, 16 May 2012 05:34:01 GMT) Full text and rfc822 format available.

Notification sent to Toomas Soome <Toomas.Soome <at> Elion.ee>:
bug acknowledged by developer. (Wed, 16 May 2012 05:34:01 GMT) Full text and rfc822 format available.

Message #19 received at 11470-done <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Eric Blake <eblake <at> redhat.com>
Cc: 11470-done <at> debbugs.gnu.org
Subject: Re: bug#11472: Message src/fmt.c:285 marked as c-formatted string
	erroneously
Date: Wed, 16 May 2012 07:33:00 +0200
Eric Blake wrote:
> merge 11470 11472
> thanks
>
> On 05/14/2012 01:27 PM, Petr Pisar wrote:
>> The problem is such string does not pass through msgfmt tool while compiling
>> the catalog because the '% ' is not a valid printf sequence.
>>
>> Solution is to suppress the auto-detection by adding /*xgettext:no-c-format*/
>> before the fputs() line in the source code.
>
> Thanks.  You're the third person to report this today, but the first to
> provide a potential patch.  Are you comfortable submitting that fix in
> 'git format-patch' form with a proper commit message?  If not, we will
> probably do it on your behalf in the next 24 hours or so.

Thanks for all the replies and for merging those, Eric.

I wrote the patch.  As expected, it was more work to collect and
insert names in THANKS.in than to make the actual change ;-)
Note that Göran's name is already in the generated THANKS file,
so I didn't add it below.

If anyone listed prefers a different spelling of name or email,
just let us know.

From 54be50197b47ba9200a1c3e48847fa959d4f5bfd Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering <at> redhat.com>
Date: Wed, 16 May 2012 07:26:36 +0200
Subject: [PATCH] maint: tell xgettext that fputs arg "93% of..." is not a C
 format string
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* src/fmt.c (usage): Add a comment to tell
xgettext that the "% o" in fputs argument string of "...93% of..."
is not a C format string.  Reported by Toomas Soome, Göran Uddeborg,
Petr Pisar, Primoz PETERLIN and Chusslove Illich via
http://bugs.gnu.org/11470
---
 THANKS.in | 4 ++++
 src/fmt.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/THANKS.in b/THANKS.in
index 5c7dde8..6c826af 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -121,6 +121,7 @@ Christian Rose                      menthos <at> menthos.com
 Christian von Roques                roques <at> pond.sub.org
 Christophe LYON                     christophe.lyon <at> st.com
 Chuck Hedrick                       hedrick <at> klinzhai.rutgers.edu
+Chusslove Illich                    caslav.ilic <at> gmx.net
 Clark Morgan                        cmorgan <at> aracnet.com
 Clement Wang                        clem.wang <at> overture.com
 Colin Plumb                         colin <at> nyx.net
@@ -482,6 +483,7 @@ Peter Horst                         peter <at> ointment.org
 Peter Moulder                       reiter <at> netspace.net.au
 Peter Samuelson                     psamuels <at> sampo.creighton.edu
 Peter Seebach                       seebs <at> taniemarie.solon.com
+Petr Pisar                          petr.pisar <at> atlas.cz
 Petr Uzel                           petr.uzel <at> suse.cz
 Petter Reinholdtsen                 pere <at> hungry.com
 Phelippe Neveu                      pneveu <at> pcigeomatics.com
@@ -496,6 +498,7 @@ Piotr Gackiewicz                    gacek <at> intertele.pl
 Piotr Kwapulinski                   kwap <at> univ.gda.pl
 Prashant TR                         tr <at> eth.net
 Priit Jõerüüt                       jemm4jemm <at> yahoo.com
+Primoz PETERLIN                     primozz.peterlin <at> gmail.com
 Rainer Orth                         ro <at> TechFak.Uni-Bielefeld.DE
 Ralf W. Stephan                     stephan <at> tmt.de
 Ralph Loader                        loader <at> maths.ox.ac.uk
@@ -593,6 +596,7 @@ Ton Nijkes                          ton <at> murphy.nl
 Tony Kocurko                        akocurko <at> mun.ca
 Tony Leneis                         tony <at> plaza.ds.adp.com
 Tony Robinson                       ajr <at> eng.cam.ac.uk
+Toomas Soome                        Toomas.Soome <at> Elion.ee
 Toralf Förster                      toralf.foerster <at> gmx.de
 Torbjorn Granlund                   tege <at> nada.kth.se
 Torbjorn Lindgren                   tl <at> funcom.no
diff --git a/src/fmt.c b/src/fmt.c
index 3da198e..3e93654 100644
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -281,10 +281,12 @@ Mandatory arguments to long options are mandatory for short options too.\n\
   -p, --prefix=STRING       reformat only lines beginning with STRING,\n\
                               reattaching the prefix to reformatted lines\n\
   -s, --split-only          split long lines, but do not refill\n\
 "),
              stdout);
+      /* Tell xgettext that the "% o" below is not a printf-style
+         format string:  xgettext:no-c-format */
       fputs (_("\
   -t, --tagged-paragraph    indentation of first line different from second\n\
   -u, --uniform-spacing     one space between words, two after sentences\n\
   -w, --width=WIDTH         maximum line width (default of 75 columns)\n\
   -g, --goal=WIDTH          goal width (default of 93% of width)\n\
--
1.7.10.2.520.g6a4a482




Reply sent to Jim Meyering <jim <at> meyering.net>:
You have taken responsibility. (Wed, 16 May 2012 05:34:01 GMT) Full text and rfc822 format available.

Notification sent to Göran Uddeborg <goeran <at> uddeborg.se>:
bug acknowledged by developer. (Wed, 16 May 2012 05:34:02 GMT) Full text and rfc822 format available.

Reply sent to Jim Meyering <jim <at> meyering.net>:
You have taken responsibility. (Wed, 16 May 2012 05:34:02 GMT) Full text and rfc822 format available.

Notification sent to Petr Pisar <petr.pisar <at> atlas.cz>:
bug acknowledged by developer. (Wed, 16 May 2012 05:34:02 GMT) Full text and rfc822 format available.

Reply sent to Jim Meyering <jim <at> meyering.net>:
You have taken responsibility. (Wed, 16 May 2012 05:34:02 GMT) Full text and rfc822 format available.

Notification sent to Primoz PETERLIN <primozz.peterlin <at> gmail.com>:
bug acknowledged by developer. (Wed, 16 May 2012 05:34:02 GMT) Full text and rfc822 format available.

Forcibly Merged 11470 11471 11472 11483 11494. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Wed, 16 May 2012 23:11:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#11470; Package coreutils. (Thu, 17 May 2012 18:09:02 GMT) Full text and rfc822 format available.

Message #39 received at 11470 <at> debbugs.gnu.org (full text, mbox):

From: Göran Uddeborg <goeran <at> uddeborg.se>
To: 11470 <at> debbugs.gnu.org
Subject: bug in 8.17 pot file
Date: Thu, 17 May 2012 20:07:58 +0200
A possibly more general fix would be to tell xgettext that fputs'
argument is not c-format.  That would catch all uses of fputs.
Something like this:

--- po/Makevars~        2012-05-10 11:05:30.000000000 +0200
+++ po/Makevars 2012-05-17 20:06:13.000000000 +0200
@@ -18,6 +18,7 @@
  --flag=asprintf:2:c-format\
  --flag=error:3:c-format\
  --flag=error_at_line:5:c-format\
+ --flag=fputs:1:no-c-format\
  --flag=vasnprintf:3:c-format\
  --flag=vasprintf:2:c-format\
  --flag=verror:3:c-format\




Information forwarded to bug-coreutils <at> gnu.org:
bug#11470; Package coreutils. (Thu, 17 May 2012 18:23:02 GMT) Full text and rfc822 format available.

Message #42 received at 11470 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Göran Uddeborg <goeran <at> uddeborg.se>
Cc: bug-gnu-gettext <at> gnu.org, 11470 <at> debbugs.gnu.org
Subject: Re: bug#11470: bug in 8.17 pot file
Date: Thu, 17 May 2012 19:22:20 +0100
On 05/17/2012 07:07 PM, Göran Uddeborg wrote:
> A possibly more general fix would be to tell xgettext that fputs'
> argument is not c-format.  That would catch all uses of fputs.
> Something like this:
> 
> --- po/Makevars~        2012-05-10 11:05:30.000000000 +0200
> +++ po/Makevars 2012-05-17 20:06:13.000000000 +0200
> @@ -18,6 +18,7 @@
>   --flag=asprintf:2:c-format\
>   --flag=error:3:c-format\
>   --flag=error_at_line:5:c-format\
> + --flag=fputs:1:no-c-format\
>   --flag=vasnprintf:3:c-format\
>   --flag=vasprintf:2:c-format\
>   --flag=verror:3:c-format\

Why does xgettext even think fputs takes a printf format?
That's the real bug here right?

I know we have to deal with the bug in the meantime
with something like the above, but I've CC'd
the gettext bug list so that we won't have to
worry about it going forward.

cheers,
Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#11470; Package coreutils. (Thu, 17 May 2012 18:41:01 GMT) Full text and rfc822 format available.

Message #45 received at 11470 <at> debbugs.gnu.org (full text, mbox):

From: Göran Uddeborg <goeran <at> uddeborg.se>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: bug-gnu-gettext <at> gnu.org, 11470 <at> debbugs.gnu.org
Subject: Re: bug#11470: bug in 8.17 pot file
Date: Thu, 17 May 2012 20:39:48 +0200
Pádraig Brady:
> Why does xgettext even think fputs takes a printf format?

I don't think it does.  I think it doesn't know anything about fputs
at all, so it tries to guess.  If there is something that looks like a
printf directive in the message, it is guessed to be c-format,
otherwise not.

In a simple test I found that

  fputs(_("Hello world"), stdout);

is not considered c-format, but

  fputs(_("Hello %orld"), stdout);

is.  If I use printf instead of fputs, it is considered c-format in
both cases.  xgettext does know by default that printf's first
argument is c-format.

> I've CC'd
> the gettext bug list so that we won't have to
> worry about it going forward.

:-) I actually also sent a message to that list a little while ago,
suggesting they add flags by default for the other stdio functions.
(puts, fputs and fwrite came to mind)




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 15 Jun 2012 11:24:02 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Tue, 19 Jun 2012 14:55:01 GMT) Full text and rfc822 format available.

Forcibly Merged 11470 11471 11472 11483 11494 11740. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Tue, 19 Jun 2012 14:55:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 18 Jul 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 282 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.