all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Wiktor Żelazny" <wz@freeshell.de>
To: help-guix@gnu.org
Subject: Locales in a Guix container (somewhat related to r-readr)?
Date: Thu, 20 Feb 2020 16:39:34 +0100	[thread overview]
Message-ID: <20200220153934.uqftcxvs4wv25bbh@wzguix> (raw)

[-- 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 --]

             reply	other threads:[~2020-02-20 15:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 15:39 Wiktor Żelazny [this message]
2020-02-21 11:35 ` Locales in a Guix container (somewhat related to r-readr)? zimoun
2020-02-24 14:27   ` Wiktor Żelazny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200220153934.uqftcxvs4wv25bbh@wzguix \
    --to=wz@freeshell.de \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.