Alain Guibert wrote: > But there are 4 collisions between libintl.so.8.0.2 and libc.so.5.4.33: > > | 00031088 T _nl_expand_alias > | 000302c8 T _nl_explode_name > | 00030514 T _nl_make_l10nflist > | 00030a04 T _nl_normalize_codeset > > Only -lintl -lc fails; -liconv -lc works. This NULL setlocale() problem > is present with libintl.so.8 from gettext 0.15, 0.16, and 0.17; absent > with libintl.so.2 or 3 from gettext 0.12.1, 0.14.1 and 0.14.4. The small > test program (only printf() and setlocale(), no other functions) > normally working compiled with -lc, extract from strace: > > | open("/usr/share/locale/locale.alias", O_RDONLY) = -1 ENOENT (No such file > or directory) > | open("/usr/share/i18n/locale.alias", O_RDONLY) = -1 ENOENT (No such file or > directory) > | open("/usr/share/locale/fr_FR/LC_MESSAGES", O_RDONLY) = 3 > > Same program compiled with -lintl -lc, but working, with gettext 0.12.1: > > | open("/usr/local/share/locale/locale.alias", O_RDONLY) = -1 ENOENT (No such > file or directory) > | open("/usr/share/locale/fr_FR/LC_MESSAGES", O_RDONLY) = 3 > > Note setlocale() was already influenced by -lintl first, as the alias > file was then searched in /usr/local instead of /usr... Now same program > failing with -lintl -lc gettext 0.17: > > | open("/usr/local/share/locale/locale.alias", O_RDONLY) = -1 ENOENT (No such > file or directory) > | open("/usr/share/locale/fr_FR/|", O_RDONLY) = -1 ENOENT (No such file or > directory) > | open("/usr/share/locale/fr/|", O_RDONLY) = -1 ENOENT (No such file or > directory) > > The alias file is also searched in /usr/local, and the sampled category > is "|" (!?), obviously not found.
Ouch. It means gettext >= 0.15 on Linux libc5 makes i18n works instead of better! Indeed _nl_explode_name and _nl_make_l10nflist have changd in gettext 0.15 in a binary incompatible way. I wasn't aware that the libc5 didn't protect its symbols. The fix, for you, is to compile gettext with CPPFLAGS containing these: -D_nl_explode_name=_gt_explode_name -D_nl_make_l10nflist=_gt_make_l10nflist > But testdir2 fails: > > | checking whether vsnprintf is declared... yes > | checking for vsnprintf... yes > | checking whether snprintf respects a size of 1... no > | ./configure: test: =: unary operator expected > | test-vsnprintf.c:75: assertion failed > | FAIL: test-vsnprintf > > I think that is due to a typo, one lacking "v" in > testdir2/glm4/vsnprintf.m4. The attached vsn.patch fixes it Thanks. Applied. > >>>>| test-wcwidth.c:45: assertion failed > >>>>| FAIL: test-wcwidth > >> wcwidth(32)=-1, and the same for all ASCII characters. > > And iswprint(32) = ? And isprint(32) = ? > > libc iswprint(x)=0 for *all* possible x. isprint(x)=1, for all ASCII > except 0-31 and 127, and behaviour above 128 correctly follows the > locale. Weird... I'm applying this fix. It replaces the iswprint etc. functions. The replacement does not consider isprint (since that would make the assumption that all locales are unibyte), but only ASCII. Still better than the completely broken functions. 2008-04-21 Bruno Haible <[EMAIL PROTECTED]> * lib/wctype.in.h (iswalnum, iswalpha, iswblank, iswcntrl, iswdigit, iswgraph, iswlower, iswprint, iswpunct, iswspace, iswupper, iswxdigit): Define to replacements if REPLACE_ISWCNTRL is 1. * m4/wctype.m4 (gl_WCTYPE_H): Test whether the isw* functions work. If not, set WCTYPE_H to nonempty and REPLACE_ISWCNTRL to 1. * modules/wctype (Makefile.am): Substitute REPLACE_ISWCNTRL. * doc/posix-functions/iswalnum.texi: Mention the 'wctype' module and what it fixes. * doc/posix-functions/iswalpha.texi: Likewise. * doc/posix-functions/iswblank.texi: Likewise. * doc/posix-functions/iswcntrl.texi: Likewise. * doc/posix-functions/iswdigit.texi: Likewise. * doc/posix-functions/iswgraph.texi: Likewise. * doc/posix-functions/iswlower.texi: Likewise. * doc/posix-functions/iswprint.texi: Likewise. * doc/posix-functions/iswpunct.texi: Likewise. * doc/posix-functions/iswspace.texi: Likewise. * doc/posix-functions/iswupper.texi: Likewise. * doc/posix-functions/iswxdigit.texi: Likewise. *** lib/wctype.in.h.orig 2008-04-22 01:49:09.000000000 +0200 --- lib/wctype.in.h 2008-04-22 01:43:14.000000000 +0200 *************** *** 1,6 **** /* A substitute for ISO C99 <wctype.h>, for platforms that lack it. ! Copyright (C) 2006, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by --- 1,6 ---- /* A substitute for ISO C99 <wctype.h>, for platforms that lack it. ! Copyright (C) 2006-2008 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by *************** *** 57,64 **** #endif /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. Assume all 12 functions are implemented the same way, or not at all. */ ! #if ! @HAVE_ISWCNTRL@ /* IRIX 5.3 has macros but no functions, its isw* macros refer to an undefined variable _ctmp_ and to <ctype.h> macros like _P, and they --- 57,65 ---- #endif /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions. + Linux libc5 has <wctype.h> and the functions but they are broken. Assume all 12 functions are implemented the same way, or not at all. */ ! #if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ /* IRIX 5.3 has macros but no functions, its isw* macros refer to an undefined variable _ctmp_ and to <ctype.h> macros like _P, and they *************** *** 78,83 **** --- 79,100 ---- # undef iswupper # undef iswxdigit + /* Linux libc5 has <wctype.h> and the functions but they are broken. */ + # if @REPLACE_ISWCNTRL@ + # define iswalnum rpl_iswalnum + # define iswalpha rpl_iswalpha + # define iswblank rpl_iswblank + # define iswcntrl rpl_iswcntrl + # define iswdigit rpl_iswdigit + # define iswgraph rpl_iswgraph + # define iswlower rpl_iswlower + # define iswprint rpl_iswprint + # define iswpunct rpl_iswpunct + # define iswspace rpl_iswspace + # define iswupper rpl_iswupper + # define iswxdigit rpl_iswxdigit + # endif + static inline int iswalnum (__wctype_wint_t wc) { *** m4/wctype.m4.orig 2008-04-22 01:49:09.000000000 +0200 --- m4/wctype.m4 2008-04-22 01:39:04.000000000 +0200 *************** *** 1,6 **** dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. ! dnl Copyright (C) 2006, 2007 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. --- 1,6 ---- dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. ! dnl Copyright (C) 2006-2008 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. *************** *** 9,14 **** --- 9,15 ---- AC_DEFUN([gl_WCTYPE_H], [ + AC_REQUIRE([AC_PROG_CC]) AC_CHECK_FUNCS_ONCE([iswcntrl]) if test $ac_cv_func_iswcntrl = yes; then HAVE_ISWCNTRL=1 *************** *** 30,36 **** WCTYPE_H=wctype.h if test $ac_cv_header_wctype_h = yes; then if test $ac_cv_func_iswcntrl = yes; then ! WCTYPE_H= fi dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty, dnl for the benefit of builds from non-distclean directories. --- 31,58 ---- WCTYPE_H=wctype.h if test $ac_cv_header_wctype_h = yes; then if test $ac_cv_func_iswcntrl = yes; then ! dnl Linux libc5 has an iswprint function that returns 0 for all arguments. ! dnl The other functions are likely broken in the same way. ! AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works], ! [ ! AC_TRY_RUN([#include <stddef.h> ! #include <stdio.h> ! #include <time.h> ! #include <wchar.h> ! #include <wctype.h> ! int main () { return iswprint ('x') == 0; }], ! [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no]) ! ], ! [ ! AC_TRY_COMPILE([#include <stdlib.h> ! #if __GNU_LIBRARY__ == 1 ! Linux libc5 i18n is broken. ! #endif], ! [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no]) ! ]) ! if test $gl_cv_func_iswcntrl_works = yes; then ! WCTYPE_H= ! fi fi dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty, dnl for the benefit of builds from non-distclean directories. *************** *** 41,44 **** --- 63,73 ---- fi AC_SUBST([HAVE_WCTYPE_H]) AC_SUBST([WCTYPE_H]) + + if test "$gl_cv_func_iswcntrl_works" = no; then + REPLACE_ISWCNTRL=1 + else + REPLACE_ISWCNTRL=0 + fi + AC_SUBST([REPLACE_ISWCNTRL]) ]) *** modules/wctype.orig 2008-04-22 01:49:09.000000000 +0200 --- modules/wctype 2008-04-22 01:39:48.000000000 +0200 *************** *** 25,30 **** --- 25,31 ---- -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ + -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ < $(srcdir)/wctype.in.h; \ } > [EMAIL PROTECTED] mv [EMAIL PROTECTED] $@ *** doc/posix-functions/iswalnum.texi.orig 2008-04-22 01:49:09.000000000 +0200 --- doc/posix-functions/iswalnum.texi 2008-04-22 01:48:16.000000000 +0200 *************** *** 4,21 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswalnum.html} ! Gnulib module: --- Portability problems fixed by Gnulib: @itemize @end itemize Portability problems not fixed by Gnulib: @itemize @item - This function is missing on some platforms: - Solaris 2.5.1. - @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize --- 4,24 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswalnum.html} ! Gnulib module: wctype Portability problems fixed by Gnulib: @itemize + @item + This function is missing on some platforms: + Solaris 2.5.1. + @item + This function returns 0 for all possible arguments on some platforms: + Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize *** doc/posix-functions/iswalpha.texi.orig 2008-04-22 01:49:09.000000000 +0200 --- doc/posix-functions/iswalpha.texi 2008-04-22 01:48:17.000000000 +0200 *************** *** 4,21 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswalpha.html} ! Gnulib module: --- Portability problems fixed by Gnulib: @itemize @end itemize Portability problems not fixed by Gnulib: @itemize @item - This function is missing on some platforms: - Solaris 2.5.1. - @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize --- 4,24 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswalpha.html} ! Gnulib module: wctype Portability problems fixed by Gnulib: @itemize + @item + This function is missing on some platforms: + Solaris 2.5.1. + @item + This function returns 0 for all possible arguments on some platforms: + Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize *** doc/posix-functions/iswblank.texi.orig 2008-04-22 01:49:09.000000000 +0200 --- doc/posix-functions/iswblank.texi 2008-04-22 01:48:18.000000000 +0200 *************** *** 4,13 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswblank.html} ! Gnulib module: --- Portability problems fixed by Gnulib: @itemize @end itemize Portability problems not fixed by Gnulib: --- 4,16 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswblank.html} ! Gnulib module: wctype Portability problems fixed by Gnulib: @itemize + @item + This function returns 0 for all possible arguments on some platforms: + Linux libc5. @end itemize Portability problems not fixed by Gnulib: *** doc/posix-functions/iswcntrl.texi.orig 2008-04-22 01:49:09.000000000 +0200 --- doc/posix-functions/iswcntrl.texi 2008-04-22 01:48:19.000000000 +0200 *************** *** 4,21 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswcntrl.html} ! Gnulib module: --- Portability problems fixed by Gnulib: @itemize @end itemize Portability problems not fixed by Gnulib: @itemize @item - This function is missing on some platforms: - Solaris 2.5.1. - @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize --- 4,24 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswcntrl.html} ! Gnulib module: wctype Portability problems fixed by Gnulib: @itemize + @item + This function is missing on some platforms: + Solaris 2.5.1. + @item + This function returns 0 for all possible arguments on some platforms: + Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize *** doc/posix-functions/iswdigit.texi.orig 2008-04-22 01:49:09.000000000 +0200 --- doc/posix-functions/iswdigit.texi 2008-04-22 01:48:20.000000000 +0200 *************** *** 4,21 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswdigit.html} ! Gnulib module: --- Portability problems fixed by Gnulib: @itemize @end itemize Portability problems not fixed by Gnulib: @itemize @item - This function is missing on some platforms: - Solaris 2.5.1. - @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize --- 4,24 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswdigit.html} ! Gnulib module: wctype Portability problems fixed by Gnulib: @itemize + @item + This function is missing on some platforms: + Solaris 2.5.1. + @item + This function returns 0 for all possible arguments on some platforms: + Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize *** doc/posix-functions/iswgraph.texi.orig 2008-04-22 01:49:09.000000000 +0200 --- doc/posix-functions/iswgraph.texi 2008-04-22 01:48:20.000000000 +0200 *************** *** 4,21 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswgraph.html} ! Gnulib module: --- Portability problems fixed by Gnulib: @itemize @end itemize Portability problems not fixed by Gnulib: @itemize @item - This function is missing on some platforms: - Solaris 2.5.1. - @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize --- 4,24 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswgraph.html} ! Gnulib module: wctype Portability problems fixed by Gnulib: @itemize + @item + This function is missing on some platforms: + Solaris 2.5.1. + @item + This function returns 0 for all possible arguments on some platforms: + Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize *** doc/posix-functions/iswlower.texi.orig 2008-04-22 01:49:09.000000000 +0200 --- doc/posix-functions/iswlower.texi 2008-04-22 01:48:21.000000000 +0200 *************** *** 4,21 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswlower.html} ! Gnulib module: --- Portability problems fixed by Gnulib: @itemize @end itemize Portability problems not fixed by Gnulib: @itemize @item - This function is missing on some platforms: - Solaris 2.5.1. - @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize --- 4,24 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswlower.html} ! Gnulib module: wctype Portability problems fixed by Gnulib: @itemize + @item + This function is missing on some platforms: + Solaris 2.5.1. + @item + This function returns 0 for all possible arguments on some platforms: + Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize *** doc/posix-functions/iswprint.texi.orig 2008-04-22 01:49:09.000000000 +0200 --- doc/posix-functions/iswprint.texi 2008-04-22 01:48:22.000000000 +0200 *************** *** 4,21 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswprint.html} ! Gnulib module: --- Portability problems fixed by Gnulib: @itemize @end itemize Portability problems not fixed by Gnulib: @itemize @item - This function is missing on some platforms: - Solaris 2.5.1. - @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize --- 4,24 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswprint.html} ! Gnulib module: wctype Portability problems fixed by Gnulib: @itemize + @item + This function is missing on some platforms: + Solaris 2.5.1. + @item + This function returns 0 for all possible arguments on some platforms: + Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize *** doc/posix-functions/iswpunct.texi.orig 2008-04-22 01:49:09.000000000 +0200 --- doc/posix-functions/iswpunct.texi 2008-04-22 01:48:23.000000000 +0200 *************** *** 4,21 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswpunct.html} ! Gnulib module: --- Portability problems fixed by Gnulib: @itemize @end itemize Portability problems not fixed by Gnulib: @itemize @item - This function is missing on some platforms: - Solaris 2.5.1. - @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize --- 4,24 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswpunct.html} ! Gnulib module: wctype Portability problems fixed by Gnulib: @itemize + @item + This function is missing on some platforms: + Solaris 2.5.1. + @item + This function returns 0 for all possible arguments on some platforms: + Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize *** doc/posix-functions/iswspace.texi.orig 2008-04-22 01:49:09.000000000 +0200 --- doc/posix-functions/iswspace.texi 2008-04-22 01:48:24.000000000 +0200 *************** *** 4,21 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswspace.html} ! Gnulib module: --- Portability problems fixed by Gnulib: @itemize @end itemize Portability problems not fixed by Gnulib: @itemize @item - This function is missing on some platforms: - Solaris 2.5.1. - @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize --- 4,24 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswspace.html} ! Gnulib module: wctype Portability problems fixed by Gnulib: @itemize + @item + This function is missing on some platforms: + Solaris 2.5.1. + @item + This function returns 0 for all possible arguments on some platforms: + Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize *** doc/posix-functions/iswupper.texi.orig 2008-04-22 01:49:09.000000000 +0200 --- doc/posix-functions/iswupper.texi 2008-04-22 01:48:24.000000000 +0200 *************** *** 4,21 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswupper.html} ! Gnulib module: --- Portability problems fixed by Gnulib: @itemize @end itemize Portability problems not fixed by Gnulib: @itemize @item - This function is missing on some platforms: - Solaris 2.5.1. - @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize --- 4,24 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswupper.html} ! Gnulib module: wctype Portability problems fixed by Gnulib: @itemize + @item + This function is missing on some platforms: + Solaris 2.5.1. + @item + This function returns 0 for all possible arguments on some platforms: + Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize *** doc/posix-functions/iswxdigit.texi.orig 2008-04-22 01:49:09.000000000 +0200 --- doc/posix-functions/iswxdigit.texi 2008-04-22 01:48:25.000000000 +0200 *************** *** 4,21 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswxdigit.html} ! Gnulib module: --- Portability problems fixed by Gnulib: @itemize @end itemize Portability problems not fixed by Gnulib: @itemize @item - This function is missing on some platforms: - Solaris 2.5.1. - @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize --- 4,24 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswxdigit.html} ! Gnulib module: wctype Portability problems fixed by Gnulib: @itemize + @item + This function is missing on some platforms: + Solaris 2.5.1. + @item + This function returns 0 for all possible arguments on some platforms: + Linux libc5. @end itemize Portability problems not fixed by Gnulib: @itemize @item On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot accommodate all Unicode characters. @end itemize