Subject: guix invocation induces guile locale error
From: Bengt Richter <[email-masked]>
To: New-Bug <[email-masked]>
Date: Thu, 24 Oct 2019 04:14:20 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi guix,

guix describe (or guix anything) seems somehow to use guile without proper locale:

┌───────────────────────────────────────────────────────────────┐
│ guile: warning: failed to install locale                      │
│ Generation 18	Oct 23 2019 11:19:31 (current)                  │
│   guix 3f4ea9a                                                │
│     repository URL: https://git.savannah.gnu.org/git/guix.git │
│     branch: master                                            │
│     commit: 3f4ea9a62b5fa68d57724b2f83c35a191e33b7c8          │
└───────────────────────────────────────────────────────────────┘

whereas guile by itself does not complain, e.g. guile -v:

┌───────────────────────────────────────────────────────────────────────────┐
│ guile (GNU Guile) 2.2.6                                                   │
│ Copyright (C) 2019 Free Software Foundation, Inc.                         │
│                                                                           │
│ License LGPLv3+: GNU LGPL 3 or later <http://gnu.org/licenses/lgpl.html>. │
│ This is free software: you are free to change and redistribute it.        │
│ There is NO WARRANTY, to the extent permitted by law.                     │
└───────────────────────────────────────────────────────────────────────────┘

Poking around, I noticed guix invocation invokes a script that appears to use
glibc-utf8-locales-2.29 (see "===-NB:2.29->>>" arrow below)

$ which guix|xargs readlink -f|xargs cat -n
     1	#!/gnu/store/sc7z07gim1iq5zvfz1amdwf2irxrzifg-guile-2.2.6/bin/guile --no-auto-compile
     2	!#
     3	(begin (set! %load-path (cons (string-append "/gnu/store/h6h4ahrw8zq3zcjp8wxsv6nv24kjb293-guix-module-union" "/share/guile/site/" (effective-version)) %load-path)) (set! %load-compiled-path (cons (string-append "/gnu/store/h6h4ahrw8zq3zcjp8wxsv6nv24kjb293-guix-module-union" "/lib/guile/" (effective-version) "/site-ccache") %load-compiled-path)) (let ((locpath (getenv "GUIX_LOCPATH"))) (setenv "GUIX_LOCPATH" (string-append (if locpath (string-append locpath ":") "")

===-NB:2.29->>>    "/gnu/store/n79cf8bvy3k96gjk1rf18d36w40lkwlr-glibc-utf8-locales-2.29/lib/locale"

))) (let ((guix-main (module-ref (resolve-interface (quote (guix ui))) (quote guix-main)))) (begin (bindtextdomain "guix" "/gnu/store/0m73px55qzbx70v2k346igajrszzz8kb-guix-locale-guix") (bindtextdomain "guix-packages" "/gnu/store/c01aal3wvwlhi5h81rz14yasf70w04j2-guix-locale-guix-packages")) (apply guix-main (command-line))))$

## I'm wondering whether guix edit glibc-locales needs a 2.29 version of
┌────────────────────────────────────────────────────────────────────────────────┐
│ ;; Packages provided to ease use of binaries linked against the previous libc. │
│ (define-public glibc-locales-2.28                                              │
│   (package (inherit (make-glibc-locales glibc-2.28))                           │
│            (name "glibc-locales-2.28")))                                       │
│ (define-public glibc-utf8-locales-2.28                                         │
│   (package (inherit (make-glibc-utf8-locales glibc-2.28))                      │
│            (name "glibc-utf8-locales-2.28")))                                  │
└────────────────────────────────────────────────────────────────────────────────┘

