Bug 531

Summary: fnmatch on MacOS X (and other BSD OSes) doesn't accept character classes
Product: Sudo Reporter: bowman+sudo
Component: ConfigureAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: normal    
Version: 1.8.3   
Hardware: Macintosh   
OS: MacOS X   

Description bowman+sudo 2011-12-21 18:22:05 MST
The fnm_test fails because fnmatch on MacOS X 10.5 doesn't support character classes.  The failure is:

fnmatch: /bin/[[:opper:][:alnum:]]* /bin/ls 0: want 1, got 2
fnmatch: 5 tests run, 1 errors, 80% success rate

From the MacOS X fnmatch(3) man page:
STANDARDS
     The current implementation of the fnmatch() function does not conform to
     IEEE Std 1003.2 (``POSIX.2'').  Collating symbol expressions, equivalence
     class expressions and character class expressions are not supported.
Comment 1 Todd C. Miller 2012-01-16 10:43:16 MST
You should really file a bug with Apple.  I added support for character classes in the BSD fnmatch and glob functions a few years ago in OpenBSD (and in the versions shipped with sudo).

However, I've made a change to only run the regression tests in the compat dir when we are using the functions shipped with sudo and not against the system versions.  That will quiet "make check" on MacOS X.