* bug#31318: emacs-26 fns-tests-collate-sort failure on glibc 2.27
@ 2018-04-30 17:36 Paul Eggert
2018-04-30 19:50 ` Eli Zaretskii
2019-06-18 23:52 ` Paul Eggert
0 siblings, 2 replies; 7+ messages in thread
From: Paul Eggert @ 2018-04-30 17:36 UTC (permalink / raw)
To: 31318
[-- Attachment #1: Type: text/plain, Size: 447 bytes --]
I upgraded to Fedora 28 beta over the weekend (Fedora 28 is scheduled
for release next week) and ran into one test case failure on the
emacs-26 branch: fns-tests-collate-sort fails (test/src/fns-tests.log is
attached). Looking into the test, it appears that the test is making
unportable assumptions about strcoll behavior in non-POSIX locales, an
assumption that is not true of glibc 2.27 as shipped in Fedora 28.
Proposed patch attached.
[-- Attachment #2: fns-tests.log --]
[-- Type: text/x-log, Size: 3157 bytes --]
Running 37 tests (2018-04-30 10:14:49-0700)
Test fns-tests-collate-sort backtrace:
signal(ert-test-failed (((should (equal (sort '("11" "1 2" "1.2" "12
ert-fail(((should (equal (sort '("11" "1 2" "1.2" "12") (lambda (a b
(if (unwind-protect (setq value-355 (apply fn-353 args-354)) (setq f
(let (form-description-357) (if (unwind-protect (setq value-355 (app
(let ((value-355 'ert-form-evaluation-aborted-356)) (let (form-descr
(let* ((fn-353 (function equal)) (args-354 (condition-case err (let
(lambda nil (let* ((fn-343 (function fns-tests--collate-enabled-p))
ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
ert-run-test(#s(ert-test :name fns-tests-collate-sort :documentation
ert-run-or-rerun-test(#s(ert--stats :selector (not (or (tag :expensi
ert-run-tests((not (or (tag :expensive-test) (tag :unstable))) #f(co
ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable)))
ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :un
eval((ert-run-tests-batch-and-exit '(not (or (tag :expensive-test) (
command-line-1(("-L" ":." "-l" "ert" "-l" "src/fns-tests.el" "--eval
command-line()
normal-top-level()
Test fns-tests-collate-sort condition:
(ert-test-failed
((should
(equal
(sort ... ...)
'...))
:form
(equal
("1 1" "1.1" "11" "1 2" "1.2" "12")
("11" "1 1" "1.1" "12" "1 2" "1.2"))
:value nil :explanation
(list-elt 0
(arrays-of-different-length 3 2 "1 1" "11" first-mismatch-at 1))))
FAILED 1/37 fns-tests-collate-sort
passed 2/37 fns-tests-collate-strings
passed 3/37 fns-tests-compare-strings
passed 4/37 fns-tests-func-arity
passed 5/37 fns-tests-hash-buffer
passed 6/37 fns-tests-mapcan
passed 7/37 fns-tests-nreverse
passed 8/37 fns-tests-nreverse-bool-vector
passed 9/37 fns-tests-reverse
passed 10/37 fns-tests-reverse-bool-vector
passed 11/37 fns-tests-sort
passed 12/37 fns-tests-string-version-lessp
passed 13/37 lax-plist-get/odd-number-of-elements
passed 14/37 lax-plist-put/odd-number-of-elements
passed 15/37 plist-get/odd-number-of-elements
passed 16/37 plist-member/improper-list
passed 17/37 plist-put/odd-number-of-elements
passed 18/37 test-assoc-testfn
passed 19/37 test-cycle-assoc
passed 20/37 test-cycle-assq
passed 21/37 test-cycle-delete
passed 22/37 test-cycle-delq
passed 23/37 test-cycle-equal
passed 24/37 test-cycle-lax-plist-get
passed 25/37 test-cycle-lax-plist-put
passed 26/37 test-cycle-length
passed 27/37 test-cycle-member
passed 28/37 test-cycle-memq
passed 29/37 test-cycle-memql
passed 30/37 test-cycle-nconc
passed 31/37 test-cycle-plist-get
passed 32/37 test-cycle-plist-member
passed 33/37 test-cycle-plist-put
passed 34/37 test-cycle-rassoc
passed 35/37 test-cycle-rassq
passed 36/37 test-cycle-reverse
passed 37/37 test-cycle-safe-length
Ran 37 tests, 36 results as expected, 1 unexpected (2018-04-30 10:14:52-0700)
1 unexpected results:
FAILED fns-tests-collate-sort
[-- Attachment #3: 0001-Port-collation-tests-to-glibc-2.27.txt --]
[-- Type: text/plain, Size: 3937 bytes --]
From deaadc19c8a59b69bc53b735f9f66e93304010e9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 30 Apr 2018 10:35:04 -0700
Subject: [PATCH] Port collation tests to glibc 2.27
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* test/src/fns-tests.el (fns-tests-collate-strings)
(fns-tests-collate-sort): Don’t 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..491915f56a 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -119,10 +119,9 @@ fns-tests--collate-enabled-p
;; 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 different.
+ (when (eq system-type 'windows-nt)
+ (should (string-collate-lessp "xyzzy" "XYZZY" "en_US.UTF-8")))
;; 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")])))
(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))
;; 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"))))
;; Diacritics are different letters for POSIX, they sort lexicographical.
(should
@@ -181,15 +179,17 @@ fns-tests--collate-enabled-p
(sort '("Ævar" "Agustín" "Adrian" "Eli")
(lambda (a b) (string-collate-lessp a b "POSIX")))
'("Adrian" "Agustín" "Eli" "Ævar")))
- ;; Diacritics are sorted between similar letters for other locales.
- (should
- (equal
- (sort '("Ævar" "Agustín" "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" "Ævar" "Agustín" "Eli"))))
+ ;; Diacritics are sorted between similar letters for other locales,
+ ;; on MS-Windows systems.
+ (when (eq system-type 'windows-nt)
+ (should
+ (equal
+ (sort '("Ævar" "Agustín" "Adrian" "Eli")
+ (lambda (a b)
+ (let ((w32-collate-ignore-punctuation t))
+ (string-collate-lessp
+ a b "enu_USA"))))
+ '("Adrian" "Ævar" "Agustín" "Eli")))))
(ert-deftest fns-tests-string-version-lessp ()
(should (string-version-lessp "foo2.png" "foo12.png"))
--
2.17.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#31318: emacs-26 fns-tests-collate-sort failure on glibc 2.27
2018-04-30 17:36 bug#31318: emacs-26 fns-tests-collate-sort failure on glibc 2.27 Paul Eggert
@ 2018-04-30 19:50 ` Eli Zaretskii
2018-05-01 0:39 ` Paul Eggert
2019-06-18 23:52 ` Paul Eggert
1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2018-04-30 19:50 UTC (permalink / raw)
To: Paul Eggert; +Cc: 31318
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Mon, 30 Apr 2018 10:36:31 -0700
>
> I upgraded to Fedora 28 beta over the weekend (Fedora 28 is scheduled
> for release next week) and ran into one test case failure on the
> emacs-26 branch: fns-tests-collate-sort fails (test/src/fns-tests.log is
> attached). Looking into the test, it appears that the test is making
> unportable assumptions about strcoll behavior in non-POSIX locales, an
> assumption that is not true of glibc 2.27 as shipped in Fedora 28.
Really? So 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?
> - ;; 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 different.
> + (when (eq system-type 'windows-nt)
> + (should (string-collate-lessp "xyzzy" "XYZZY" "en_US.UTF-8")))
This is backwards: Windows needs enu_USA, not en_US.UTF-8 (which is
not supported on Windows).
> - ;; Diacritics are sorted between similar letters for other locales.
> - (should
> - (equal
> - (sort '("Ævar" "Agustín" "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" "Ævar" "Agustín" "Eli"))))
> + ;; Diacritics are sorted between similar letters for other locales,
> + ;; on MS-Windows systems.
> + (when (eq system-type 'windows-nt)
> + (should
> + (equal
> + (sort '("Ævar" "Agustín" "Adrian" "Eli")
> + (lambda (a b)
> + (let ((w32-collate-ignore-punctuation t))
> + (string-collate-lessp
> + a b "enu_USA"))))
> + '("Adrian" "Ævar" "Agustín" "Eli")))))
So none of this now works on Fedora 28? That's too bad, don't you
think? Why did they change the collation order?
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#31318: emacs-26 fns-tests-collate-sort failure on glibc 2.27
2018-04-30 19:50 ` Eli Zaretskii
@ 2018-05-01 0:39 ` Paul Eggert
2018-05-01 16:11 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Paul Eggert @ 2018-05-01 0:39 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 31318
[-- Attachment #1: Type: text/plain, Size: 1106 bytes --]
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
<https://www.iso.org/standard/68309.html>. For more details, please see
<https://sourceware.org/bugzilla/show_bug.cgi?id=14095>.
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Port-collation-tests-to-glibc-2.27.patch --]
[-- Type: text/x-patch; name="0001-Port-collation-tests-to-glibc-2.27.patch", Size: 4032 bytes --]
From 5fa31399dc87fc518152e6b695aebb7a5c60825b Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
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=UTF-8
Content-Transfer-Encoding: 8bit
* test/src/fns-tests.el (fns-tests-collate-strings)
(fns-tests-collate-sort): Don’t 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
;; 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 different.
+ (when (eq system-type 'windows-nt)
+ (should (string-collate-lessp "xyzzy" "XYZZY" "enu_USA")))
;; 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")])))
(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))
;; 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"))))
;; Diacritics are different letters for POSIX, they sort lexicographical.
(should
@@ -181,15 +179,17 @@ fns-tests--collate-enabled-p
(sort '("Ævar" "Agustín" "Adrian" "Eli")
(lambda (a b) (string-collate-lessp a b "POSIX")))
'("Adrian" "Agustín" "Eli" "Ævar")))
- ;; Diacritics are sorted between similar letters for other locales.
- (should
- (equal
- (sort '("Ævar" "Agustín" "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" "Ævar" "Agustín" "Eli"))))
+ ;; Diacritics are sorted between similar letters for other locales,
+ ;; on MS-Windows systems.
+ (when (eq system-type 'windows-nt)
+ (should
+ (equal
+ (sort '("Ævar" "Agustín" "Adrian" "Eli")
+ (lambda (a b)
+ (let ((w32-collate-ignore-punctuation t))
+ (string-collate-lessp
+ a b "enu_USA"))))
+ '("Adrian" "Ævar" "Agustín" "Eli")))))
(ert-deftest fns-tests-string-version-lessp ()
(should (string-version-lessp "foo2.png" "foo12.png"))
--
2.17.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#31318: emacs-26 fns-tests-collate-sort failure on glibc 2.27
2018-05-01 0:39 ` Paul Eggert
@ 2018-05-01 16:11 ` Eli Zaretskii
2018-05-01 16:31 ` Paul Eggert
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2018-05-01 16:11 UTC (permalink / raw)
To: Paul Eggert; +Cc: 31318
> Cc: 31318@debbugs.gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Mon, 30 Apr 2018 17:39:57 -0700
>
> 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.
Absolutely. But IMO it'd be a pity not to be able to test this
important functionality on Posix platforms. So how about replacing
these tests with something that works in a non-en_US locale in a way
that is different from en_US? The functions being tested signal an
error if a locale passed to them is not installed, so it should be
possible to test whether a locale is available before running a test
with it.
WDYT?
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#31318: emacs-26 fns-tests-collate-sort failure on glibc 2.27
2018-05-01 16:11 ` Eli Zaretskii
@ 2018-05-01 16:31 ` Paul Eggert
2018-05-01 16:49 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Paul Eggert @ 2018-05-01 16:31 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 31318
On 05/01/2018 09:11 AM, Eli Zaretskii wrote:
> how about replacing
> these tests with something that works in a non-en_US locale in a way
> that is different from en_US?
Something along those lines could be done (it's done in coreutils with
French), but it's a bit tricky so presumably it should be done in
master. In contrast the patch I'm proposing is designed for emacs-26.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#31318: emacs-26 fns-tests-collate-sort failure on glibc 2.27
2018-05-01 16:31 ` Paul Eggert
@ 2018-05-01 16:49 ` Eli Zaretskii
0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2018-05-01 16:49 UTC (permalink / raw)
To: Paul Eggert; +Cc: 31318
> Cc: 31318@debbugs.gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Tue, 1 May 2018 09:31:30 -0700
>
> On 05/01/2018 09:11 AM, Eli Zaretskii wrote:
> > how about replacing
> > these tests with something that works in a non-en_US locale in a way
> > that is different from en_US?
>
> Something along those lines could be done (it's done in coreutils with
> French), but it's a bit tricky so presumably it should be done in
> master. In contrast the patch I'm proposing is designed for emacs-26.
I'm okay with applying your patch to emacs-26 and then re-adding tests
on master.
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#31318: emacs-26 fns-tests-collate-sort failure on glibc 2.27
2018-04-30 17:36 bug#31318: emacs-26 fns-tests-collate-sort failure on glibc 2.27 Paul Eggert
2018-04-30 19:50 ` Eli Zaretskii
@ 2019-06-18 23:52 ` Paul Eggert
1 sibling, 0 replies; 7+ messages in thread
From: Paul Eggert @ 2019-06-18 23:52 UTC (permalink / raw)
To: 31318-done
This patch was installed into the emacs-26 branch last year but I forgot
to close the bug report. Closing it now.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-06-18 23:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-30 17:36 bug#31318: emacs-26 fns-tests-collate-sort failure on glibc 2.27 Paul Eggert
2018-04-30 19:50 ` Eli Zaretskii
2018-05-01 0:39 ` Paul Eggert
2018-05-01 16:11 ` Eli Zaretskii
2018-05-01 16:31 ` Paul Eggert
2018-05-01 16:49 ` Eli Zaretskii
2019-06-18 23:52 ` Paul Eggert
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).