## I didn't see a commit for glibc-locales 2.29 
$ pwd
/home/bokr/wb/guix
$ git log --grep='glibc-locales.*2\.2[89]'
WARNING: terminal is not fully functional
-  (press RETURN)
commit f77993bb50ad2bb02664697d81d4b12f2a0923b9
Author: Ludovic Courtès <[email-masked]>
Date:   Tue Sep 24 14:00:58 2019 +0200

    gnu: Add locale packages for glibc 2.28.
    
    * gnu/packages/base.scm (glibc-locales-2.28, glibc-utf8-locales-2.28):
    New variables.
    (glibc-locales-2.27, glibc-utf8-locales-2.27): Deprecate.

commit d4137d84ac75edaf2739578d0868cd77dd6da43c
Author: Kei Kebreau <[email-masked]>
Date:   Thu Jul 4 06:49:29 2019 -0400

    gnu: make-glibc-locales: Adjust patch for glibc 2.29.
    
    The patch for glibc 2.28 and earlier replaces the same content, but the context
    in the patch is different enough to fail to merge.
    
    * gnu/packages/base.scm (make-glibc-locales)[source]: Add patch.
    * gnu/packages/patches/glibc-locales.patch: Adjust for glibc 2.29 and move old
    file...
    * gnu/packages/patches/glibc-locales-2.28.patch: ...here.
    * gnu/local.mk (dist_patch_DATA): Add it.
$
## so, poking further ...

$ which guix|xargs readlink -f|xargs cat -n
/gnu/store/wg1ra0kswd2kspsqqdr3bcnrb61w8l6d-guix-command: a /gnu/store/sc7z07gim1iq5zvfz1amdwf2irxrzifg-guile-2.2.6/bin/guile --no-auto-compile script, ASCII text executable, with very long lines
$ which guix|xargs readlink -f|xargs cat -n
     1	#!/gnu/store/sc7z07gim1iq5zvfz1amdwf2irxrzifg-guile-2.2.6/bin/guile --no-auto-compile
     2	!#
     3	(begin (set! %load-path (cons (string-append "/gnu/store/h6h4ahrw8zq3zcjp8wxsv6nv24kjb293-guix-module-union" "/share/guile/site/" (effective-version)) %load-path)) (set! %load-compiled-path (cons (string-append "/gnu/store/h6h4ahrw8zq3zcjp8wxsv6nv24kjb293-guix-module-union" "/lib/guile/" (effective-version) "/site-ccache") %load-compiled-path)) (let ((locpath (getenv "GUIX_LOCPATH"))) (setenv "GUIX_LOCPATH" (string-append (if locpath (string-append locpath ":") "") "/gnu/store/n79cf8bvy3k96gjk1rf18d36w40lkwlr-glibc-utf8-locales-2.29/lib/locale"))) (let ((guix-main (module-ref (resolve-interface (quote (guix ui))) (quote guix-main)))) (begin (bindtextdomain "guix" "/gnu/store/0m73px55qzbx70v2k346igajrszzz8kb-guix-locale-guix") (bindtextdomain "guix-packages" "/gnu/store/c01aal3wvwlhi5h81rz14yasf70w04j2-guix-locale-guix-packages")) (apply guix-main (command-line))))$ 
$ 
$ # but 2.29 is not visibly installed, apparently:
$ guix package -I locales
guile: warning: failed to install locale
glibc-utf8-locales	2.28	out	/gnu/store/94k5w17z54w25lgp90czdqfv9m4hwzhq-glibc-utf8-locales-2.28
glibc-locales	2.28	out	/gnu/store/bb9alx1ap57pz0vmx7p1r8qk0lxxfg3x-glibc-locales-2.28
$
$ guix package -A glibc-.*locales
guile: warning: failed to install locale
glibc-locales	2.29	out	gnu/packages/base.scm:998:2
glibc-locales-2.28	2.28	out	gnu/packages/base.scm:1131:2
glibc-utf8-locales	2.29	out	gnu/packages/base.scm:1075:2
glibc-utf8-locales-2.28	2.28	out	gnu/packages/base.scm:1134:2
$ 
$ # so try to upgrade the first one
$ guix upgrade glibc-utf8-locales
guile: warning: failed to install locale
The following package will be upgraded:
   glibc-utf8-locales	2.28 → 2.29	/gnu/store/n79cf8bvy3k96gjk1rf18d36w40lkwlr-glibc-utf8-locales-2.29

