Adept's Lab wrote:
> >> test-canonicalize.c:411: assertion 'strcmp (result1, "//") == 0' failed

Thanks for the report. I reproduce it with gnulib testdirs
  $ rm -rf ../testdir1; ./gnulib-tool --create-testdir --dir=../testdir1 
--single-configure canonicalize-lgpl
  $ rm -rf ../testdir2; ./gnulib-tool --create-testdir --dir=../testdir2 
--single-configure canonicalize
when run on Alpine Linux 3.9, 3.14, and 3.19.

History of these failures:
  - For many years, one of the tests was failing on Alpine Linux.
  - On 2021-01-17, I added a fix, that consists of a realpath() override [1].
  - On 2022-07-31, the bug was reported again [2], against the sed-4.8 release
    which predates the 2021-01-17 fix [3].
  - On 2023-09-04, Paul changed the behaviour of the unit tests on musl libc,
    without giving an explanation [4].
  - Now, the unit tests fail again, as reported above.

I'm therefore partially reverting Paul's change from 2023-09-04 (attached).

Paul Eggert wrote:
> Does this behavior (of whether / and // are the same directory) depend 
> on musl version, or on how musl is configured?

I think you must ask this to yourself:
  - What caused you to change the unit tests on 2023-09-04?
  - How is the musl version that you used on that date configured?
    What I use is Alpine Linux, as I said in versions 3.9, 3.14, 3.19.
  - Did you work with gnulib testdirs at that time, or did you use
    a package in which some modules are --avoid ed from import?

Bruno

[1] https://lists.gnu.org/archive/html/bug-gnulib/2021-01/msg00215.html
[2] https://lists.gnu.org/archive/html/bug-sed/2022-07/msg00003.html
[3] https://ftp.gnu.org/gnu/sed/
[4] https://lists.gnu.org/archive/html/bug-gnulib/2023-09/msg00011.html
From 1defda6356c29c7f731bddb9e9231f594e01d9c9 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 31 Mar 2024 21:31:34 +0200
Subject: [PATCH] canonicalize[-lgpl] tests: Fix test failure on musl libc.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reported by Adept's Lab <adepts...@gmail.com> via Pádraig Brady at
<https://lists.gnu.org/archive/html/bug-coreutils/2024-03/msg00086.html>.

* tests/test-canonicalize-lgpl.c (main): Don't special-case "//"
handling for musl libc.
* tests/test-canonicalize.c (main): Likewise.
* modules/canonicalize-lgpl-tests (Files): Remove m4/musl.m4.
(configure.ac): Don't invoke gl_MUSL_LIBC.
---
 ChangeLog                       | 11 +++++++++++
 modules/canonicalize-lgpl-tests |  2 --
 tests/test-canonicalize-lgpl.c  |  6 +++---
 tests/test-canonicalize.c       |  6 +++---
 4 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2f05098a08..ffae5513ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-03-31  Bruno Haible  <br...@clisp.org>
+
+	canonicalize[-lgpl] tests: Fix test failure on musl libc.
+	Reported by Adept's Lab <adepts...@gmail.com> via Pádraig Brady at
+	<https://lists.gnu.org/archive/html/bug-coreutils/2024-03/msg00086.html>.
+	* tests/test-canonicalize-lgpl.c (main): Don't special-case "//"
+	handling for musl libc.
+	* tests/test-canonicalize.c (main): Likewise.
+	* modules/canonicalize-lgpl-tests (Files): Remove m4/musl.m4.
+	(configure.ac): Don't invoke gl_MUSL_LIBC.
+
 2024-03-31  Collin Funk  <collin.fu...@gmail.com>
 
 	gnulib-tool.py: Fix output of 'po/LINGUAS'.
diff --git a/modules/canonicalize-lgpl-tests b/modules/canonicalize-lgpl-tests
index 409ee7225b..73a0e32abb 100644
--- a/modules/canonicalize-lgpl-tests
+++ b/modules/canonicalize-lgpl-tests
@@ -1,5 +1,4 @@
 Files:
-m4/musl.m4
 tests/test-canonicalize-lgpl.c
 tests/signature.h
 tests/null-ptr.h
@@ -11,7 +10,6 @@ same-inode
 symlink
 
 configure.ac:
-gl_MUSL_LIBC
 
 Makefile.am:
 TESTS += test-canonicalize-lgpl
diff --git a/tests/test-canonicalize-lgpl.c b/tests/test-canonicalize-lgpl.c
index 1b2ad98f51..21211e5eac 100644
--- a/tests/test-canonicalize-lgpl.c
+++ b/tests/test-canonicalize-lgpl.c
@@ -262,9 +262,9 @@ main (void)
     ASSERT (stat ("/", &st1) == 0);
     ASSERT (stat ("//", &st2) == 0);
     bool same = psame_inode (&st1, &st2);
-#if defined __MVS__ || defined MUSL_LIBC
-    /* On IBM z/OS and musl libc, "/" and "//" both canonicalize to
-       themselves, yet they both have st_dev == st_ino == 1.  */
+#if defined __MVS__
+    /* On IBM z/OS, "/" and "//" both canonicalize to themselves, yet they both
+       have st_dev == st_ino == 1.  */
     same = false;
 #endif
     if (same)
diff --git a/tests/test-canonicalize.c b/tests/test-canonicalize.c
index 6763a525c9..5d19285c00 100644
--- a/tests/test-canonicalize.c
+++ b/tests/test-canonicalize.c
@@ -394,9 +394,9 @@ main (void)
     ASSERT (stat ("/", &st1) == 0);
     ASSERT (stat ("//", &st2) == 0);
     bool same = psame_inode (&st1, &st2);
-#if defined __MVS__ || defined MUSL_LIBC
-    /* On IBM z/OS and musl libc, "/" and "//" both canonicalize to
-       themselves, yet they both have st_dev == st_ino == 1.  */
+#if defined __MVS__
+    /* On IBM z/OS, "/" and "//" both canonicalize to themselves, yet they both
+       have st_dev == st_ino == 1.  */
     same = false;
 #endif
     if (same)
-- 
2.34.1

Reply via email to