Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 6 Aug 2014 18:03:33 +0800
From: 林冠儒 <g548462@...il.com>
To: "?????????" <g548462@...il.com>, musl@...ts.openwall.com
Subject: Re: fnmatch.h bug?

I have do another experiment.

musl-libc:
     i = fnmatch("\\","\\",0);  // it returns 0 -> i=0
     i = fnmatch("\\","\\",FNM_NOESCAPE);  // it also returns 0 -> i=0

But I think this two lines of code should return different value because I
set the FNM_NOESCAPE flag.

I also do same experiment in glibc:
glibc:
     i = fnmatch("\\","\\",0);  // it returns 1 -> i=1
     i = fnmatch("\\","\\",FNM_NOESCAPE);  // it  returns 0 -> i=0


In another case:
musl-libc:
     i = fnmatch("[1\\]","[1]",0);  // it returns 1 -> i=1
glibc:
     i = fnmatch("[1\\]","[1]",0);  //it returns 0 -> i=0

Because I DON'T set FNM_NOESCAPE flag, so glibc will escape ']' with two '\'
And the return value should be 0 (match '[1]')
Is it right ?

It would be very helpful if you email me back and tell me what's the problem
Sorry ,my english is so poor.



2014-08-06 14:28 GMT+08:00 Szabolcs Nagy <nsz@...t70.net>:

> * ????????? <g548462@...il.com> [2014-08-06 11:01:40 +0800]:
> >
> > musl-libc:
> >      i = fnmatch( "[[?*\\]" , "\\" , 0 ); // it will return 0 -> i = 0
> > glibc:
> >      i = fnmatch( "[[?*\\]" , "\\" , 0 ); // it will return 1 -> i = 1
> >
> > The return value is DIFFERENT !
> > I am confuse which library is wrong?
> > If you have any idea, please response me and send an e-mail to me,
>
> in a bracket expression a backslash loses its special meaning
> so this pattern matches a single '[', '?', '*' or '\\' character
>
> if glibc fails to match '\\' then it's a bug in their implementation
>
> (this exact pattern is even part of the libc-test suite for fnmatch)
>

Content of type "text/html" skipped

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.