Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 7 Aug 2014 12:09:31 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: fscanf question

On Thu, Aug 07, 2014 at 05:55:56PM +0800, 林冠儒 wrote:
> I use libc-testsuite and test for fscanf function.
> I found that the result is different from glibc.
> In this case:
>      i = x = y = -1;
>      i = fscanf( "tmp.txt", "%5i%2i" , &x, &y)
>      printf(" i = %d, x = %d, y = %d" , i , x , y);
> 
> tmp.txt content >> "0x12 0x34"
> 
> In glibc, it will print >> "i = 2 , x = 18, y = 0"
> In musl-libc will print >> "i = 1 , x = 18 , y = -1"
> 
> In this case, y's value should be "0x"
> I wonder that "0x" is equal to "0" and should be counted as matched string
> or not?
> 
> It would be very helpful if you email me back and tell me what's the problem
> Sorry with my poor english!

This is related to glibc bug #12701:

https://sourceware.org/bugzilla/show_bug.cgi?id=12701

glibc is wrong here.

Rich

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.