NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/41558: fnmatch(3) translates '\' followed by '0' to '\'

>Number:         41558
>Category:       lib
>Synopsis:       fnmatch(3) translates '\' followed by '0' to '\'
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 08 17:10:00 +0000 2009
>Originator:     Stathis Kamperis
>Release:        NetBSD 5.0_STABLE/i386
Aristotle University of Thessaloniki
currently unavailable
Suppose that we supply fnmatch(3) with a pattern of the form "\" (that is '\' 
followed by '0') without setting the FNM_NOESCAPE flag. Wouldn't the normal 
thing to do is escape the terminating character and return just '0' ? Instead 
'\' is returned. As if one has provided a pattern "\\".

This behavior is exhibited by NetBSD 5.0_STABLE, FreeBSD 7.2-RELEASE and 

On the other side sunOS 5.10 and Linux with a relatively recent glibc translate 
the pattern to '0'.

I've looked into the specs but couldn't find anything relevant. Any thoughts ?

#include <assert.h>
#include <fnmatch.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
        int rv;

        rv = fnmatch(/* pattern */ "\\", "\\", 0);
        assert(rv == FNM_NOMATCH);


        return (EXIT_SUCCESS)

Home | Main Index | Thread Index | Old Index