From owner-svn-src-all@freebsd.org Thu Jul 14 09:34:44 2016 Return-Path: Delivered-To: svn-src-all@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 472AAB920CF; Thu, 14 Jul 2016 09:34:44 +0000 (UTC) (envelope-from ache@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 F341F194D; Thu, 14 Jul 2016 09:34:43 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E9YhBG032136; Thu, 14 Jul 2016 09:34:43 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E9Yhrw032134; Thu, 14 Jul 2016 09:34:43 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607140934.u6E9Yhrw032134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 14 Jul 2016 09:34:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302829 - in head/bin/sh: . tests/builtins X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 09:34:44 -0000 Author: ache Date: Thu Jul 14 09:34:42 2016 New Revision: 302829 URL: https://svnweb.freebsd.org/changeset/base/302829 Log: Back out non-collating [a-z] ranges. Instead of changing the whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and focus on fixing bugs in what we have now, too many small obstacles we have choicing other way, counting ports. Corresponding libc changes are backed out in r302824. Modified: head/bin/sh/expand.c head/bin/sh/tests/builtins/case7.0 Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Thu Jul 14 09:31:52 2016 (r302828) +++ head/bin/sh/expand.c Thu Jul 14 09:34:42 2016 (r302829) @@ -107,6 +107,7 @@ static void expmeta(char *, char *, stru static int expsortcmp(const void *, const void *); static int patmatch(const char *, const char *); static void cvtnum(int, char *); +static int collate_range_cmp(wchar_t, wchar_t); void emptyarglist(struct arglist *list) @@ -137,6 +138,16 @@ appendarglist(struct arglist *list, char list->args[list->count++] = str; } +static int +collate_range_cmp(wchar_t c1, wchar_t c2) +{ + static wchar_t s1[2], s2[2]; + + s1[0] = c1; + s2[0] = c2; + return (wcscoll(s1, s2)); +} + static char * stputs_quotes(const char *data, const char *syntax, char *p) { @@ -1348,7 +1359,9 @@ patmatch(const char *pattern, const char return 0; } else wc2 = (unsigned char)*p++; - if (wc <= chr && chr <= wc2) + if ( collate_range_cmp(chr, wc) >= 0 + && collate_range_cmp(chr, wc2) <= 0 + ) found = 1; } else { if (chr == wc) Modified: head/bin/sh/tests/builtins/case7.0 ============================================================================== --- head/bin/sh/tests/builtins/case7.0 Thu Jul 14 09:31:52 2016 (r302828) +++ head/bin/sh/tests/builtins/case7.0 Thu Jul 14 09:34:42 2016 (r302829) @@ -14,6 +14,11 @@ c1=e c2=$(printf '\366') case $c1$c2 in -[a-z][!a-z]) ;; +[a-z][a-z]) ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2 in +[a-f][n-p]) ;; *) echo wrong at $LINENO ;; esac