Re: localename test failure on OpenIndiana

2018-02-03 Thread Bruno Haible
> ... Solaris 11.4?
> 
> https://blogs.oracle.com/solaris/oracle-solaris-114-beta-released

The installation of this download version in VirtualBox does not work for me.
It hangs after "The on-disk vtoc geometry is not valid".

But I could find out that libc has no function getlocalename_l(). It has,
however, a function __getlocalename_l(), that is not declared in the header
files.

Let's continue this thread when Oracle provides a release that actually works.

Bruno




Re: localename test failure on OpenIndiana

2018-02-02 Thread Paul Eggert

On 02/02/2018 12:36 PM, Bruno Haible wrote:

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


Dead, or just renamed to Solaris 11.4?

https://blogs.oracle.com/solaris/oracle-solaris-114-beta-released




localename test failure on OpenIndiana

2018-02-02 Thread Bruno Haible
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  

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