standards/57911: fnmatch ("[[:alpha:]]","x", FNM_PATHNAME) returns FNM_NOMATCH

David Gardner david at
Sun Oct 12 13:10:28 PDT 2003

>Number:         57911
>Category:       standards
>Synopsis:       fnmatch ("[[:alpha:]]","x", FNM_PATHNAME) returns FNM_NOMATCH
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 12 13:10:23 PDT 2003
>Originator:     David Gardner
>Release:        FreeBSD 4.8-RELEASE i386

System: FreeBSD eden 4.8-RELEASE FreeBSD 4.8-RELEASE #3: Thu Jun i386  
>From fnmatch.h: src/include/fnmatch.h,v 1.9 1999/11/21 17:32:45 fnmatch.h   8.1 (Berkeley) 6/2/93

g++ version 2.95.4
gcc version 3.0.4


The fnmatch function doesn't seem to like any of the character classes that are listed in the re_format man page. I ssh'ed to a linux box to check this and the character classes behaved the way I expected them to.


#include <iostream>
#include <fnmatch.h>
void main () {  
  int result = fnmatch ("[[:alpha:]]","x", FNM_PATHNAME);
  if (result == FNM_NOMATCH)
    cout << "failed" << endl;
    cout << "passed" << endl;


  fnmatch seems to like the expression "[A-Za-z]" which is equivelent to "[[:alpha:]]".


More information about the freebsd-standards mailing list