bug-gnulib
[Top][All Lists]
Advanced

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

test-duplocale crashes


From: Bruno Haible
Subject: test-duplocale crashes
Date: Sun, 16 Oct 2016 20:10:35 +0200
User-agent: KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; )

On a glibc system (glibc 2.15, Linux 3.8) I get this test failure
from a gnulib testdir:

./../build-aux/test-driver: line 107:  6269 Segmentation fault      "$@" > 
$log_file 2>&1
FAIL: test-duplocale

FAIL test-duplocale (exit status: 139)

(gdb) where
#0  0x00007ffff7a4aa6f in freelocale () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x0000000000400d36 in main () at test-duplocale.c:116

The locale to be freed is NULL; this is an invalid argument to freelocale().
It's better to fix the test in this case:


2016-10-16  Bruno Haible  <address@hidden>

        Fix a test crash.
        * tests/test-duplocale.c (main): Skip the test if the 'newlocale' call
        fails.

diff --git a/tests/test-duplocale.c b/tests/test-duplocale.c
index 498e31d..667b3e2 100644
--- a/tests/test-duplocale.c
+++ b/tests/test-duplocale.c
@@ -72,6 +72,11 @@ main ()
 
   /* Use a per-thread locale.  */
   perthread = newlocale (LC_ALL_MASK, "es_ES.UTF-8", NULL);
+  if (perthread == NULL)
+    {
+      fprintf (stderr, "Skipping test: Spanish Unicode locale is not 
installed\n");
+      return 77;
+    }
   uselocale (perthread);
 
   /* Save the locale in a locale_t object again.  */




reply via email to

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