bug-gnulib
[Top][All Lists]
Advanced

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

localename test failure on OpenIndiana


From: Bruno Haible
Subject: localename test failure on OpenIndiana
Date: Fri, 02 Feb 2018 21:36:09 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-104-generic; KDE/5.18.0; x86_64; ; )

There was a fix for the 'localename' module on Solaris 12 [1], but Solaris 12
is now dead [2][3].

The Solaris 11 variant called OpenIndiana (based on Illumos) fails the
'localename' tests. This patch fixes it.

On the other Solaris 11 variants, Solaris 11.3 and Dyson, the 'uselocale'
function does not exist in libc, therefore the gl_locale_name_thread()
function is a dummy and the tests don't exercise this functionality.

[1] https://lists.gnu.org/archive/html/bug-gnulib/2015-01/msg00078.html
[2] 
https://arstechnica.com/information-technology/2017/01/oracle-sort-of-confirms-demise-of-solaris-12-effort/
[3] 
http://www.itprotoday.com/software-development/new-oracle-layoffs-probably-signal-end-line-solaris


2018-02-02  Bruno Haible  <address@hidden>

        localename: Add support for OpenIndiana.
        * lib/localename.c (gl_locale_name_thread_unsafe): Add code for
        Solaris 11 variants with uselocale() but without getlocalename_l().

diff --git a/lib/localename.c b/lib/localename.c
index 00cf997..2133cbc 100644
--- a/lib/localename.c
+++ b/lib/localename.c
@@ -2592,7 +2592,7 @@ get_lcid (const char *locale_name)
 #endif
 
 
-#if HAVE_USELOCALE /* glibc, Solaris >= 12 or Mac OS X */
+#if HAVE_USELOCALE /* glibc, Mac OS X, Solaris 11 OpenIndiana, or Solaris 12  
*/
 
 /* Simple hash set of strings.  We don't want to drag in lots of hash table
    code here.  */
@@ -2731,9 +2731,27 @@ gl_locale_name_thread_unsafe (int category, const char 
*categoryname)
             return "";
           }
         return querylocale (mask, thread_locale);
-#  elif defined __sun && HAVE_GETLOCALENAME_L
+#  elif defined __sun
+#   if HAVE_GETLOCALENAME_L
         /* Solaris >= 12.  */
         return getlocalename_l (category, thread_locale);
+#   else
+        /* Solaris 11 OpenIndiana.
+           For the internal structure of locale objects, see
+           
https://github.com/OpenIndiana/illumos-gate/blob/master/usr/src/lib/libc/port/locale/localeimpl.h
  */
+        switch (category)
+          {
+          case LC_CTYPE:
+          case LC_NUMERIC:
+          case LC_TIME:
+          case LC_COLLATE:
+          case LC_MONETARY:
+          case LC_MESSAGES:
+            return ((const char * const *) thread_locale)[category];
+          default: /* We shouldn't get here.  */
+            return "";
+          }
+#   endif
 #  elif defined __CYGWIN__
         /* Cygwin < 2.6 lacks uselocale and thread-local locales altogether.
            Cygwin <= 2.6.1 lacks NL_LOCALE_NAME, requiring peeking inside




reply via email to

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