help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Locales in a Guix container (somewhat related to r-readr)?


From: Wiktor Żelazny
Subject: Locales in a Guix container (somewhat related to r-readr)?
Date: Thu, 20 Feb 2020 16:39:34 +0100

Dear list,

I don’t know if it’s some recent change in the Guix behavior, but I
noticed that I’m getting no utf-8 locales in a container. I discovered
it while reading a utf-8 csv file using readr::read_csv().

Outside of a container, I can do this:

   ~$ echo $LC_ALL

   ~$ LC_ALL="en_US.utf8"
   ~$ echo $LC_ALL
   en_US.utf8

But inside:

   ~$ guix environment -C --pure
   ~ [env]$ echo $LC_ALL

   ~ [env]$ LC_ALL="en_US.utf8"
   sh: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8): No such 
file or directory
   ~ [env]$ exit
   exit

Naively adding a locales input does not help:

   ~$ guix environment -C --pure --ad-hoc glibc-utf8-locales
   substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
   The following derivation will be built:
      /gnu/store/h68sy9r0zhkwv5iqmdhd4wrgflnjb6fk-profile.drv
   The following profile hooks will be built:
      /gnu/store/dcnhapdj613zrfjk683sqzyg49psdcya-ca-certificate-bundle.drv
      /gnu/store/g64qmp941a4jf0qdm7zxfcb965gvgr44-fonts-dir.drv
      /gnu/store/hi07h3l1rsgkmjhykx9pxw01ywl8vmyk-manual-database.drv
      /gnu/store/k504y06y3pgav5hi6b5vzmy1wqlgq452-info-dir.drv
   building CA certificate bundle...
   building fonts directory...
   building directory of Info manuals...
   building database for manual pages...
   building /gnu/store/h68sy9r0zhkwv5iqmdhd4wrgflnjb6fk-profile.drv...
   ~ [env]$ echo $LC_ALL

   ~ [env]$ LC_ALL="en_US.utf8"
   sh: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8): No such 
file or directory

Similarly as in the bug #39665, a solution, inspired by [1], comes with
a hack:

   ~ [env]$ export GUIX_LOCPATH=/gnu/store/$(ls -F /gnu/store | grep 
glibc-utf8-locales.*/ | tail -n 1)lib/locale
   ~ [env]$ LC_ALL=en_US.utf8

(for some reason, this has to be issued twice; the first time it throws
an error). With this, at least readr::read_csv() seems to work as
expected.

Are locales intentionally set to “C” in a container by default (or are
they unset, perhaps)? I guess so, and consequently, I’m not treating
this as a bug.

But I would like to ask: Is there an official, elegant way to get utf-8
locales in a container?

WŻ

[1]: https://github.com/pjotrp/guix-notes

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]