bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56861: [PATCH] test-canonicalize-lgpl fails with musl libc


From: Sören Tempel
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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]