From owner-svn-src-stable@freebsd.org Tue Oct 10 21:04:41 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDD0FE3CF54; Tue, 10 Oct 2017 21:04:41 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B18616CB5D; Tue, 10 Oct 2017 21:04:41 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9AL4eYU085911; Tue, 10 Oct 2017 21:04:40 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9AL4eSM085909; Tue, 10 Oct 2017 21:04:40 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201710102104.v9AL4eSM085909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 10 Oct 2017 21:04:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r324505 - in stable/10/lib/libc: gen tests/gen X-SVN-Group: stable-10 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in stable/10/lib/libc: gen tests/gen X-SVN-Commit-Revision: 324505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Oct 2017 21:04:42 -0000 Author: pfg Date: Tue Oct 10 21:04:40 2017 New Revision: 324505 URL: https://svnweb.freebsd.org/changeset/base/324505 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 [1] http://austingroupbugs.net/view.php?id=806 Modified: stable/10/lib/libc/gen/fnmatch.c stable/10/lib/libc/tests/gen/fnmatch_testcases.h Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/fnmatch.c ============================================================================== --- stable/10/lib/libc/gen/fnmatch.c Tue Oct 10 20:45:45 2017 (r324504) +++ stable/10/lib/libc/gen/fnmatch.c Tue Oct 10 21:04:40 2017 (r324505) @@ -188,7 +188,8 @@ fnmatch1(pattern, string, stringstart, flags, patmbs, 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/10/lib/libc/tests/gen/fnmatch_testcases.h ============================================================================== --- stable/10/lib/libc/tests/gen/fnmatch_testcases.h Tue Oct 10 20:45:45 2017 (r324504) +++ stable/10/lib/libc/tests/gen/fnmatch_testcases.h Tue Oct 10 21:04:40 2017 (r324505) @@ -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 },