GNU bug report logs - #65927
the role and location of locale.alias

Previous Next

Package: guix;

Reported by: Bruno Haible <bruno <at> clisp.org>

Date: Wed, 13 Sep 2023 20:23:01 UTC

Severity: normal

To reply to this bug, email your comments to 65927 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#65927; Package guix. (Wed, 13 Sep 2023 20:23:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bruno Haible <bruno <at> clisp.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Wed, 13 Sep 2023 20:23:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bruno Haible <bruno <at> clisp.org>
To: bug-guix <at> gnu.org
Subject: the role and location of locale.alias
Date: Wed, 13 Sep 2023 22:22:14 +0200
Hi,

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

$ ls -liL --sort=size `find / -name locale.alias 2>/dev/null | grep -v X11` 940417 -r--r--r-- 1 root root 2998 Jan  1  1970 /gnu/store/0dbscs8zq4bdg8vbn9jkdgynjcn3s01p-gcc-toolchain-12.2.0/share/locale/locale.alias
 940417 -r--r--r-- 1 root root 2998 Jan  1  1970 /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/share/locale/locale.alias
  15716 -r--r--r-- 1 root root 2998 Jan  1  1970 /gnu/store/ayc9r7162rphy4zjw8ch01pmyh214h82-glibc-2.33/share/locale/locale.alias
  15716 -r--r--r-- 1 root root 2998 Jan  1  1970 /gnu/store/c326489r6jvnl69l2nbmdvxmgzqln2hy-profile/share/locale/locale.alias
  15716 -r--r--r-- 1 root root 2998 Jan  1  1970 /gnu/store/isn13ca7419sj7myb3xr3i3zbxspky8c-profile/share/locale/locale.alias
  15716 -r--r--r-- 1 root root 2998 Jan  1  1970 /gnu/store/yh51nb5dq9n6pw8mrdp3nxcfmxzmrp1x-profile/share/locale/locale.alias
1058938 -r--r--r-- 1 root root  261 Jan  1  1970 /gnu/store/wf46adk80fdc1qij8472n8r2xr4cln0a-gdm-42.0/share/gdm/locale.alias

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.

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.

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.

Bruno







Information forwarded to bug-guix <at> gnu.org:
bug#65927; Package guix. (Sat, 21 Oct 2023 14:25:02 GMT) Full text and rfc822 format available.

Message #8 received at 65927 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Bruno Haible <bruno <at> clisp.org>
Cc: 65927 <at> debbugs.gnu.org
Subject: Re: bug#65927: the role and location of locale.alias
Date: Sat, 21 Oct 2023 16:23:34 +0200
Hi Bruno,

Bruno Haible <bruno <at> clisp.org> 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’.




Information forwarded to bug-guix <at> gnu.org:
bug#65927; Package guix. (Sat, 21 Oct 2023 20:49:02 GMT) Full text and rfc822 format available.

Message #11 received at 65927 <at> debbugs.gnu.org (full text, mbox):

From: Bruno Haible <bruno <at> clisp.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 65927 <at> debbugs.gnu.org
Subject: Re: bug#65927: the role and location of locale.alias
Date: Sat, 21 Oct 2023 22:47:46 +0200
Hi Ludo',

> > 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?

It looks for it in $(localedir), whose default value is $(datadir)/locale.
https://sourceware.org/git/?p=glibc.git;a=blob;f=intl/localealias.c;h=ea4f48b594fe13490f006d95b799213961146e23;hb=HEAD#l154
https://sourceware.org/git/?p=glibc.git;a=blob;f=intl/Makefile;h=d7223256eb699380ccdf6f6dd37b7490b342e8d3;hb=HEAD#l156
https://sourceware.org/git/?p=glibc.git;a=blob;f=Makeconfig;h=c48fcc59e8c1b150d40241c31fc63adf4d15ccb3;hb=HEAD#l202

The default value of $(datadir) is $(prefix)/share.
https://sourceware.org/git/?p=glibc.git;a=blob;f=Makeconfig;h=c48fcc59e8c1b150d40241c31fc63adf4d15ccb3;hb=HEAD#l182

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

I agree; cf. https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
But it does not do so currently; therefore the distros fix up the
upstream behaviour.

> > 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>.)

In this case, localealias.c does not attempt to open a locale.alias file at all.

> 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.

When it's missing, localealias.c does not open a locale.alias file.
Negative effects can be seen after the ISO 639 language code of a language
changed or after the ISO 3166 country code of a territory changed. This is
currently not relevant, but may become relevant in the future again.

Which distros have it in /etc?
  - Guix 1.4.0: no
  - Debian 12, Ubuntu 23.10: yes, /usr/share/locale/locale.alias is a symlink.
  - CentOS Stream 9: no
  - Arch 19.11: no
  - openSUSE 15.5: no
  - Slackware 15: no

So, to solve the problem, Guix would need to customize glibc
  1. to install locale.alias in /etc (= $(sysconfdir)),
  2. compile with a LOCALE_ALIAS_PATH=$(sysconfdir):$(localedir)

Then GNU gettext could be compiled with LOCALE_ALIAS_PATH=$(sysconfdir):$(localedir)
as well. This would work in standalone Guix, as well as in
Guix-on-top-of-another-distro.

Bruno







This bug report was last modified 195 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.