On 19/01/15 14:01, Pádraig Brady wrote:
> On 15/01/15 18:05, Alexander Pyhalov wrote:
>> Hello.
> 
>> test-locale.c. It assumes that LC_GLOBAL_LOCALE is a constant.
>> On illumos it's a function, so compilation fails. Fix is here:
> https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/coreutils/patches/gnulib-tests_test-locale.c.patch
> 
> This looks good, though it would be preferable to combine with a fix for...
> 
>> [test-getlogin] uses gl_locale_name_thread_unsafe, which simply doesn't know 
>> about
>> illumos/Solaris and returns NULL, so the test fails.
> 
> Does querylocale() exist for __sun ?
> Perhaps it's just a matter of adding __sun to the elif define
> in gl_locale_name_thread_unsafe() ?

It seems this is hitting recently as solaris 12 added uselocale()
which triggers this path.  Rich Burridge tells me that the function
used on solaris 12 is in fact getlocalename_l(), which
may work for Illumos also?
Rich is there really no header for this function?
I've called the non double underscore name which I presume is OK.
Also I just used the __sun define as done throughout gnulib.

The attached two patches should hopefully fix the issue
on both illumos and solaris 12.  I've no access to
either to test unfortunately.

thanks,
Pádraig.
From 2e5e0ec49357294ef9c453f786682c1e59dfb402 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Thu, 29 Jan 2015 16:44:48 +0000
Subject: [PATCH] localename: support Solaris 12 and Illumos

* lib/localename.c (gl_locale_name_thread_unsafe): call
getlocalename_l() on newer __sun platforms.
Reported by Alexander Pyhalov.
Fix suggested by Rich Burridge.
---
 ChangeLog        | 8 ++++++++
 lib/localename.c | 9 ++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 51287ba..9740ff5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-01-29  Pádraig Brady  <[email protected]>
+
+	localename: support Solaris 12 and Illumos
+	* lib/localename.c (gl_locale_name_thread_unsafe): call
+	getlocalename_l() on newer __sun platforms.
+	Reported by Alexander Pyhalov.
+	Fix suggested by Rich Burridge.
+
 2015-01-29  Alexander Pyhalov  <[email protected]>
 
 	locale: fix tests on illumos
diff --git a/lib/localename.c b/lib/localename.c
index 815171c..c6f326e 100644
--- a/lib/localename.c
+++ b/lib/localename.c
@@ -42,6 +42,10 @@
 # if !defined IN_LIBINTL
 #  include "glthread/lock.h"
 # endif
+# if defined __sun
+/* Solaris >= 12.  */
+extern char * getlocalename_l(int, locale_t);
+# endif
 #endif
 
 #if HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE
@@ -2584,7 +2588,7 @@ get_lcid (const char *locale_name)
 #endif
 
 
-#if HAVE_USELOCALE /* glibc or Mac OS X */
+#if HAVE_USELOCALE /* glibc, Solaris >= 12 or Mac OS X */
 
 /* Simple hash set of strings.  We don't want to drag in lots of hash table
    code here.  */
@@ -2723,6 +2727,9 @@ gl_locale_name_thread_unsafe (int category, const char *categoryname)
             return "";
           }
         return querylocale (mask, thread_locale);
+#  elif defined __sun
+        /* Solaris >= 12.  */
+        return getlocalename_l (category, thread_locale);
 #  endif
       }
   }
-- 
2.1.0

Reply via email to