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

David david at pinko.net
Fri Oct 10 14:11:37 PDT 2003

For some reason send-pr isn't working correctly, so I am emailing it.
To: FreeBSD-gnats-submit at freebsd.org
From: david at pinko.net
Reply-To: david at pinko.net
X-send-pr-version: 3.113

 >Submitter-Id:  current-users
 >Originator:    David Gardner
 >Organization:  na
 >Confidential:  no <FreeBSD PRs are public data>
 >Synopsis:      fnmatch ("[[:alpha:]]","x", FNM_PATHNAME) returns 
 >Severity:      non-critical
 >Priority:      low
 >Category:      standards
 >Class:         sw-bug
 >Release:       FreeBSD 4.8-RELEASE i386
System: FreeBSD eden 4.8-RELEASE FreeBSD 4.8-RELEASE #3: Thu Jun 19 
21:19:54 PDT 2003 root at eden:/usr/src/sys/compile/Socialist 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-bugs mailing list