|
Message-ID: <20170815142550.GM15263@port70.net> Date: Tue, 15 Aug 2017 16:25:50 +0200 From: Szabolcs Nagy <nsz@...t70.net> To: Denys Vlasenko <vda.linux@...glemail.com> Cc: Rich Felker <dalias@...c.org>, musl <musl@...ts.openwall.com> Subject: Re: fnmatch bug? escaping of '-' and ']' inside [...] does not work. * Denys Vlasenko <vda.linux@...glemail.com> [2017-08-15 15:12:17 +0200]: > Moving bbox build to musl did uncover one definite bug. > bbox has gazillion tests for its shells, and one of them > started failing. I added debug printout and with it, > the following fnmatch calls give different results now: > > ash: fnmatch(pattern:'[a\-c]',str:'-',0):1 > ash: fnmatch(pattern:'[\]]',str:']',0):1 > ash: fnmatch(pattern:'[a\]]',str:']',0):1 > > glibc and uclibc threat the above as a match. > > The assumption may be that one should place ']' or '-' > as a first character in the [...] and thus escaping > is not necessary, but shell does not have the luxury > of choosing the pattern, in comes from the script. > it's not clear to me if \ is valid as escape in fnmatch pattern: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13_01 in re bracket expression \ is not an escape char, but in the shell i think the pattern should be unquoted first, which may or may not apply to fnmatch bracket expression, depending on how you read the text. i guess if other implementations do the unquoting musl should follow that, but the standard could be improved.
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.