bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: [gettext] setlocale() problem - bugfix, patch


From: Bruno Haible
Subject: Re: [gettext] setlocale() problem - bugfix, patch
Date: Thu, 5 Feb 2004 23:42:24 +0100
User-agent: KMail/1.5

Mark K. Kim wrote:
> I noticed "gettext-0.13.1/gettext-runtime/intl/localename.c" line 712
> executes setlocale(), when [I think] it should always execute the built-in
> code instead, for the same reason the built-in code is always executed
> instead of setlocale() in "intl/localcharset.c" line 293.

Your understanding of how the code works is incorrect. You can use a
debugger in single-stepping mode to see how it works.

> Please see the attached patch

Your patch is useless: On non-glibc platforms it has no effect, and on
glibc platforms the real libintl is inside libc, not in the intl/localename.c
file. (Except if you force the installation of a libintl.so on a glibc
system, which is a bad idea.)

> ...  I have to manually set the environment variables using
> putenv() to make them work.  But the SH example works fine without a
> problem since it sets environment variables directly without calling
> setlocale().

I understand that you have a problem making gettext() work. But if you
only explain various fruitless attempts to make it work, without stating
the problem itself in all details, I cannot understand what the problem
is. Please state facts, not guesses. And don't forget to mention your
system: things work very differently on FreeBSD than on Linux.

> It might be a good idea to display a message at the end of
> `make install` to explain that some examples may not work if setlocale()
> is unreliable

The only known cases where the examples don't work as expected are:
  - When on glibc systems you set your LANG variable to a locale that
    doesn't exist,
  - When the sample has a GUI and you don't have the necessary fonts
    installed.
  - Other reasons mentioned in the README and INSTALL files.

> Perhaps an autoconf test for setlocale reliability (a
> setlocale() test for each locale gettext understands) might be a good
> idea.

gettext() understands an unlimited amount of locales. There certainly
exists a locale that you haven't installed on your system.

Bruno





reply via email to

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