bug-gnulib
[Top][All Lists]
Advanced

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

Re: duplocale test on AIX 7.1BETA


From: Bruno Haible
Subject: Re: duplocale test on AIX 7.1BETA
Date: Sat, 31 Jul 2010 11:47:27 +0200
User-agent: KMail/1.9.9

Rainer Tammer wrote:
> # ./a.out
> i = 0: errno = 22
> Invalid argument
> i = 1: errno = 22
> Invalid argument
> i = 2: errno = 22
> Invalid argument

Thanks. The duplocale() call apparently rejects the LC_GLOBAL_LOCALE argument.
I'm adding this workaround:


2010-07-31  Bruno Haible  <address@hidden>

        duplocale: Work around AIX 7.1 bug.
        * m4/duplocale.m4 (gl_FUNC_DUPLOCALE): Let the test fail also when
        duplocale(LC_GLOBAL_LOCALE) returns (locale_t)0.
        * lib/duplocale.c (rpl_duplocale): Update comment.
        * doc/posix-functions/duplocale.texi: Mention the AIX 7.1 bug.
        Reported by Rainer Tammer.

--- doc/posix-functions/duplocale.texi.orig     Sat Jul 31 11:40:52 2010
+++ doc/posix-functions/duplocale.texi  Sat Jul 31 11:33:35 2010
@@ -10,7 +10,7 @@
 @itemize
 @item
 The argument @code{LC_GLOBAL_LOCALE} is not supported on some platforms:
-glibc 2.11.
+glibc 2.11, AIX 7.1.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- lib/duplocale.c.orig        Sat Jul 31 11:40:52 2010
+++ lib/duplocale.c     Sat Jul 31 11:39:56 2010
@@ -32,7 +32,9 @@
 rpl_duplocale (locale_t locale)
 {
   /* Work around crash in the duplocale function in glibc < 2.12.
-     See <http://sourceware.org/bugzilla/show_bug.cgi?id=10969>.  */
+     See <http://sourceware.org/bugzilla/show_bug.cgi?id=10969>.
+     Also, on AIX 7.1, duplocale(LC_GLOBAL_LOCALE) returns (locale_t)0 with
+     errno set to EINVAL.  */
   if (locale == LC_GLOBAL_LOCALE)
     {
       /* Create a copy of the locale by fetching the name of each locale
--- m4/duplocale.m4.orig        Sat Jul 31 11:40:52 2010
+++ m4/duplocale.m4     Sat Jul 31 11:39:27 2010
@@ -1,5 +1,5 @@
-# duplocale.m4 serial 2
-dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+# duplocale.m4 serial 3
+dnl Copyright (C) 2009-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -12,6 +12,8 @@
   if test $ac_cv_func_duplocale = yes; then
     dnl Check against glibc bug where duplocale crashes.
     dnl See <http://sourceware.org/bugzilla/show_bug.cgi?id=10969>.
+    dnl Also, on AIX 7.1, duplocale(LC_GLOBAL_LOCALE) returns (locale_t)0 with
+    dnl errno set to EINVAL.
     AC_REQUIRE([gl_LOCALE_H])
     AC_CACHE_CHECK([whether duplocale(LC_GLOBAL_LOCALE) works],
       [gl_cv_func_duplocale_works],
@@ -22,20 +24,27 @@
 #endif
 int main ()
 {
-  (void) duplocale (LC_GLOBAL_LOCALE);
+  if (duplocale (LC_GLOBAL_LOCALE) == (locale_t)0)
+    return 1;
   return 0;
 }], [gl_cv_func_duplocale_works=yes], [gl_cv_func_duplocale_works=no],
-         [dnl Guess it works except on glibc < 2.12.
-          AC_EGREP_CPP([Unlucky GNU user], [
+         [dnl Guess it works except on glibc < 2.12 and AIX.
+          case "$host_os" in
+            aix*) gl_cv_func_duplocale_works="guessing no";;
+            *-gnu*)
+              AC_EGREP_CPP([Unlucky GNU user], [
 #include <features.h>
 #ifdef __GNU_LIBRARY__
  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12)
   Unlucky GNU user
  #endif
 #endif
-            ],
-            [gl_cv_func_duplocale_works="guessing no"],
-            [gl_cv_func_duplocale_works="guessing yes"])
+                ],
+                [gl_cv_func_duplocale_works="guessing no"],
+                [gl_cv_func_duplocale_works="guessing yes"])
+              ;;
+            *) gl_cv_func_duplocale_works="guessing yes";;
+          esac
          ])
       ])
     case "$gl_cv_func_duplocale_works" in



reply via email to

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