GNU bug report logs - #76550
30.1; Test failure for fns-tests-collate-strings with musl libc

Previous Next

Package: emacs;

Reported by: Ulrich Müller <ulm <at> gentoo.org>

Date: Tue, 25 Feb 2025 11:53:01 UTC

Severity: minor

Found in version 30.1

Done: Paul Eggert <eggert <at> cs.ucla.edu>

To reply to this bug, email your comments to 76550 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Tue, 25 Feb 2025 11:53:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ulrich Müller <ulm <at> gentoo.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 25 Feb 2025 11:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ulrich Müller <ulm <at> gentoo.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.1; Test failure for fns-tests-collate-strings with musl libc
Date: Tue, 25 Feb 2025 12:49:49 +0100
Forwarding Gentoo bug https://bugs.gentoo.org/906012.

On an x86_64-pc-linux-musl system (musl libc 1.2.5), we see one test
failure in fns-tests-collate-strings:


Running 81 tests (2025-02-25 10:06:35+0000, selector `(not (or (tag :expensive-test) (tag :unstable) (tag :nativecomp)))')
   passed   1/81  fns--copy-alist (0.000116 sec)
   passed   2/81  fns--define-hash-table-test (0.000040 sec)
   passed   3/81  fns--string-to-unibyte-multibyte (0.000156 sec)
   passed   4/81  fns--take-ntake (0.000225 sec)
   passed   5/81  fns-append (0.000043 sec)
   passed   6/81  fns-concat (0.000062 sec)
   passed   7/81  fns-test-base64url-encode-region (0.000244 sec)
   passed   8/81  fns-test-base64url-encode-string (0.000083 sec)
   passed   9/81  fns-tests-base64-decode-string (0.000097 sec)
   passed  10/81  fns-tests-base64-encode-region (0.000090 sec)
   passed  11/81  fns-tests-base64-encode-string (0.000045 sec)
   passed  12/81  fns-tests-collate-sort (0.000180 sec)
Test fns-tests-collate-strings backtrace:
  signal(ert-test-failed (((should-error (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8")) :form (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8") :value t :fail-reason "did not signal an error")))
  ert-fail(((should-error (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8")) :form (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8") :value t :fail-reason "did not signal an error"))
  #f(compiled-function () #<bytecode -0xf4a78f5ec213ec3>)()
  #f(compiled-function () #<bytecode -0x1103712a176de548>)()
  handler-bind-1(#f(compiled-function () #<bytecode -0x1103712a176de548>) (error quit) #f(compiled-function (err) #<bytecode 0x1d814be4f72f192c>))
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test :name fns-tests-collate-strings :documentation nil :body #f(compiled-function () #<bytecode -0xf4a78f5ec213ec3>) :most-recent-result #s(ert-test-failed :messages "" :should-forms (... ... ... ... ... ...) :duration 9.6502e-05 :condition (ert-test-failed ...) :backtrace (... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :infos nil) :expected-result-type :passed :tags nil :file-name "/var/tmp/portage/app-editors/emacs-30.1/work/emacs-30.1/test/src/fns-tests.el") :result #s(ert-test-failed :messages "" :should-forms ((... :form ... :value t) (... :form ... :value t) (... :form ... :value nil) (... :form ... :value t) (... :form ... :value t) (... :form ... :value t)) :duration 9.6502e-05 :condition (ert-test-failed (... :form ... :value t :fail-reason "did not signal an error")) :backtrace (#s(backtrace-frame :evald t :fun signal :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-fail :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun #f(compiled-function () #<bytecode -0xf4a78f5ec213ec3>) :args nil :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun #f(compiled-function () #<bytecode -0x1103712a176de548>) :args nil :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun handler-bind-1 :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert--run-test-internal :args #0 :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-test :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-or-rerun-test :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-tests :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-tests-batch :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-tests-batch-and-exit :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun eval :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-line-1 :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-line :args nil :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun normal-top-level :args nil :flags nil :locals nil :buffer nil :pos nil)) :infos nil) :exit-continuation #f(compiled-function () #<bytecode 0x98f3573c9bd6c3>) :ert-debug-on-error nil))
  ert-run-test(#s(ert-test :name fns-tests-collate-strings :documentation nil :body #f(compiled-function () #<bytecode -0xf4a78f5ec213ec3>) :most-recent-result #s(ert-test-failed :messages "" :should-forms (((skip-unless (fns-tests--collate-enabled-p)) :form (fns-tests--collate-enabled-p) :value t) ((should (string-collate-equalp "xyzzy" "xyzzy")) :form (string-collate-equalp "xyzzy" "xyzzy") :value t) ((should-not (string-collate-equalp "xyzzy" "XYZZY")) :form (string-collate-equalp "xyzzy" "XYZZY") :value nil) ((should (string-collate-lessp "XYZZY" "xyzzy" "POSIX")) :form (string-collate-lessp "XYZZY" "xyzzy" "POSIX") :value t) ((should (string-collate-equalp "xyzzy" "XYZZY" nil t)) :form (string-collate-equalp "xyzzy" "XYZZY" nil t) :value t) ((should-error (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8")) :form (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8") :value t)) :duration 9.6502e-05 :condition (ert-test-failed ((should-error (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8")) :form (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8") :value t :fail-reason "did not signal an error")) :backtrace (#s(backtrace-frame :evald t :fun signal :args (ert-test-failed (...)) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-fail :args ((... :form ... :value t :fail-reason "did not signal an error")) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun #f(compiled-function () #<bytecode -0xf4a78f5ec213ec3>) :args nil :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun #f(compiled-function () #<bytecode -0x1103712a176de548>) :args nil :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun handler-bind-1 :args (#f(compiled-function () #<bytecode -0x1103712a176de548>) (error quit) #f(compiled-function (err) #<bytecode 0x1d814be4f72f192c>)) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert--run-test-internal :args (#s(ert--test-execution-info :test #1 :result #2 :exit-continuation #f(compiled-function () #<bytecode 0x98f3573c9bd6c3>) :ert-debug-on-error nil)) :flags nil :locals ((ert--infos) (lexical-binding . t)) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-test :args #0 :flags nil :locals ((ert--running-tests #1) (message-log-max . t) (ert--should-execution-observer . #f(compiled-function (form-description) #<bytecode -0x68c27499cc3ea68>))) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-or-rerun-test :args (#s(ert--stats :selector ... :tests ... :test-map #<hash-table eql 81/81 0x1800022ce8f7 ...> :test-results ... :test-start-times ... :test-end-times ... :passed-expected 12 :passed-unexpected 0 :failed-expected 0 :failed-unexpected 1 :skipped 0 :start-time ... :end-time nil :aborted-p nil :current-test #1 :next-redisplay 0.0) #1 #f(compiled-function (event-type &rest event-args) #<bytecode 0x1073d527539a2e17>)) :flags nil :locals ((ert--current-run-stats . ...)) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-tests :args ((not ...) #f(compiled-function (event-type &rest event-args) #<bytecode 0x1073d527539a2e17>) nil) :flags nil :locals ((ert--current-run-stats . ...)) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-tests-batch :args ((not ...)) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-tests-batch-and-exit :args ((not ...)) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun eval :args ((ert-run-tests-batch-and-exit ...) t) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-line-1 :args (("-L" ":." "-l" "ert" "--eval" "(setq treesit-extra-load-path '(\"/var/tmp/portage/app-editors/emacs-30.1/homedir/.emacs.d/tree-sitter\"))" "--eval" "(setq ert-batch-backtrace-right-margin nil)" "-l" "src/fns-tests" "--eval" "(ert-run-tests-batch-and-exit (quote (not (or (tag :expensive-test) (tag :unstable) (tag :nativecomp)))))")) :flags nil :locals ((command-line-args-left) (argi . "-eval")) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-line :args nil :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun normal-top-level :args nil :flags nil :locals nil :buffer nil :pos nil)) :infos nil) :expected-result-type :passed :tags nil :file-name "/var/tmp/portage/app-editors/emacs-30.1/work/emacs-30.1/test/src/fns-tests.el"))
  ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-map #<hash-table eql 81/81 0x1800022ce8f7 ...> :test-results ... :test-start-times ... :test-end-times ... :passed-expected 12 :passed-unexpected 0 :failed-expected 0 :failed-unexpected 1 :skipped 0 :start-time ... :end-time nil :aborted-p nil ...) #s(ert-test :name fns-tests-collate-strings :documentation nil :body #f(compiled-function () #<bytecode -0xf4a78f5ec213ec3>) :most-recent-result ... :expected-result-type :passed :tags nil :file-name "/var/tmp/portage/app-editors/emacs-30.1/work/emacs-30.1/test/src/fns-tests.el") #f(compiled-function (event-type &rest event-args) #<bytecode 0x1073d527539a2e17>))
  ert-run-tests((not (or (tag :expensive-test) (tag :unstable) (tag :nativecomp))) #f(compiled-function (event-type &rest event-args) #<bytecode 0x1073d527539a2e17>) nil)
  ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable) (tag :nativecomp))))
  ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :unstable) (tag :nativecomp))))
  eval((ert-run-tests-batch-and-exit '(not (or (tag :expensive-test) (tag :unstable) (tag :nativecomp)))) t)
  command-line-1(("-L" ":." "-l" "ert" "--eval" "(setq treesit-extra-load-path '(\"/var/tmp/portage/app-editors/emacs-30.1/homedir/.emacs.d/tree-sitter\"))" "--eval" "(setq ert-batch-backtrace-right-margin nil)" "-l" "src/fns-tests" "--eval" "(ert-run-tests-batch-and-exit (quote (not (or (tag :expensive-test) (tag :unstable) (tag :nativecomp)))))"))
  command-line()
  normal-top-level()

Test fns-tests-collate-strings condition:
    (ert-test-failed
     ((should-error (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8"))
      :form (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8") :value t
      :fail-reason "did not signal an error"))
   FAILED  13/81  fns-tests-collate-strings (0.000097 sec) at src/fns-tests.el:264
   passed  14/81  fns-tests-compare-strings (0.000099 sec)
   passed  15/81  fns-tests-equal-including-properties (0.000083 sec)
   passed  16/81  fns-tests-equal-including-properties/string-prop-vals (0.000060 sec)
   passed  17/81  fns-tests-equal-symbols-with-position (0.000059 sec)
   passed  18/81  fns-tests-equality-nan (0.000041 sec)
   passed  19/81  fns-tests-func-arity (0.005018 sec)
   passed  20/81  fns-tests-hash-buffer (0.000075 sec)
   passed  21/81  fns-tests-identity (0.000042 sec)
   passed  22/81  fns-tests-length (0.000045 sec)
   passed  23/81  fns-tests-mapcan (0.000047 sec)
   passed  24/81  fns-tests-mapconcat (0.000053 sec)
   passed  25/81  fns-tests-nreverse (0.000056 sec)
   passed  26/81  fns-tests-nreverse-bool-vector (0.000041 sec)
   passed  27/81  fns-tests-random (0.000067 sec)
   passed  28/81  fns-tests-reverse (0.000077 sec)
   passed  29/81  fns-tests-reverse-bool-vector (0.000058 sec)
   passed  30/81  fns-tests-safe-length (0.000057 sec)
   passed  31/81  fns-tests-sort (0.827500 sec)
   passed  32/81  fns-tests-sort-gc (0.133975 sec)
   passed  33/81  fns-tests-sort-kw (0.027079 sec)
   passed  34/81  fns-tests-string-bytes (0.000046 sec)
   passed  35/81  fns-tests-string-lessp (0.000394 sec)
   passed  36/81  fns-tests-string-version-lessp (0.000054 sec)
   passed  37/81  fns-value<-bool-vector (0.003720 sec)
   passed  38/81  fns-value<-circle (0.000046 sec)
   passed  39/81  fns-value<-ordered (0.000362 sec)
   passed  40/81  fns-value<-symbol-with-pos (0.000084 sec)
   passed  41/81  fns-value<-type-mismatch (0.000129 sec)
   passed  42/81  fns-value<-unordered (0.000055 sec)
   passed  43/81  fns-vconcat (0.000054 sec)
   passed  44/81  length-equals-tests (0.000066 sec)
   passed  45/81  object-intervals (0.000058 sec)
   passed  46/81  plist-get/odd-number-of-elements (0.000038 sec)
   passed  47/81  plist-member/improper-list (0.000041 sec)
   passed  48/81  plist-put/odd-number-of-elements (0.000040 sec)
   passed  49/81  string-search (0.000099 sec)
   passed  50/81  test-assoc-testfn (0.000053 sec)
   passed  51/81  test-bignum-eql (0.000044 sec)
   passed  52/81  test-bignum-hash (0.000044 sec)
   passed  53/81  test-buffer-line-stats-gap (0.001859 sec)
   passed  54/81  test-buffer-line-stats-nogap (0.000082 sec)
   passed  55/81  test-cycle-assoc (0.000066 sec)
   passed  56/81  test-cycle-assq (0.000063 sec)
   passed  57/81  test-cycle-delete (0.000120 sec)
   passed  58/81  test-cycle-delq (0.000091 sec)
   passed  59/81  test-cycle-equal (0.000067 sec)
   passed  60/81  test-cycle-length (0.000053 sec)
   passed  61/81  test-cycle-member (0.000067 sec)
   passed  62/81  test-cycle-memq (0.000064 sec)
   passed  63/81  test-cycle-memql (0.000071 sec)
   passed  64/81  test-cycle-nconc (0.000051 sec)
   passed  65/81  test-cycle-plist-get (0.000058 sec)
   passed  66/81  test-cycle-plist-member (0.000064 sec)
   passed  67/81  test-cycle-plist-put (0.000066 sec)
   passed  68/81  test-cycle-rassoc (0.000098 sec)
   passed  69/81  test-cycle-rassq (0.000065 sec)
   passed  70/81  test-cycle-reverse (0.000064 sec)
   passed  71/81  test-cycle-safe-length (0.000069 sec)
   passed  72/81  test-hash-function-that-mutates-hash-table (0.000064 sec)
   passed  73/81  test-line-number-at-position (0.000051 sec)
   passed  74/81  test-nthcdr-circular (0.000284 sec)
   passed  75/81  test-nthcdr-simple (0.000041 sec)
   passed  76/81  test-plist (0.000061 sec)
   passed  77/81  test-proper-list-p (0.000063 sec)
   passed  78/81  test-secure-hash (0.000066 sec)
   passed  79/81  test-string-distance (0.000067 sec)
   passed  80/81  test-sxhash-equal (0.000058 sec)
   passed  81/81  test-vector-delete (0.000054 sec)

Ran 81 tests, 80 results as expected, 1 unexpected (2025-02-25 10:06:36+0000, 1.101394 sec)

1 unexpected results:
   FAILED  fns-tests-collate-strings  ((should-error (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8")) :form (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8") :value t :fail-reason "did not signal an error")

make[3]: *** [Makefile:185: src/fns-tests.log] Error 1


The problem is that (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8")
doesn't signal an error with musl libc. This is because newlocale(3)
always succeeds, regardless of the string passed as its second argument.

(Note that bug #62420 had addressed a failure of the same test, and the
fix was to replace "en_DE.UTF-8" with "en_XY.UTF-8". This definitely
isn't enough to fix the problem on musl.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Tue, 25 Feb 2025 16:07:02 GMT) Full text and rfc822 format available.

Message #8 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Ulrich Müller <ulm <at> gentoo.org>
To: 76550 <at> debbugs.gnu.org
Subject: Re: 30.1; Test failure for fns-tests-collate-strings with musl libc
Date: Tue, 25 Feb 2025 17:06:04 +0100
[Message part 1 (text/plain, inline)]
Would attached patch be acceptable as a fix?

[0001-Fix-fns-tests.el-with-musl-libc.patch (text/plain, inline)]
From 403191534a1dda4e396ae05dd8a34c3230e9a7fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <ulm <at> gentoo.org>
Date: Tue, 25 Feb 2025 17:03:02 +0100
Subject: [PATCH] ; Fix fns-tests.el with musl libc

* test/src/fns-tests.el (fns-tests-collate-strings): Don't test
for valid locale with musl libc.  (Bug#76550)
---
 test/src/fns-tests.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index 9e134c24e05..f15896cfd57 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -277,7 +277,9 @@ fns-tests-collate-strings
   (should (string-collate-equalp "xyzzy" "XYZZY" nil t))
 
   ;; Locale must be valid.
-  (should-error (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8")))
+  ;; musl's newlocale(3) is lenient about locale validation (bug#76550).
+  (unless (string-match-p "-musl" system-configuration)
+    (should-error (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8"))))
 
 ;; There must be a check for valid codepoints.  (Check not implemented yet)
 ;  (should-error
-- 
2.48.1


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Tue, 25 Feb 2025 16:30:03 GMT) Full text and rfc822 format available.

Message #11 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ulrich Müller <ulm <at> gentoo.org>
Cc: 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1;
 Test failure for fns-tests-collate-strings with musl libc
Date: Tue, 25 Feb 2025 18:29:19 +0200
> From: Ulrich Müller <ulm <at> gentoo.org>
> Date: Tue, 25 Feb 2025 12:49:49 +0100
> 
> 1 unexpected results:
>    FAILED  fns-tests-collate-strings  ((should-error (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8")) :form (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8") :value t :fail-reason "did not signal an error")
> 
> make[3]: *** [Makefile:185: src/fns-tests.log] Error 1
> 
> 
> The problem is that (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8")
> doesn't signal an error with musl libc. This is because newlocale(3)
> always succeeds, regardless of the string passed as its second argument.
> 
> (Note that bug #62420 had addressed a failure of the same test, and the
> fix was to replace "en_DE.UTF-8" with "en_XY.UTF-8". This definitely
> isn't enough to fix the problem on musl.)

I think this quirk is glibc-specific, and the test should be disabled
in the musl build.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Tue, 25 Feb 2025 17:24:02 GMT) Full text and rfc822 format available.

Message #14 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ulrich Müller <ulm <at> gentoo.org>
Cc: 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1;
 Test failure for fns-tests-collate-strings with musl libc
Date: Tue, 25 Feb 2025 19:23:29 +0200
> From: Ulrich Müller <ulm <at> gentoo.org>
> Date: Tue, 25 Feb 2025 17:06:04 +0100
> 
> Would attached patch be acceptable as a fix?

Are musl builds guaranteed to have "-musl" in system-configuration?
Or is that just in the builds you are doing?

II thought about using some musl-specific symbol, or even creating one
if none already exists.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Tue, 25 Feb 2025 18:29:02 GMT) Full text and rfc822 format available.

Message #17 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Ulrich Müller <ulm <at> gentoo.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Ulrich Müller <ulm <at> gentoo.org>, 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings
 with musl libc
Date: Tue, 25 Feb 2025 19:27:53 +0100
>>>>> On Tue, 25 Feb 2025, Eli Zaretskii wrote:

> Are musl builds guaranteed to have "-musl" in system-configuration?
> Or is that just in the builds you are doing?

musl.m4 from Gnulib does this:

  case "$host_os" in
    *-musl* | midipix*)
      AC_DEFINE([MUSL_LIBC], [1], [Define to 1 on musl libc.])
      ;;
  esac

> II thought about using some musl-specific symbol, or even creating one
> if none already exists.

I cannot find any such symbol in the sources.

Presumably, the most specific feature check would be for the return
value of newlocale(3), depending on its second argument. Then again,
newlocale is called by str_collate (in sysdep.c), which in turn is
called by string-collate-equalp.

Effectively, the test checks for the exact feature that we need, in
order to decide whether the test should be called. :) IMHO it is pretty
much pointless.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Tue, 25 Feb 2025 19:49:02 GMT) Full text and rfc822 format available.

Message #20 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ulrich Müller <ulm <at> gentoo.org>
Cc: 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings
 with musl libc
Date: Tue, 25 Feb 2025 21:48:19 +0200
> From: Ulrich Müller <ulm <at> gentoo.org>
> Cc: Ulrich Müller <ulm <at> gentoo.org>,  76550 <at> debbugs.gnu.org
> Date: Tue, 25 Feb 2025 19:27:53 +0100
> 
> >>>>> On Tue, 25 Feb 2025, Eli Zaretskii wrote:
> 
> > Are musl builds guaranteed to have "-musl" in system-configuration?
> > Or is that just in the builds you are doing?
> 
> musl.m4 from Gnulib does this:
> 
>   case "$host_os" in
>     *-musl* | midipix*)
>       AC_DEFINE([MUSL_LIBC], [1], [Define to 1 on musl libc.])
>       ;;
>   esac

So it could also be "midipix"?

> > II thought about using some musl-specific symbol, or even creating one
> > if none already exists.
> 
> I cannot find any such symbol in the sources.

We could make a new symbol, if that's useful.

> Presumably, the most specific feature check would be for the return
> value of newlocale(3), depending on its second argument. Then again,
> newlocale is called by str_collate (in sysdep.c), which in turn is
> called by string-collate-equalp.
> 
> Effectively, the test checks for the exact feature that we need, in
> order to decide whether the test should be called. :) IMHO it is pretty
> much pointless.

Sorry, you lost me here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Tue, 25 Feb 2025 20:13:01 GMT) Full text and rfc822 format available.

Message #23 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Ulrich Müller <ulm <at> gentoo.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Ulrich Müller <ulm <at> gentoo.org>, 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings
 with musl libc
Date: Tue, 25 Feb 2025 21:12:35 +0100
>>>>> On Tue, 25 Feb 2025, Eli Zaretskii wrote:

>> From: Ulrich Müller <ulm <at> gentoo.org>
>> Cc: Ulrich Müller <ulm <at> gentoo.org>,  76550 <at> debbugs.gnu.org
>> Date: Tue, 25 Feb 2025 19:27:53 +0100
>> 
>> >>>>> On Tue, 25 Feb 2025, Eli Zaretskii wrote:
>> 
>> > Are musl builds guaranteed to have "-musl" in system-configuration?
>> > Or is that just in the builds you are doing?
>> 
>> musl.m4 from Gnulib does this:
>> 
>> case "$host_os" in
>> *-musl* | midipix*)
>> AC_DEFINE([MUSL_LIBC], [1], [Define to 1 on musl libc.])
>> ;;
>> esac

> So it could also be "midipix"?

midipix seems to be a development environment on Windows (using musl,
I guess?), see https://midipix.org/. We could of course check for both
strings, but I have no way to test with midipix.

>> > II thought about using some musl-specific symbol, or even creating one
>> > if none already exists.
>> 
>> I cannot find any such symbol in the sources.

> We could make a new symbol, if that's useful.

That feels a little over-engineered just to control a single test, at
least for my taste.

>> Presumably, the most specific feature check would be for the return
>> value of newlocale(3), depending on its second argument. Then again,
>> newlocale is called by str_collate (in sysdep.c), which in turn is
>> called by string-collate-equalp.
>> 
>> Effectively, the test checks for the exact feature that we need, in
>> order to decide whether the test should be called. :) IMHO it is pretty
>> much pointless.

> Sorry, you lost me here.

The test succeeds with glibc, where newlocale checks validity of the
locale. And it fails with musl, where newlocale's checks are lenient.
So one could say that the test is for a feature of the C library but not
for any feature of Emacs.




Severity set to 'minor' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 25 Feb 2025 23:22:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Wed, 26 Feb 2025 06:58:02 GMT) Full text and rfc822 format available.

Message #28 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Ulrich Müller <ulm <at> gentoo.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Ulrich Müller <ulm <at> gentoo.org>, 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings
 with musl libc
Date: Wed, 26 Feb 2025 07:57:32 +0100
>>>>> On Tue, 25 Feb 2025, Ulrich Müller wrote:

>>>>> On Tue, 25 Feb 2025, Eli Zaretskii wrote:
>> We could make a new symbol, if that's useful.

> That feels a little over-engineered just to control a single test, at
> least for my taste.

Maybe I misunderstood you there. Did you mean a new value for the
system-type variable, like 'musl/linux?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Wed, 26 Feb 2025 13:22:02 GMT) Full text and rfc822 format available.

Message #31 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ulrich Müller <ulm <at> gentoo.org>, Paul Eggert
 <eggert <at> cs.ucla.edu>
Cc: 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings
 with musl libc
Date: Wed, 26 Feb 2025 15:21:18 +0200
> From: Ulrich Müller <ulm <at> gentoo.org>
> Cc: Ulrich Müller <ulm <at> gentoo.org>,  76550 <at> debbugs.gnu.org
> Date: Tue, 25 Feb 2025 21:12:35 +0100
> 
> >>>>> On Tue, 25 Feb 2025, Eli Zaretskii wrote:
> 
> >> > II thought about using some musl-specific symbol, or even creating one
> >> > if none already exists.
> >> 
> >> I cannot find any such symbol in the sources.
> 
> > We could make a new symbol, if that's useful.
> 
> That feels a little over-engineered just to control a single test, at
> least for my taste.

If you insist to not have this test fail (is it really a problem?),
then why not do it cleanly?

But okay, matching the system-configuration string might also be okay,
just add a comment there explaining why we do that.

And please install the change on master, not on the release branch.

> >> Presumably, the most specific feature check would be for the return
> >> value of newlocale(3), depending on its second argument. Then again,
> >> newlocale is called by str_collate (in sysdep.c), which in turn is
> >> called by string-collate-equalp.
> >> 
> >> Effectively, the test checks for the exact feature that we need, in
> >> order to decide whether the test should be called. :) IMHO it is pretty
> >> much pointless.
> 
> > Sorry, you lost me here.
> 
> The test succeeds with glibc, where newlocale checks validity of the
> locale. And it fails with musl, where newlocale's checks are lenient.
> So one could say that the test is for a feature of the C library but not
> for any feature of Emacs.

Ah, but the code which calls newlocale depends on that validity check.

Maybe Paul has some comments or suggestions.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Wed, 26 Feb 2025 13:59:02 GMT) Full text and rfc822 format available.

Message #34 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ulrich Müller <ulm <at> gentoo.org>
Cc: 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings
 with musl libc
Date: Wed, 26 Feb 2025 15:58:48 +0200
> From: Ulrich Müller <ulm <at> gentoo.org>
> Cc: 76550 <at> debbugs.gnu.org, Ulrich Müller <ulm <at> gentoo.org>
> Date: Wed, 26 Feb 2025 07:57:32 +0100
> 
> >>>>> On Tue, 25 Feb 2025, Ulrich Müller wrote:
> 
> >>>>> On Tue, 25 Feb 2025, Eli Zaretskii wrote:
> >> We could make a new symbol, if that's useful.
> 
> > That feels a little over-engineered just to control a single test, at
> > least for my taste.
> 
> Maybe I misunderstood you there. Did you mean a new value for the
> system-type variable, like 'musl/linux?

No, I thought about a symbol named, say, libc-name.  We'd need to give
it a value on all systems, of course.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Wed, 26 Feb 2025 14:46:02 GMT) Full text and rfc822 format available.

Message #37 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Ulrich Müller <ulm <at> gentoo.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Ulrich Müller <ulm <at> gentoo.org>,
 Paul Eggert <eggert <at> cs.ucla.edu>, 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings
 with musl libc
Date: Wed, 26 Feb 2025 15:44:43 +0100
>>>>> On Wed, 26 Feb 2025, Eli Zaretskii wrote:

> If you insist to not have this test fail (is it really a problem?),
> then why not do it cleanly?

Tests are enabled in Gentoo, so we have to disable any failing tests
in our ebuild. IIUC the only method is via EXCLUDE_TESTS which operates
on the file level, i.e. disabling one specific test isn't even possible.
So yes, it is a problem.

> But okay, matching the system-configuration string might also be okay,

In fact, I went with the documentation of system-type in the lispref
manual:

| If you need to make a finer distinction than ‘system-type’ allows for,
| you can test ‘system-configuration’, e.g., against a regexp."

> just add a comment there explaining why we do that.

Sure, can do.

> And please install the change on master, not on the release branch.

Why? I don't see how disabling this test could break anything. (And I'd
really like to have it fixed in the next release.)

>> >> Presumably, the most specific feature check would be for the
>> >> return value of newlocale(3), depending on its second argument.
>> >> Then again, newlocale is called by str_collate (in sysdep.c),
>> >> which in turn is called by string-collate-equalp.
>> >> 
>> >> Effectively, the test checks for the exact feature that we need,
>> >> in order to decide whether the test should be called. :) IMHO it
>> >> is pretty much pointless.
>> 
>> > Sorry, you lost me here.
>> 
>> The test succeeds with glibc, where newlocale checks validity of the
>> locale. And it fails with musl, where newlocale's checks are lenient.
>> So one could say that the test is for a feature of the C library but
>> not for any feature of Emacs.

> Ah, but the code which calls newlocale depends on that validity check.

> Maybe Paul has some comments or suggestions.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Wed, 26 Feb 2025 15:45:02 GMT) Full text and rfc822 format available.

Message #40 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ulrich Müller <ulm <at> gentoo.org>
Cc: eggert <at> cs.ucla.edu, 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings
 with musl libc
Date: Wed, 26 Feb 2025 17:44:26 +0200
> From: Ulrich Müller <ulm <at> gentoo.org>
> Cc: Ulrich Müller <ulm <at> gentoo.org>,  Paul Eggert
>  <eggert <at> cs.ucla.edu>,
>   76550 <at> debbugs.gnu.org
> Date: Wed, 26 Feb 2025 15:44:43 +0100
> 
> > But okay, matching the system-configuration string might also be okay,
> 
> In fact, I went with the documentation of system-type in the lispref
> manual:
> 
> | If you need to make a finer distinction than ‘system-type’ allows for,
> | you can test ‘system-configuration’, e.g., against a regexp."
> 
> > just add a comment there explaining why we do that.
> 
> Sure, can do.

Thanks.

> > And please install the change on master, not on the release branch.
> 
> Why? I don't see how disabling this test could break anything. (And I'd
> really like to have it fixed in the next release.)

You can do that in your own repository, can't you?

The reason I don't want this on the release branch as that this change
potentially affects every system, and fixing tests on the release
branch is low priority anyway (the test suite is something we develop
for our own needs, not for the users).  So would like to avoid an
unnecessary, if small, risk on the release branch, especially since
30.1 has been released already.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Wed, 26 Feb 2025 20:39:01 GMT) Full text and rfc822 format available.

Message #43 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Ulrich Müller <ulm <at> gentoo.org>, 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings with
 musl libc
Date: Wed, 26 Feb 2025 12:38:20 -0800
On 2/26/25 05:21, Eli Zaretskii wrote:
> Maybe Paul has some comments or suggestions.

I suggest the following patch.

I see no portable way to specify an invalid locale (which is what the 
test wants), and little point to going to the trouble of trying to 
figure out exactly which platforms allow this particular string and 
which don't.

diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index 3d6cd5de8fe..e97ae275da6 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -277,7 +277,7 @@ fns-tests-collate-strings
   (should (string-collate-equalp "xyzzy" "XYZZY" nil t))

   ;; Locale must be valid.
-  (should-error (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8")))
+  (should-error (string-collate-equalp "xyzzy" "xyzzy" 'not-a-locale)))

 ;; There must be a check for valid codepoints.  (Check not implemented 
yet)
 ;  (should-error





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Thu, 27 Feb 2025 04:59:02 GMT) Full text and rfc822 format available.

Message #46 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Ulrich Müller <ulm <at> gentoo.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 76550 <at> debbugs.gnu.org,
 Ulrich Müller <ulm <at> gentoo.org>
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings
 with musl libc
Date: Thu, 27 Feb 2025 05:58:02 +0100
>>>>> On Wed, 26 Feb 2025, Paul Eggert wrote:

> On 2/26/25 05:21, Eli Zaretskii wrote:
>> Maybe Paul has some comments or suggestions.

> I suggest the following patch.

> I see no portable way to specify an invalid locale (which is what the
> test wants), and little point to going to the trouble of trying to
> figure out exactly which platforms allow this particular string and
> which don't.

> diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
> index 3d6cd5de8fe..e97ae275da6 100644
> --- a/test/src/fns-tests.el
> +++ b/test/src/fns-tests.el
> @@ -277,7 +277,7 @@ fns-tests-collate-strings
>    (should (string-collate-equalp "xyzzy" "XYZZY" nil t))
>
>    ;; Locale must be valid.
> -  (should-error (string-collate-equalp "xyzzy" "xyzzy" "en_XY.UTF-8")))
> +  (should-error (string-collate-equalp "xyzzy" "xyzzy" 'not-a-locale)))
>
>  ;; There must be a check for valid codepoints.  (Check not
>     implemented yet)
>  ;  (should-error

I confirm that this patch makes the test pass with musl 1.2.5.

(The __STDC_ISO_10646__ macro was introduced in musl 1.1.15, released
in 2016: https://git.musl-libc.org/cgit/musl/tree/WHATSNEW#n1707
Presumably the test would still fail with older musl versions, but I
think it is OK to ignore that.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Thu, 27 Feb 2025 08:02:02 GMT) Full text and rfc822 format available.

Message #49 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: ulm <at> gentoo.org, 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings with
 musl libc
Date: Thu, 27 Feb 2025 10:00:51 +0200
> Date: Wed, 26 Feb 2025 12:38:20 -0800
> Cc: 76550 <at> debbugs.gnu.org, Ulrich Müller <ulm <at> gentoo.org>
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> 
> On 2/26/25 05:21, Eli Zaretskii wrote:
> > Maybe Paul has some comments or suggestions.
> 
> I suggest the following patch.
> 
> I see no portable way to specify an invalid locale (which is what the 
> test wants), and little point to going to the trouble of trying to 
> figure out exactly which platforms allow this particular string and 
> which don't.

Thanks, this is okay to install on the release branch.  (Although it
tests a slightly different issue, AFAICT.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Thu, 27 Feb 2025 11:37:01 GMT) Full text and rfc822 format available.

Message #52 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>,
 Ulrich Müller <ulm <at> gentoo.org>
Cc: eggert <at> cs.ucla.edu, 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings with
 musl libc
Date: Thu, 27 Feb 2025 03:36:35 -0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> The reason I don't want this on the release branch as that this change
> potentially affects every system, and fixing tests on the release
> branch is low priority anyway (the test suite is something we develop
> for our own needs, not for the users).  So would like to avoid an
> unnecessary, if small, risk on the release branch, especially since
> 30.1 has been released already.

FWIW, I don't see any risk with disabling this test on emacs-30.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76550; Package emacs. (Thu, 27 Feb 2025 13:12:02 GMT) Full text and rfc822 format available.

Message #55 received at 76550 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: ulm <at> gentoo.org, eggert <at> cs.ucla.edu, 76550 <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings with
 musl libc
Date: Thu, 27 Feb 2025 15:11:16 +0200
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Thu, 27 Feb 2025 03:36:35 -0800
> Cc: eggert <at> cs.ucla.edu, 76550 <at> debbugs.gnu.org
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > The reason I don't want this on the release branch as that this change
> > potentially affects every system, and fixing tests on the release
> > branch is low priority anyway (the test suite is something we develop
> > for our own needs, not for the users).  So would like to avoid an
> > unnecessary, if small, risk on the release branch, especially since
> > 30.1 has been released already.
> 
> FWIW, I don't see any risk with disabling this test on emacs-30.

Yes, that would be also good.  But I think Paul found a better
solution.




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Thu, 27 Feb 2025 19:00:02 GMT) Full text and rfc822 format available.

Notification sent to Ulrich Müller <ulm <at> gentoo.org>:
bug acknowledged by developer. (Thu, 27 Feb 2025 19:00:02 GMT) Full text and rfc822 format available.

Message #60 received at 76550-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: ulm <at> gentoo.org, 76550-done <at> debbugs.gnu.org
Subject: Re: bug#76550: 30.1; Test failure for fns-tests-collate-strings with
 musl libc
Date: Thu, 27 Feb 2025 10:59:16 -0800
On 2025-02-27 00:00, Eli Zaretskii wrote:
> Thanks, this is okay to install on the release branch.  (Although it
> tests a slightly different issue, AFAICT.)

That it does. I installed it and am closing this bug report.




This bug report was last modified 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.