On Fri, Jun 12, 2015 at 10:35:02AM +0200, Stefan Sperling wrote:
> On Fri, Jun 12, 2015 at 08:59:14AM +0200, Sébastien Marie wrote:
> > If this change is desirable, I will propose patchs for programs in base
> > in order to call setlocale(LC_ALL, "") at program initilisation.
> 
> Calling setlocale() with LC_ALL will have other side effects apart from
> messages. I think, for now, we should only call setlocale() in programs
> that have been made fully local-aware. For example, calling setlocale()
> while not making the application handle multi-byte sequences properly
> might not be such a good idea.

Yes, it is true. It would be a problem.

> Localising error messages is not all that important at present. What's much
> more important, for example, is interactive editing of UTF-8 in the shell and
> in editors. Before that works, extensive localisation is rather pointless.
> Currently, localisation and multibyte only work with tools installed from
> ports, with very few exceptions (e.g. tmux and less).
> 
> catopen() is an interface which isn't widely used. It seems to be an old relic
> of posix. So I don't see much point in extending it. Nowadays, everyone uses
> gettext() for localisation instead.  

strerror(3) implementation use catopen(), and strerror(3) (or others
errno related error messages, like err(3) or warn(3)) are used a lot in
base.

> Whether or not full message localisation of the base system should happen
> at all is likely a contentious question :-)

The purpose of the patch wasn't to start a full message localisation of
base system... :)

I start reviewing locale, and while I was testing in regress, I was
suprised that some tests don't pass due to locale issue whereas they
don't configure locale (regress/lib/libc/strerror for example). So I
have try to specify "C" locale in test, but it failed: strerror don't
relied on locate category, but on LC_* environment.

Searching why, I note strerror use catopen which directly manipulate
LC_* environment to retrieve the localisation.

As this behaviour seems to be not conform to POSIX, and others BSD
don't do that, the following patch was proposed :)

> [...]
> libc's strftime() calls setlocale(). This should be fixed eventually.
> I believe it should call some internal thread-safe interface instead,
> which we don't have yet.

I hope I come back to catopen (and strftime) later. For now running
regress with env -i will be enought for me.

Thanks for your comments.
-- 
Sébastien Marie

Reply via email to