bug-gettext
[Top][All Lists]
Advanced

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

Re: [bug-gettext] libintl.h redirection of stdio printf functions


From: Tim Rühsen
Subject: Re: [bug-gettext] libintl.h redirection of stdio printf functions
Date: Sat, 12 May 2018 13:26:00 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 12.05.2018 11:04, Eli Zaretskii wrote:
> I bumped into this problem while building and testing the latest alpha
> of wget2.  Some of the wget2 unit tests in unit-tests/test.c fail due
> to unsupported printf specifiers, such as %hhd and %zd.  To solve
> this, I've rebuilt wget2 and the test suite with
> "-D__USE_MINGW_ANSI_STDIO=1", but to my surprise this didn't help at
> all.
>
> It turned out the root cause was that libintl.h, included by
> gettext.h, redirects the *printf functions to its own implementations,
> for example:
>
>   #if !(defined sprintf && defined _GL_STDIO_H) /* don't override gnulib */
>   #undef sprintf
>   #define sprintf libintl_sprintf
>   extern int sprintf (char *, const char *, ...);
>   #endif
>
> This interferes with MinGW-supplied replacements for sprintf etc.
> Every program that includes gettext.h "gains" these redirections, and
> there doesn't seem to be a way of avoiding that, except when building
> Gnulib itself, unless I missed something.  The only "solution" I could
> see is to #undef all those definitions after including gettext.h, in
> source files that don't use the _ macro, but that sounds fragile, and
> doesn't work when both _() and C99 printf format specifiers are used.
>
> What is the recommended solution for this issue?
We could simply skip those tests on certain platforms, e.g. on _WIN32.

These tests are basically to test our own printf implementation against
glibc's printf.
So it simply doesn't make sense to test it against the Windows
implementation.

Since the MinGW cross build works on Linux (see our Gitlab CIs,
.gitlab-ci.yml and contrib/mingw), it would be great if you can wrap the
code with #ifndef _WIN32 until it works for you. Just send us the
patches / diffs.

Regards, Tim


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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