From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#31318: emacs-26 fns-tests-collate-sort failure on glibc 2.27 Date: Mon, 30 Apr 2018 17:39:57 -0700 Organization: UCLA Computer Science Department Message-ID: <6182b73c-4ba6-8f28-0ef4-74107d1ca9dc@cs.ucla.edu> References: <1cf43452-0e5f-f1f6-6368-d975fd273ce7@cs.ucla.edu> <83vac8qxru.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------01F27C6068067B1E239D8BBC" X-Trace: blaine.gmane.org 1525135150 23491 195.159.176.226 (1 May 2018 00:39:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 1 May 2018 00:39:10 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 Cc: 31318@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 01 02:39:05 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fDJJv-0005zJ-52 for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 May 2018 02:39:03 +0200 Original-Received: from localhost ([::1]:34329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDJM1-0006tY-Rt for geb-bug-gnu-emacs@m.gmane.org; Mon, 30 Apr 2018 20:41:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDJLv-0006tS-J7 for bug-gnu-emacs@gnu.org; Mon, 30 Apr 2018 20:41:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fDJLq-0004OZ-Oh for bug-gnu-emacs@gnu.org; Mon, 30 Apr 2018 20:41:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36674) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fDJLq-0004O2-Jo for bug-gnu-emacs@gnu.org; Mon, 30 Apr 2018 20:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fDJLq-0007nR-Ao for bug-gnu-emacs@gnu.org; Mon, 30 Apr 2018 20:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 May 2018 00:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31318 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 31318-submit@debbugs.gnu.org id=B31318.152513520829897 (code B ref 31318); Tue, 01 May 2018 00:41:02 +0000 Original-Received: (at 31318) by debbugs.gnu.org; 1 May 2018 00:40:08 +0000 Original-Received: from localhost ([127.0.0.1]:44571 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fDJKx-0007m9-Fi for submit@debbugs.gnu.org; Mon, 30 Apr 2018 20:40:07 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:47188) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fDJKu-0007lY-QJ for 31318@debbugs.gnu.org; Mon, 30 Apr 2018 20:40:05 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 01AE416006A; Mon, 30 Apr 2018 17:39:59 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id x-VG1hVAU-PB; Mon, 30 Apr 2018 17:39:57 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B4E38160081; Mon, 30 Apr 2018 17:39:57 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 66FUlU6cH3fo; Mon, 30 Apr 2018 17:39:57 -0700 (PDT) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 9860D16006A; Mon, 30 Apr 2018 17:39:57 -0700 (PDT) In-Reply-To: <83vac8qxru.fsf@gnu.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:145881 Archived-At: This is a multi-part message in MIME format. --------------01F27C6068067B1E239D8BBC Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 04/30/2018 12:50 PM, Eli Zaretskii wrote: > > you are saying that 'ls' now sorts differently in UTF-8 > locales on Fedora 28? That is, it no longer ignores punctuation in > file names? Doesn't that cause user outcry? Yes, that's what I'm saying, at least for en_US.utf8. I haven't heard any user outcry. Not that I've been listening for one.... > This is backwards: Windows needs enu_USA, not en_US.UTF-8 (which is > not supported on Windows). Thanks, that was a silly typo. Revised patch attached, for the emacs-26 branch. > Why did they change the collation order? To be more consistent with other platforms, as I understand it. The idea is to do collation consistent with ISO/IEC 14651 . For more details, please see . Regardless of whether one thinks the change was a good idea, the Emacs tests should be portable to any POSIX platform, and since POSIX does not specify how the en_US.utf8 locale works the tests should not insist on either the old glibc implementation or the new one. --------------01F27C6068067B1E239D8BBC Content-Type: text/x-patch; name="0001-Port-collation-tests-to-glibc-2.27.patch" Content-Disposition: attachment; filename="0001-Port-collation-tests-to-glibc-2.27.patch" Content-Transfer-Encoding: quoted-printable >From 5fa31399dc87fc518152e6b695aebb7a5c60825b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 30 Apr 2018 17:18:38 -0700 Subject: [PATCH] Port collation tests to glibc 2.27 MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * test/src/fns-tests.el (fns-tests-collate-strings) (fns-tests-collate-sort): Don=E2=80=99t make unportable assumptions about how en_US.UTF-8 collation works. These assumptions are not true on Fedora 28, which ships with glibc 2.27. --- test/src/fns-tests.el | 48 +++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index f8554636ba..641947d66a 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -119,10 +119,9 @@ fns-tests--collate-enabled-p =20 ;; In POSIX or C locales, collation order is lexicographic. (should (string-collate-lessp "XYZZY" "xyzzy" "POSIX")) - ;; In a language specific locale, collation order is different. - (should (string-collate-lessp - "xyzzy" "XYZZY" - (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))) + ;; In a language specific locale on MS-Windows, collation order is dif= ferent. + (when (eq system-type 'windows-nt) + (should (string-collate-lessp "xyzzy" "XYZZY" "enu_USA"))) =20 ;; Ignore case. (should (string-collate-equalp "xyzzy" "XYZZY" nil t)) @@ -154,8 +153,6 @@ fns-tests--collate-enabled-p (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")]))) =20 (ert-deftest fns-tests-collate-sort () - ;; See https://lists.gnu.org/r/emacs-devel/2015-10/msg02505.html. - :expected-result (if (eq system-type 'cygwin) :failed :passed) (skip-unless (fns-tests--collate-enabled-p)) =20 ;; Punctuation and whitespace characters are relevant for POSIX. @@ -165,15 +162,16 @@ fns-tests--collate-enabled-p (lambda (a b) (string-collate-lessp a b "POSIX"))) '("1 1" "1 2" "1.1" "1.2" "11" "12"))) ;; Punctuation and whitespace characters are not taken into account - ;; for collation in other locales. - (should - (equal - (sort '("11" "12" "1 1" "1 2" "1.1" "1.2") - (lambda (a b) - (let ((w32-collate-ignore-punctuation t)) - (string-collate-lessp - a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))))= ) - '("11" "1 1" "1.1" "12" "1 2" "1.2"))) + ;; for collation in other locales, on MS-Windows systems. + (when (eq system-type 'windows-nt) + (should + (equal + (sort '("11" "12" "1 1" "1 2" "1.1" "1.2") + (lambda (a b) + (let ((w32-collate-ignore-punctuation t)) + (string-collate-lessp + a b "enu_USA")))) + '("11" "1 1" "1.1" "12" "1 2" "1.2")))) =20 ;; Diacritics are different letters for POSIX, they sort lexicographic= al. (should @@ -181,15 +179,17 @@ fns-tests--collate-enabled-p (sort '("=C3=86var" "Agust=C3=ADn" "Adrian" "Eli") (lambda (a b) (string-collate-lessp a b "POSIX"))) '("Adrian" "Agust=C3=ADn" "Eli" "=C3=86var"))) - ;; Diacritics are sorted between similar letters for other locales. - (should - (equal - (sort '("=C3=86var" "Agust=C3=ADn" "Adrian" "Eli") - (lambda (a b) - (let ((w32-collate-ignore-punctuation t)) - (string-collate-lessp - a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))))= ) - '("Adrian" "=C3=86var" "Agust=C3=ADn" "Eli")))) + ;; Diacritics are sorted between similar letters for other locales, + ;; on MS-Windows systems. + (when (eq system-type 'windows-nt) + (should + (equal + (sort '("=C3=86var" "Agust=C3=ADn" "Adrian" "Eli") + (lambda (a b) + (let ((w32-collate-ignore-punctuation t)) + (string-collate-lessp + a b "enu_USA")))) + '("Adrian" "=C3=86var" "Agust=C3=ADn" "Eli"))))) =20 (ert-deftest fns-tests-string-version-lessp () (should (string-version-lessp "foo2.png" "foo12.png")) --=20 2.17.0 --------------01F27C6068067B1E239D8BBC--