GNU bug report logs - #15608
kbd.scm unicode problem

Previous Next

Package: guix;

Reported by: "Guy Ze Grant" <gzg <at> riseup.net>

Date: Mon, 14 Oct 2013 14:54:02 UTC

Severity: normal

Tags: moreinfo

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

Full log


Message #8 received at 15608 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: "Guy Ze Grant" <gzg <at> riseup.net>
Cc: 15608 <at> debbugs.gnu.org
Subject: Re: bug#15608: kbd.scm unicode problem
Date: Wed, 16 Oct 2013 15:32:37 +0200
"Guy Ze Grant" <gzg <at> riseup.net> skribis:

> I was asked to post here, so here it is; Attached is my expression thus
> far for kbd, at the patch phase though -- the following issue pops up:
> "find-files: ./doc/utf/??????: No such file or directory", along with a
> spew of guile barf following (which you can see in the kbd.scm.log file).

As we discussed on IRC, the problem is that POSIX considers file names
to be just byte strings, and the encoding is up to the application, and
locale-dependent by default.  In practice people typically use UTF-8
(GLib and friends expect that.)

Here’s the problem and fix:

--8<---------------cut here---------------start------------->8---
$ echo $LANG
en_US.UTF-8

$ ls -a
.  ..  ♪♬

$ guile -c '(use-modules (ice-9 ftw)) (pk (scandir "."))'

;;; (("." ".." "??????"))

$ guile -c '(use-modules (ice-9 ftw)) (setlocale LC_ALL "en_US.utf8") (pk (scandir "."))'

;;; (("." ".." "♪♬"))
--8<---------------cut here---------------end--------------->8---

In the first run Guile uses the “C” locale, so it’s unable to decode “♪♬”.

In the second run it uses a UTF-8 locale, so everything works fine.

Back to kbd: can you add a phase after the ‘unpack’ phase that just
does this?

  (setlocale "LC_ALL" "en_US.utf8")

If that works we can probably make it the default in the ‘core-updates’
branch.

> (define-module (gnu packages kbd)

Since kbd is Linux-specific, could you put it in (gnu packages linux)?

[...]

>  102: 1 [patch-source-shebangs # ...]
> In unknown file:
>    ?: 0 [sort # #<procedure string<? (#:optional _ _ . _)>]
>
> ERROR: In procedure sort:
> ERROR: In procedure list-copy: Wrong type argument in position 1: ("./config/ylwrap" "./config/install-sh" "./config/depcomp" "./config/config.sub" "./config/config.rpath" "./config/missing" "./config/config.guess" "./config/mkinstalldirs" "./config/compile" "./
[...]
> " "./doc/utf/README" "./doc/utf/ethiopic" . #f)

It’s also a bug that ‘find-files’ returns a improper list when
encountering such an issue.  I’ll fit it in ‘core-updates’.

Thanks,
Ludo’.




This bug report was last modified 11 years and 36 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.