看板 DFBSD_bugs 關於我們 聯絡資訊
--===============0097263600== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable New submission from Stathis Kamperis <ekamperi@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' ? Inste= ad '\' 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 trans= late 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 =3D fnmatch(/* pattern */ "\\", "\\", 0); assert(rv =3D=3D 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@lists.dragonflybsd.org> <http://bugs.dragonflybsd.org/issue1399> _____________________________________________________ --===============0097263600== Content-Type: application/octet-stream MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="0001-fnmatch-3-Properly-escape-the-terminating-characte.patch" RnJvbSBhMDgzMGMyMTAzN2Y0ZjYyYzY4MzM0ZWQ0Nzc3Y2M1NDRkMjg2OWM3IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBTdGF0aGlzIEthbXBlcmlzIDxiZWtldEBkcmFnb25mbHlic2Qu b3JnPgpEYXRlOiBXZWQsIDEwIEp1biAyMDA5IDIyOjE5OjQ4ICswMzAwClN1YmplY3Q6IFtQQVRD SF0gZm5tYXRjaCgzKTogUHJvcGVybHkgZXNjYXBlIHRoZSB0ZXJ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