Re: musl printf bugs

2012-06-17 Thread Bruno Haible
Rich Felker wrote:
> >   checking whether printf supports the 'ls' directive... no
> 
> Yep, I caught this one a while back. It's fixed in git.

Good to hear that.

Bruno




Re: musl printf bugs

2012-06-17 Thread Rich Felker
On Sun, Jun 17, 2012 at 11:57:05PM +0200, Bruno Haible wrote:
> Rich Felker wrote:
> > considering printf broken, and replacing printf
> > because of this, is a big issue. Replacing printf is non-trivial
> 
> There is also another test that causes musl's printf to be overridden:
> 
>   checking whether printf supports the 'ls' directive... no

Yep, I caught this one a while back. It's fixed in git. %ls was
over-reading (not over-printing, just over-reading) by one wchar_t
when precision was specified, and if that extra wchar_t happened to be
invalid, it would bail with EILSEQ.

Rich



Re: musl printf bugs

2012-06-17 Thread Bruno Haible
Rich Felker wrote:
> considering printf broken, and replacing printf
> because of this, is a big issue. Replacing printf is non-trivial

There is also another test that causes musl's printf to be overridden:

  checking whether printf supports the 'ls' directive... no

The test program exited with code 8, meaning that this test (from m4/printf.m4)
failed:

  /* Test whether precisions in %ls are supported as specified in ISO C 99
 section 7.19.6.1:
   "If a precision is specified, no more than that many bytes are written
(including shift sequences, if any), and the array shall contain a
null wide character if, to equal the multibyte character sequence
length given by the precision, the function would need to access a
wide character one past the end of the array."
 This test fails on Solaris 10.  */
  {
static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 };
buf[0] = '\0';
if (sprintf (buf, "%.2ls", wstring) < 0
|| strcmp (buf, "ab") != 0)
  result |= 8;
  }

Bruno