Subject: bug#35671: 'glibc-utf8-locales' should include C.UTF-8 locale

From: Ludovic Courtès <[email-masked]>
Date: Mon, 13 May 2019 22:44:16 +0200

Hello,

Ludovic Courtès <[email-masked]> skribis:

> I noticed that on Debian 9, ‘guix-daemon.service’ (systemd) runs under
> the C.UTF-8 locale by default, even if the machine is otherwise
> configured with another locale.  Consequently, ‘guix substitute’ keeps
> complaining about locales and all that, which is terrible.

It turns out that the “C.UTF-8” locale doesn’t exist upstream in glibc:

  https://bugzilla.redhat.com/show_bug.cgi?id=902094

But anyway, I think we should just set “LC_ALL=en_US.utf8” in the
.service file: that’s what we do on Guix System, and the choice of a
locale doesn’t matter since ‘guix substitute’ honors the client’s
locale.

Meiyo Peng <[email-masked]> skribis:

> Ludovic Courtès writes:

[...]

>> Thus, I think ‘glibc-utf8-locales’ should provide that locale.
>
> And the zh_CN.UTF-8, zh_TW.UTF-8 please.

‘glibc-utf8-locales’ has always been described as an *arbitrary* sample
of UTF-8 locales (info "(guix) Application Setup").  Initially its main
purpose was to use it in build processes, but we’ve come to more or less
recommend it for users, which is not great because we know it only works
for some users.

I built a ‘glibc-utf8-locales’ package that provides all the supported
UTF-8 locales, and only UTF-8 locales:

--8<---------------cut here---------------start------------->8---
$ guix size /gnu/store/rh7iq1kwma7ir96mvzvqcg1v50yi05yp-glibc-utf8-locales-2.28
store item                                                       total    self
/gnu/store/rh7iq1kwma7ir96mvzvqcg1v50yi05yp-glibc-utf8-locales-2.28   855.7   855.7 100.0%
total: 855.7 MiB
$ ls -1d /gnu/store/rh7iq1kwma7ir96mvzvqcg1v50yi05yp-glibc-utf8-locales-2.28/lib/locale/2.28/*.utf8 |wc -l
312
$ guix size glibc-locales
store item                                                       total    self
/gnu/store/acl2wxzzkkcjv74rlqswdf9p8pwddlmk-glibc-locales-2.28     916.7   916.7 100.0%
total: 916.7 MiB
--8<---------------cut here---------------end--------------->8---

As you can see, it’s almost the same size as ‘glibc-locales’, so there’s
no point in having such a ‘glibc-utf8-locales’ package.

In Guix System, the (gnu system locale) module generates just the needed
locales.  I’m thinking we should do the same at the ‘guix package’
level.  For example, ‘guix package --install-locales’ would
automatically install whatever $LANG or $LC_* refers to.

Thoughts?

Thanks,
Ludo’.