[issue1399] fnmatch(3) escapes '0' to '\'
Stathis Kamperis (via DragonFly issue tracker)
sinknull at leaf.dragonflybsd.org
Wed Jun 10 12:24:45 PDT 2009
New submission from Stathis Kamperis <ekamperi at gmail.com>:
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
----------
assignedto: Beket
files: 0001-fnmatch-3-Properly-escape-the-terminating-characte.patch
messages: 6737
nosy: Beket
priority: bug
status: unread
title: fnmatch(3) escapes '0' to '\'
_____________________________________________________
DragonFly issue tracker <bugs at lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue1399>
_____________________________________________________Attachment:
0001-fnmatch-3-Properly-escape-the-terminating-characte.patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bin00005.bin
Type: application/octet-stream
Size: 769 bytes
Desc: "Description: Binary data"
URL: <http://lists.dragonflybsd.org/pipermail/bugs/attachments/20090610/486262f7/attachment-0021.bin>
More information about the Bugs
mailing list