bug-gnulib
[Top][All Lists]
Advanced

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

Re: NetBSD failure on nl_langinfo


From: Bruno Haible
Subject: Re: NetBSD failure on nl_langinfo
Date: Fri, 22 Oct 2010 02:06:50 +0200
User-agent: KMail/1.9.9

Hi Eric,

> I just noticed this failure on NetBSD 5.0.2, i386-unknown-netbsdelf5.0.2:
> 
> ../../gltests/test-nl_langinfo.c:115: assertion failed
> [1]   Abort trap (core dumped) LC_ALL=${LOCALE_...
> FAIL: test-nl_langinfo.sh
> 
> LC_ALL=fr_FR.ISO8859-1 ./test-nl_langinfo 1
> 
> 114         const char *currency = nl_langinfo (CRNCYSTR);
> (gdb)
> 115         ASSERT (strlen (currency) >= (pass > 0 ? 1 : 0));
> (gdb) p currency
> $1 = 0xbbbc7761 ""
> (gdb) p pass
> $2 = 1
> 
> $ grep NL_LANGINFO gllib/Makefile
> GNULIB_NL_LANGINFO = 1
> HAVE_NL_LANGINFO = 1
> REPLACE_NL_LANGINFO = 0
>                -e 's|@''GNULIB_NL_LANGINFO''@|$(GNULIB_NL_LANGINFO)|g' \
>                -e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \
>                -e 's|@''REPLACE_NL_LANGINFO''@|$(REPLACE_NL_LANGINFO)|g' \

OK, this means it is really the native NetBSD nl_langinfo() with the NetBSD
CRNCYSTR argument - since gnulib's langinfo.h replacement does not replace
CRNCYSTR when <langinfo.h> is present - which returns the empty string.

It is not formally a bug, since glibc also returns the empty string for
nl_langinfo (CRNCYSTR) in some locales (the C locale for example).
It's simply unexpected behaviour. Only the test needs to be fixed. I'm
committing this:


2010-10-21  Bruno Haible  <address@hidden>

        nl_langinfo test: Avoid test failure on NetBSD 5.
        * tests/test-nl_langinfo.c (main): Relax test of nl_langinfo(CRNCYSTR).
        Reported by Eric Blake.

--- tests/test-nl_langinfo.c.orig       Fri Oct 22 01:58:52 2010
+++ tests/test-nl_langinfo.c    Fri Oct 22 01:57:21 2010
@@ -112,7 +112,11 @@
   /* nl_langinfo items of the LC_MONETARY category */
   {
     const char *currency = nl_langinfo (CRNCYSTR);
-    ASSERT (strlen (currency) >= (pass > 0 ? 1 : 0));
+    ASSERT (strlen (currency) >= 0);
+#if !defined __NetBSD__
+    if (pass > 0)
+      ASSERT (strlen (currency) >= 1);
+#endif
   }
   /* nl_langinfo items of the LC_MESSAGES category */
   ASSERT (strlen (nl_langinfo (YESEXPR)) > 0);



reply via email to

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