mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: setlocale behavior with 'missing' locales
Date: Sun, 12 Nov 2017 19:15:44 -0500	[thread overview]
Message-ID: <20171113001544.GZ1627@brightrain.aerifal.cx> (raw)
In-Reply-To: <5A08C907.2010209@adelielinux.org>

On Sun, Nov 12, 2017 at 04:19:51PM -0600, A. Wilcox wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> On 07/11/17 23:27, Rich Felker wrote:
> > One notable issue is that, right now, we rely on being able to set 
> > LC_MESSAGES to an arbitrary name even if there's no libc locale 
> > definition for it; this is because gettext() relies on the name of
> > the current LC_MESSAGES locale to find (application-specific)
> > translation files that might exist even without a libc translation.
> > I'm not sure how we would best keep this working under changes
> > similar to the above.
> 
> I can think of two ways to handle it, but neither of them are all that
> great:
> 
> 1) Provide simple translations for the most common 90% of languages.
> Some people are getting unfairly screwed here, but they are probably
> getting screwed by every other app/library as well.  It should be very
> simple to find a list of month names and abbreviations online for
> pretty much any language (even using Wikipedia's month article
> translations or Microsoft's Open Software Translations project).

This is an interesting idea I once considered, but it has too many
problems. It's a large volume of data that would be duplicated in
every static-linked application, and at least some of it would become
outdated or would be subject to user disagreement about what it should
be -- things like time formatting, radix separator (if we make it
variable at all), etc. Also the category in question is LC_MESSAGES,
which has nothing to do with dates but rather strerror messages and
such. Having default translations for these for all languages linked
into libc really does not make sense.

> 2) Use an access(3) call for /usr/share/locale/$LC_MESSAGES.  This
> means there is virtually no work for musl beyond adding the call, and
> it will only succeed if the locale is available (which is exactly what
> the standard demands).  The two problems I see with this is:

access() is generally always wrong (uses wrong permissions when real &
effective ids differ), but that's a minor detail. However I don't see
how this tells you anything useful. All it tells you is whether at
least some application installed in the given prefix (here /usr) has
translation files for the particular locale name. It doesn't tell you
whether the running application does (false positives), nor does it
tell you whether applications with different prefixes might (false
negatives).

>   1) if /usr/share is NFS shared this could lock.
>      But it would do so anyway if setlocale(3) succeeded.
> 
>   2) it requires use of stdio which most people on this list hate.

I don't see what relation it has to stdio.

Rich


  reply	other threads:[~2017-11-13  0:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08  5:03 Rich Felker
2017-11-08  5:27 ` Rich Felker
2017-11-12 22:19   ` A. Wilcox
2017-11-13  0:15     ` Rich Felker [this message]
2018-02-12  6:02       ` A. Wilcox
2018-02-12 20:04         ` Rich Felker
2018-03-01  1:13   ` Rich Felker
2018-03-01 19:10     ` William Pitcock
2018-03-01 19:25       ` Rich Felker
2018-03-01 20:45         ` Rich Felker
2018-03-02  1:43         ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171113001544.GZ1627@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).