[DragonFlyBSD - Bug #1399] (Closed) fnmatch(3) escapes '0' to '\'

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Thu Jan 15 08:06:16 PST 2015


Issue #1399 has been updated by tuxillo.

Description updated
Category set to Userland
Status changed from New to Closed
Target version set to 4.2.x

Hi all,

It seems we pass now the test:

antonioh at andromeda:~/temp$ ./t_fnmatch
passed

Cheers,
Antonio Huete

----------------------------------------
Bug #1399: fnmatch(3) escapes '0' to '\'
http://bugs.dragonflybsd.org/issues/1399#change-12462

* Author: Anonymous
* Status: Closed
* Priority: Normal
* Assignee: 
* Category: Userland
* Target version: 4.2.x
----------------------------------------
Salute.

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
DragonFlyBSD HEAD.

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

You can check with the following snippet:

#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);

        printf("passed\n");

        return (EXIT_SUCCESS)
}

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

Cheers,
Stathis

---Files--------------------------------
fnmatch-3-Properly-escape-the-terminating-characte.patch (769 Bytes)


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Bugs mailing list