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: patch

To reply to this bug, email your comments to 56861 AT debbugs.gnu.org.

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-sed <at> gnu.org:
bug#56861; Package sed. (Sun, 31 Jul 2022 16:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sören Tempel <soeren <at> soeren-tempel.net>:
New bug report received and forwarded. Copy sent to bug-sed <at> gnu.org. (Sun, 31 Jul 2022 16:44:02 GMT) Full text and rfc822 format available.

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

From: Sören Tempel <soeren <at> soeren-tempel.net>
To: bug-sed <at> gnu.org
Subject: [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.




Information forwarded to bug-sed <at> gnu.org:
bug#56861; Package sed. (Sat, 31 Dec 2022 22:29:02 GMT) Full text and rfc822 format available.

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

From: Sam James <sam <at> gentoo.org>
To: 56861 <at> debbugs.gnu.org
Subject: Bug 56861
Date: Sat, 31 Dec 2022 22:27:41 +0000
[Message part 1 (text/plain, inline)]
This is a gnulib bug and should be been fixed by:
1. https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=aae308a3354bb3d0ae0bdf8647ce9be8e46abbce
2. https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=6ee6c7189f4bafbb603ef043fdf44b84c3f7532a

sed 4.9 is the first release to have these changes.
[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 1 year and 327 days ago.

Previous Next


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