NetBSD Problem Report #41558
From www@NetBSD.org Mon Jun 8 17:08:29 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 679E263B9E6
for <gnats-bugs@gnats.netbsd.org>; Mon, 8 Jun 2009 17:08:29 +0000 (UTC)
Message-Id: <20090608170829.225B063B8B4@www.NetBSD.org>
Date: Mon, 8 Jun 2009 17:08:29 +0000 (UTC)
From: ekamperi@gmail.com
Reply-To: ekamperi@gmail.com
To: gnats-bugs@NetBSD.org
Subject: fnmatch(3) translates '\' followed by '0' to '\'
X-Send-Pr-Version: www-1.0
>Number: 41558
>Category: lib
>Synopsis: fnmatch(3) translates '\' followed by '0' to '\'
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: lib-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jun 08 17:10:00 +0000 2009
>Closed-Date: Tue Dec 18 05:28:52 +0000 2012
>Last-Modified: Tue Dec 18 05:28:52 +0000 2012
>Originator: Stathis Kamperis
>Release: NetBSD 5.0_STABLE/i386
>Organization:
Aristotle University of Thessaloniki
>Environment:
currently unavailable
>Description:
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-current.
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 ?
>How-To-Repeat:
#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)
}
>Fix:
>Release-Note:
>Audit-Trail:
From: "Jukka Ruohonen" <jruoho@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/41558 CVS commit: src
Date: Sun, 18 Mar 2012 08:52:08 +0000
Module Name: src
Committed By: jruoho
Date: Sun Mar 18 08:52:08 UTC 2012
Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/lib/libc/gen: Makefile
Added Files:
src/tests/lib/libc/gen: t_fnmatch.c
Log Message:
Add a case for PR lib/41558. It is unclear whether this is a bug, but at
least it is documented now. Probably it would be better to follow Linux,
where the test case does not fail.
To generate a diff of this commit:
cvs rdiff -u -r1.446 -r1.447 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.35 -r1.36 src/tests/lib/libc/gen/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/gen/t_fnmatch.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/41558 CVS commit: src/lib/libc/gen
Date: Sun, 25 Mar 2012 12:31:23 -0400
Module Name: src
Committed By: christos
Date: Sun Mar 25 16:31:23 UTC 2012
Modified Files:
src/lib/libc/gen: fnmatch.c
Log Message:
PR/41558: Stathis Kamperis: Treat a backslash followed by NUL as NUL, instead
of a backslash if FNM_NOESCAPE is not set. According to TOG: a backslash in
a pattern followed by any other character, will match that second character
in the string.
To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/gen/fnmatch.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/41558 CVS commit: src/tests/lib/libc/gen
Date: Sun, 25 Mar 2012 12:31:51 -0400
Module Name: src
Committed By: christos
Date: Sun Mar 25 16:31:51 UTC 2012
Modified Files:
src/tests/lib/libc/gen: t_fnmatch.c
Log Message:
PR/41558 has been fixed.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/gen/t_fnmatch.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sun, 25 Mar 2012 17:44:25 +0000
State-Changed-Why:
Does christos' commit solve the issue for you?
State-Changed-From-To: feedback->closed
State-Changed-By: jruoho@NetBSD.org
State-Changed-When: Tue, 18 Dec 2012 05:28:52 +0000
State-Changed-Why:
Feedback timeout (for a feedback not required given the supplied test code).
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.