Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 8 Jun 2012 10:44:23 -0400
From: Rich Felker <>
Subject: Re: printf POSIX compliance

On Fri, Jun 08, 2012 at 11:34:04AM +0100, Reuben Thomas wrote:
> I notice that the musl FAQ says "the fundamentally broken freadahead
> function in gnulib cannot be fixed by adding features to the C
> library". I found this question because a user complained about my use
> of gnulib in a package I maintain.
> I contacted the gnulib maintainers, one of whom replied:
> "IIRC, gnulib's freadahead use is caused by musl's printf not being
> posix compliant, causing gnulib to pull in its printf replacement,
> which doesn't work on musl."

The first failing test I found was invalid. It's a test for whether
printf supports printing non-finite long double values. gnulib is
constructing an illegal long double representation (which they call
"pseudo-denormal") that will never occur as a value and passing it to

|   { /* Pseudo-Denormal.  */
|     static union { unsigned int word[4]; long double value; } x =
|       { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
|     if (sprintf (buf, "%Lf", x.value) < 0
|         || !strisnan (buf, 0, strlen (buf)))
|       result |= 64;

This test should simply be removed; there is no reason printf should
handle invalid bit patterns that cannot occur as values.

The second failing test actually caught a slight bug in %ls with
precision modifiers. I've fixed it in musl git.

Still working on finding whether this long double issue is what's
causign the gnulib junk to get pulled in...


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.