all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

* Re: Locales in a Guix container (somewhat related to r-readr)?
  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
  0 siblings, 1 reply; 3+ messages in thread
From: zimoun @ 2020-02-21 11:35 UTC (permalink / raw)
  To: help-guix, wz

Dear,

On Thu, 20 Feb 2020 at 16:42, Wiktor Żelazny <wz@freeshell.de> wrote:

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

Could you provide a minimalist example?


> Outside of a container, I can do this:
>
>    ~$ echo $LC_ALL
>
>    ~$ LC_ALL="en_US.utf8"
>    ~$ echo $LC_ALL
>    en_US.utf8

On my Debian machine, outside the container I get:

--8<---------------cut here---------------start------------->8---
$ LC_ALL="en_US.utf8"
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
--8<---------------cut here---------------end--------------->8---


> 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

I get that outside the container. It means that you did something
outside you are not doing inside.



> 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

I am not convinced by the hack of bug#39665 [1].

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=39665#8


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

I do not know.



All the best,
simon

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

* Re: Locales in a Guix container (somewhat related to r-readr)?
  2020-02-21 11:35 ` zimoun
@ 2020-02-24 14:27   ` Wiktor Żelazny
  0 siblings, 0 replies; 3+ messages in thread
From: Wiktor Żelazny @ 2020-02-24 14:27 UTC (permalink / raw)
  To: help-guix

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

On Fri, Feb 21, 2020 at 12:35:18PM +0100, zimoun wrote:

> > 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().
>
> Could you provide a minimalist example?

Not with readr::read_csv() because of the tzdata thing, but even
simpler:

   cat > test.csv << "EOF"
   abc
   ábč
   àbç
   äbc
   åbc
   EOF
   guix environment --ad-hoc r -- Rscript -e 'read.csv("test.csv")'
   guix environment -C --pure --ad-hoc r -- Rscript -e 'read.csv("test.csv")'

The first one gives me, as expected:

   abc
   1 ábč
   2 àbç
   3 äbc
   4 åbc

The other one:

                  abc
   1 \303\241b\304\215
   2 \303\240b\303\247
   3        \303\244bc
   4        \303\245bc
   sh: rm: command not found

(BTW, no idea where this “rm” comes from)

> I am not convinced by the hack of bug#39665 [1].
>
> [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=39665#8

Sure, I’m not suggesting it as a satisfactory solution. But I think it sheds
some light on where the problem may lie.

WŻ

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

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.