From owner-svn-src-all@FreeBSD.ORG Sun Jun 12 12:54:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78A85106564A; Sun, 12 Jun 2011 12:54:52 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 696958FC0C; Sun, 12 Jun 2011 12:54:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5CCsqAe025633; Sun, 12 Jun 2011 12:54:52 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5CCsqbW025631; Sun, 12 Jun 2011 12:54:52 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106121254.p5CCsqbW025631@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 12 Jun 2011 12:54:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223010 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 12 Jun 2011 12:54:52 -0000 Author: jilles Date: Sun Jun 12 12:54:52 2011 New Revision: 223010 URL: http://svn.freebsd.org/changeset/base/223010 Log: sh: Fix locale-dependent ranges in bracket expressions. When I added UTF-8 support in r221646, the LC_COLLATE-based ordering broke because of sign extension of char. Because of libc restrictions, this does not work for UTF-8. For UTF-8 locales, ranges always use character code order. Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Sun Jun 12 12:51:58 2011 (r223009) +++ head/bin/sh/expand.c Sun Jun 12 12:54:52 2011 (r223010) @@ -1430,7 +1430,7 @@ patmatch(const char *pattern, const char if (localeisutf8) wc = get_wc(&q); else - wc = *q++; + wc = (unsigned char)*q++; if (wc == '\0') return 0; break; @@ -1487,7 +1487,7 @@ patmatch(const char *pattern, const char if (localeisutf8) chr = get_wc(&q); else - chr = *q++; + chr = (unsigned char)*q++; if (chr == '\0') return 0; c = *p++; @@ -1502,7 +1502,7 @@ patmatch(const char *pattern, const char if (wc == 0) /* bad utf-8 */ return 0; } else - wc = c; + wc = (unsigned char)c; if (*p == '-' && p[1] != ']') { p++; while (*p == CTLQUOTEMARK) @@ -1514,7 +1514,7 @@ patmatch(const char *pattern, const char if (wc2 == 0) /* bad utf-8 */ return 0; } else - wc2 = *p++; + wc2 = (unsigned char)*p++; if ( collate_range_cmp(chr, wc) >= 0 && collate_range_cmp(chr, wc2) <= 0 )