unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Locales in a Guix container (somewhat related to r-readr)?
@ 2020-02-20 15:39 Wiktor Żelazny
  2020-02-21 11:35 ` zimoun
  0 siblings, 1 reply; 3+ messages in thread
From: Wiktor Żelazny @ 2020-02-20 15:39 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 2294 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-24 14:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-20 15:39 Locales in a Guix container (somewhat related to r-readr)? Wiktor Żelazny
2020-02-21 11:35 ` zimoun
2020-02-24 14:27   ` Wiktor Żelazny

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 read-only IMAP folder(s) and NNTP newsgroup(s).