Date: Tue, 15 Aug 2017 00:54:17 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322524 - in stable/11/lib/libc: gen tests/gen Message-ID: <201708150054.v7F0sHVF056379@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Tue Aug 15 00:54:16 2017 New Revision: 322524 URL: https://svnweb.freebsd.org/changeset/base/322524 Log: MFC r322368, r322371: fnmatch(3): improve POSIX conformance. In a recent interpretation[1], "\\" shall return a non-zero value (indicating either no match or an error). The fix involves a change over r254091 and now the behavior matches the Sun/IBM/HP closed source implementations and also likely musl libc. Submitted by: Joerg Schilling <joerg at schily.net> [1] http://austingroupbugs.net/view.php?id=806 Modified: stable/11/lib/libc/gen/fnmatch.c stable/11/lib/libc/tests/gen/fnmatch_testcases.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/fnmatch.c ============================================================================== --- stable/11/lib/libc/gen/fnmatch.c Mon Aug 14 23:46:10 2017 (r322523) +++ stable/11/lib/libc/gen/fnmatch.c Tue Aug 15 00:54:16 2017 (r322524) @@ -184,7 +184,8 @@ fnmatch1(const char *pattern, const char *string, cons if (!(flags & FNM_NOESCAPE)) { pclen = mbrtowc(&pc, pattern, MB_LEN_MAX, &patmbs); - if (pclen == (size_t)-1 || pclen == (size_t)-2) + if (pclen == 0 || pclen == (size_t)-1 || + pclen == (size_t)-2) return (FNM_NOMATCH); pattern += pclen; } Modified: stable/11/lib/libc/tests/gen/fnmatch_testcases.h ============================================================================== --- stable/11/lib/libc/tests/gen/fnmatch_testcases.h Mon Aug 14 23:46:10 2017 (r322523) +++ stable/11/lib/libc/tests/gen/fnmatch_testcases.h Tue Aug 15 00:54:16 2017 (r322524) @@ -131,7 +131,7 @@ struct testcase { { "\\(", "\\(", 0, FNM_NOMATCH }, { "\\a", "\\a", 0, FNM_NOMATCH }, { "\\", "\\", 0, FNM_NOMATCH }, - { "\\", "", 0, 0 }, + { "\\", "", 0, FNM_NOMATCH }, { "\\*", "\\*", FNM_NOESCAPE, 0 }, { "\\?", "\\?", FNM_NOESCAPE, 0 }, { "\\", "\\", FNM_NOESCAPE, 0 },
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708150054.v7F0sHVF056379>