This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/18239] New: fnmatch does not treat [: specially inside a bracket expression


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

            Bug ID: 18239
           Summary: fnmatch does not treat [: specially inside a bracket
                    expression
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: nszabolcs at gmail dot com
                CC: drepper.fsp at gmail dot com

"[[:a]" is an invalid fnmatch pattern because [: must start a correct character
class expression.

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05

the following code prints:
should be an error, got 0

#define _POSIX_C_SOURCE 200809L
#include <fnmatch.h>
#include <stdio.h>
int main()
{
// XBD 9.3.5 rule 1. "[:" is special
int r = fnmatch("[[:a]", "a", 0);
if (r == 0 || r == FNM_NOMATCH)
        printf("should be an error, got %d\n", r);
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]