On Linux/hppa, I see a test failure:

$ cat test-strerrorname_np.log 
Segmentation fault (core dumped)
FAIL test-strerrorname_np (exit status: 139)

The gdb stack trace reveals the cause:
(gdb) where
#0  0xf95c4920 in ?? ()
#1  0x000113c4 in main () at ../../gltests/test-strerrorname_np.c:1130

Here is a workaround.


2023-11-21  Bruno Haible  <br...@clisp.org>

        strerrorname_np: Work around glibc bug on HPPA systems.
        * m4/strerrorname_np.m4 (gl_FUNC_STRERRORNAME_NP): Test also
        strerrorname_np (ENOSYM).
        * lib/strerrorname_np.c (strerrorname_np): Update comments.
        * tests/test-strerrorname_np.c (main): Likewise.
        * doc/glibc-functions/strerrorname_np.texi: Mention that glibc 2.37
        still needs a workaround.

diff --git a/doc/glibc-functions/strerrorname_np.texi 
b/doc/glibc-functions/strerrorname_np.texi
index b9c6252b15..b8928cc21c 100644
--- a/doc/glibc-functions/strerrorname_np.texi
+++ b/doc/glibc-functions/strerrorname_np.texi
@@ -21,7 +21,8 @@
 This function returns wrong values on some platforms:
 @c https://sourceware.org/bugzilla/show_bug.cgi?id=26555
 @c https://sourceware.org/bugzilla/show_bug.cgi?id=29545
-glibc 2.36.
+@c https://sourceware.org/bugzilla/show_bug.cgi?id=31080
+glibc 2.37.
 @end itemize
 
 Portability problems not fixed by Gnulib:
diff --git a/lib/strerrorname_np.c b/lib/strerrorname_np.c
index 4445a88ac6..23c0902b3b 100644
--- a/lib/strerrorname_np.c
+++ b/lib/strerrorname_np.c
@@ -1123,7 +1123,7 @@ strerrorname_np (int errnum)
     #if defined ENOSHARE
     case ENOSHARE:        return "ENOSHARE";
     #endif
-    /* HP-UX, OSF/1 */
+    /* Linux, HP-UX, OSF/1 */
     #if defined ENOSYM
     case ENOSYM:          return "ENOSYM";
     #endif
@@ -1247,7 +1247,7 @@ strerrorname_np (int errnum)
     #if defined EREMOTEIO
     case EREMOTEIO:       return "EREMOTEIO";
     #endif
-    /* HP-UX */
+    /* Linux, HP-UX */
     #if defined EREMOTERELEASE
     case EREMOTERELEASE:  return "EREMOTERELEASE";
     #endif
diff --git a/m4/strerrorname_np.m4 b/m4/strerrorname_np.m4
index 2894f72449..47bcf070d7 100644
--- a/m4/strerrorname_np.m4
+++ b/m4/strerrorname_np.m4
@@ -1,4 +1,4 @@
-# strerrorname_np.m4 serial 4
+# strerrorname_np.m4 serial 5
 dnl Copyright (C) 2020-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -21,6 +21,9 @@ AC_DEFUN([gl_FUNC_STRERRORNAME_NP]
     dnl In glibc 2.36, strerrorname_np returns NULL for EDEADLOCK on powerpc 
and
     dnl sparc platforms.
     dnl See <https://sourceware.org/bugzilla/show_bug.cgi?id=29545>.
+    dnl In glibc 2.37, strerrorname_np returns NULL for ENOSYM and
+    dnl EREMOTERELEASE on hppa platforms.
+    dnl See <https://sourceware.org/bugzilla/show_bug.cgi?id=31080>.
     AC_CACHE_CHECK([whether strerrorname_np works],
       [gl_cv_func_strerrorname_np_works],
       [AC_RUN_IFELSE(
@@ -33,6 +36,9 @@ AC_DEFUN([gl_FUNC_STRERRORNAME_NP]
                 #ifdef EDEADLOCK
                 || strerrorname_np (EDEADLOCK) == NULL
                 #endif
+                #ifdef ENOSYM
+                || strerrorname_np (ENOSYM) == NULL
+                #endif
                 ;
             ]])],
          [gl_cv_func_strerrorname_np_works=yes],
diff --git a/tests/test-strerrorname_np.c b/tests/test-strerrorname_np.c
index 5bd0f3ab55..4c149c0e96 100644
--- a/tests/test-strerrorname_np.c
+++ b/tests/test-strerrorname_np.c
@@ -1125,7 +1125,7 @@ main (void)
   #if defined ENOSHARE
   ASSERT (strcmp (strerrorname_np (ENOSHARE), "ENOSHARE") == 0);
   #endif
-  /* HP-UX, OSF/1 */
+  /* Linux, HP-UX, OSF/1 */
   #if defined ENOSYM
   ASSERT (strcmp (strerrorname_np (ENOSYM), "ENOSYM") == 0);
   #endif
@@ -1249,7 +1249,7 @@ main (void)
   #if defined EREMOTEIO
   ASSERT (strcmp (strerrorname_np (EREMOTEIO), "EREMOTEIO") == 0);
   #endif
-  /* HP-UX */
+  /* Linux, HP-UX */
   #if defined EREMOTERELEASE
   ASSERT (strcmp (strerrorname_np (EREMOTERELEASE), "EREMOTERELEASE") == 0);
   #endif




Reply via email to