Subject: bug#65927: the role and location of locale.alias

From: Ludovic Courtès <[email-masked]>
Date: Sat, 21 Oct 2023 16:23:34 +0200

Hi Bruno,

Bruno Haible <[email-masked]> skribis:

> In guix 1.4.0 there are 2 locale.alias files from glibc on the disk:

[...]

> I explained the purpose of this file in
> https://sourceware.org/pipermail/libc-alpha/2023-September/151524.html .
> In summary, it's a configuration file whose initial contents is provided
> for glibc, but which needs to be edited by the system administrator in
> some situations.
>
> For this reason, in Debian 12, the file has been moved to
> /etc/locale.alias, and /usr/share/locale/locale.alias is merely
> a symbolic link to /etc/locale.alias. IMO, this is the correct
> way to handle this configuration file.

Does glibc look for ‘locale.alias’ in $sysconfdir, or does it look for
it in $localstatedir?

To follow the “correct way” as you described it, glibc should look for
it in $sysconfdir by default.

> The way Guix handles this file provokes two problems:
>
> 1) When the system administrator wants to add a new alias, they have
>    to search for all occurrences of the file in the (two) glibc
>    installations. And if/when they install newer versions of glibc,
>    they will have to reapply their change again and again.

That’d be impractical of course, and that’s not how Guix works
(/gnu/store is immutable).

> 2) GNU gettext needs to access this file, in order to recognize the
>    same aliases that glibc recognizes. But glibc does not export the
>    _nl_expand_alias function. Therefore GNU gettext needs to know
>    where the file is. But how could GNU gettext retrieve any of the
>    file names
>      /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/share/locale/locale.alias
>      /gnu/store/ayc9r7162rphy4zjw8ch01pmyh214h82-glibc-2.33/share/locale/locale.alias
>    ?
>    If Guix had this configuration file moved to /etc, like Debian did, GNU gettext
>    could be compiled with '-DLOCALE_ALIAS_PATH=\"/etc\"' and would then be able
>    to access it.

Right now gettext in Guix ends up being compiled with:

  -DLOCALE_ALIAS_PATH=\"\"

(Example build log at
<https://ci.guix.gnu.org/log/0yy8zmgvc6hy1pfc41gm1bi7nhj4aqf7-gettext-0.21>.)

What you propose is doable.  However, how many distros provide
/etc/locale.alias?  What happens when it’s missing?

We have to keep in mind that Guix can be used on top of any distro.

Thanks,
Ludo’.