GNU bug report logs - #56861
[PATCH] test-canonicalize-lgpl fails with musl libc

Previous Next

Package: sed;

Reported by: Sören Tempel <soeren <at> soeren-tempel.net>

Date: Sun, 31 Jul 2022 16:44:01 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 4.9

Done: Collin Funk <collin.funk1 <at> gmail.com>

Full log


View this message in rfc822 format

From: Sören Tempel <soeren <at> soeren-tempel.net>
To: 56861 <at> debbugs.gnu.org
Subject: bug#56861: [PATCH] test-canonicalize-lgpl fails with musl libc
Date: Sun, 31 Jul 2022 15:44:13 +0200
Hi,

While enabling the sed test suite for the Alpine Linux sed package, I
noticed that the test-canonicalize-lgpl test case fails because musl
does not provide canonicalize_file_name and hence sed uses a compat
implementation which invokes realpath(3). However, musl realpath(3)
implementation does not strip leading // characters hence the following
test from gnulib-tests/test-canonicalize-lgpl.c fails (handling of
leading // is implementation-defined in POSIX):

	203     /* On IBM z/OS, "/" and "//" are distinct, yet they both have
	204        st_dev == st_ino == 1.  */
	205 #ifndef __MVS__
	206     if (SAME_INODE (st1, st2))
	207       {
	208         ASSERT (strcmp (result1, "/") == 0);
	209         ASSERT (strcmp (result2, "/") == 0);
	210       }
	211     else
	212 #endif

The problem being the assertions in line 208 and 209.

The following patch fixes this issue:

diff -upr sed-4.8.orig/gnulib-tests/test-canonicalize-lgpl.c sed-4.8/gnulib-tests/test-canonicalize-lgpl.c
--- sed-4.8.orig/gnulib-tests/test-canonicalize-lgpl.c	2022-07-31 15:28:20.249302470 +0200
+++ sed-4.8/gnulib-tests/test-canonicalize-lgpl.c	2022-07-31 15:30:03.099518653 +0200
@@ -200,9 +200,9 @@ main (void)
     ASSERT (result2);
     ASSERT (stat ("/", &st1) == 0);
     ASSERT (stat ("//", &st2) == 0);
-    /* On IBM z/OS, "/" and "//" are distinct, yet they both have
-       st_dev == st_ino == 1.  */
-#ifndef __MVS__
+    /* On IBM z/OS and musl libc, "/" and "//" are distinct, yet
+       they both have st_dev == st_ino == 1.  */
+#if !defined(__MVS__) && !defined(MUSL_LIBC)
     if (SAME_INODE (st1, st2))
       {
         ASSERT (strcmp (result1, "/") == 0);

Greetings,
Sören

PS: Please CC me, I am not subscribed to the list.




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.