bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invalid gettext preprocessing causes broken format strings and sigse


From: Eric Blake
Subject: Re: Invalid gettext preprocessing causes broken format strings and sigsegv at runtine
Date: Thu, 20 Jul 2006 06:25:29 -0600
User-agent: Thunderbird 1.5.0.4 (Windows/20060516)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Please keep replies on the list, so that others may see the resolution of
this thread.

According to Zygmunt Krynicki on 7/20/2006 2:05 AM:
> Dnia 19-07-2006, śro o godzinie 07:07 -0600, Eric Blake napisał(a):
>> According to Zygmunt Krynicki on 7/19/2006 6:43 AM:
>>> Preprocessing of macro PRIuMAX is not forwarded to gettext and produces
>>> broken format strings.
>>>
>>> Example code: printf (gettext("Foo: " PRIuMAX " %s\n"),
>>> (uintmax_t)12345, "");
>> Thanks for the report.  However, coreutils does not own the source for
>> gettext.  You should send this report to address@hidden (an alias for
>> bug-gnu-utils) for a better response from the gettext maintainer.
> 
> Hello and thanks for the swift response.
> I would not count this as a gettext bug (or xgettext in particular),
> IMHO it is an invalid usage on part of dd.
> 
> You cannot hope for macro expansion to work this way. I understand it is
> needed for portability of the GNU utilities but currently it breaks on
> all systems with localization enabled. It would be better to disable it
> explicitly until a solution is found.

No, my understanding of the gettext package is that it explicitly
recognizes the PRI* macros, and encodes them in such a way that the
message translation can be machine-independent, and then post-processed
from the .mo file back into the correct size % directive before returning
the result back to the program that invoked gettext().  If this is not
happening correctly, then I'm sure Bruno would love to hear about it so he
can make his next version of gettext do this correctly as he intended.

> 
> An ugly solution would be to generate proper expansion for such macros
> during configuration and then invoke the C preprocessor or some other
> macro expansion (maybe even sed to replace an in-line token).
> 
> An example to illustrate this:
> 
> printf (_("Foo @PRIuMAX@ %s\n", (uintmax_t)12345, "");
> 
> then call sed with "s/@PRIuMAX/$proper_expansion/" somehow.

Sorry, but GNU gettext is supposed to understand certain preprocessor
macros, not coreutils uglify its code base.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEv3Y584KuGfSFAYARAnyLAKCiG4xJJGB0bD1vV+JjsjSnvc6gAgCfcTvR
l5KN7tR3hdwWkC5kYw4DvYg=
=FRR/
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]