substitute: updating substitutes from 'https://ci.guix.info'... 100.0%
substitute: updating substitutes from 'https://ci.guix.info'... 100.0%
building /gnu/store/l6740ia83s1nb4lh6jghs6xjba8nxvrh-avahi-0.7.tar.xz.drv...
\builder for `/gnu/store/l6740ia83s1nb4lh6jghs6xjba8nxvrh-avahi-0.7.tar.xz.drv' failed with exit code 1
build of /gnu/store/l6740ia83s1nb4lh6jghs6xjba8nxvrh-avahi-0.7.tar.xz.drv failed
View build log at '/var/log/guix/drvs/l6/740ia83s1nb4lh6jghs6xjba8nxvrh-avahi-0.7.tar.xz.drv.bz2'.
cannot build derivation `/gnu/store/b005cnj8016kn7f0c8jqcy5izbav32c3-avahi-0.7.drv': 1 dependencies couldn't be built
guix upgrade: error: build of `/gnu/store/b005cnj8016kn7f0c8jqcy5izbav32c3-avahi-0.7.drv' failed
$ 
$ # What ??!! What does avahi have to do with locales?
$ guix show avahi
guile: warning: failed to install locale
name: avahi
version: 0.7
outputs: out
systems: x86_64-linux i686-linux
dependencies: [email-masked] [email-masked] [email-masked] [email-masked] [email-masked] [email-masked] [email-masked] [email-masked]
location: gnu/packages/avahi.scm:35:2
homepage: http://avahi.org
license: LGPL 2.1+
synopsis: Implementation of mDNS/DNS-SD protocols  
description: Avahi is a system which facilitates service discovery on a local network.  It is an implementation of the mDNS (for "Multicast DNS") and DNS-SD
+ (for "DNS-Based Service Discovery") protocols.

$ # also my pristine cloned git guix repo has no apparent commit for locales 2.29, as we saw above
$ cd ~/wb/guix
$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
$ git log|head
commit 08d0a35578854c8db774178628c2dd818828cb0c
Author: Tobias Geerinckx-Rice <[email-masked]>
Date:   Tue Oct 22 23:40:51 2019 +0200

    gnu: python-ipykernel: Update to 5.1.3.
    
    * gnu/packages/python-xyz.scm (python-ipykernel): Update to 5.1.3.
    [native-inputs]: Add python-flaky.

commit d195f623aa48f1534b57bb613bdc9a15ac3395e0

## I did guix pull as user, and going to root via su and real root via su -l
## the latter was at 0.16 ;-/ Now:
$ 
$ guix describe
guile: warning: failed to install locale
Generation 18	Oct 23 2019 11:19:31	(current)
  guix 3f4ea9a
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: 3f4ea9a62b5fa68d57724b2f83c35a191e33b7c8
$ su -c 'guix describe'
guile: warning: failed to install locale
Generation 18	Oct 23 2019 18:19:31	(current)
  guix 3f4ea9a
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: 3f4ea9a62b5fa68d57724b2f83c35a191e33b7c8
$ su -lc 'guix describe'
Password: 
Generation 2	Oct 23 2019 11:07:46	(current)
  guix 59d452d
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: 59d452da401c375e7bd18d2260c2e42ee0d05b72
$ # hm, snagged a different version there , but all pretty up to date
$
HTH to fix both the problem and the flawed process that keeps re-producing
whack-a-mole games at every major update. (too grumpy to chase this
with strace etc. :)

Anyone have an explanation for the avahi connection above? How did that get
tangled in? Or should I look for file system corruption? ;-/

--
Regards,
Bengt Richter