bug#52727: When logged as user, GUILE_LOAD_COMPILED_PATH points to the system cache instead of the user cache

2021-12-23 Thread Liliana Marie Prikler
Am Donnerstag, dem 23.12.2021 um 08:31 +0100 schrieb Denis 'GNUtoo'
Carikli:
> On Wed, 22 Dec 2021 11:29:29 +0100
> Maxime Devos  wrote:
> 
> > Liliana Marie Prikler schreef op wo 22-12-2021 om 08:57 [+0100]:
> > > For the record, guile has been a part of the system profile since
> > > %base-packages were first defined, so if your load paths break,
> > > there is probably a larger issue at hand.  In this particular
> > > case,
> > > your local guix profile ought to shadow anything that's in
> > > /run/current- system, so I don't really get how the ABI match is
> > > triggered.  Perhaps you might want to debug that in a REPL.  
> > 
> > Maybe the system guix has a package module that does not exist in
> > the user guix, so guix tries to load the system package module
> > instead of the non-existing user package module?
> In my system.scm (I attached it) I do have a package (fdm-git) that
> doesn't exist elsewhere (because I need a patch that is upstream but
> not in an fdm release yet).
The only relevant package from your system.scm (in the context of this
problem) would be the guix package, but you're not even editing the
guix service so it'd be a file removed from guix upstream since you
last reconfigured.


Cheers





bug#52727: When logged as user, GUILE_LOAD_COMPILED_PATH points to the system cache instead of the user cache

2021-12-23 Thread Denis 'GNUtoo' Carikli
On Wed, 22 Dec 2021 11:29:29 +0100
Maxime Devos  wrote:

> Liliana Marie Prikler schreef op wo 22-12-2021 om 08:57 [+0100]:
> > For the record, guile has been a part of the system profile since
> > %base-packages were first defined, so if your load paths break,
> > there is probably a larger issue at hand.  In this particular case,
> > your local guix profile ought to shadow anything that's in
> > /run/current- system, so I don't really get how the ABI match is
> > triggered.  Perhaps you might want to debug that in a REPL.  
> 
> Maybe the system guix has a package module that does not exist in the
> user guix, so guix tries to load the system package module instead of
> the non-existing user package module?
In my system.scm (I attached it) I do have a package (fdm-git) that
doesn't exist elsewhere (because I need a patch that is upstream but
not in an fdm release yet).

Right now I can't test without fdm-git because when doing guix
system reconfigure, it tries to build guix but its tests fails. I'll
bugreport about that.

Denis.
;; Copyright (C) 2021 Denis 'GNUtoo' Carikli 
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see .

(use-modules
 (gnu)
 (gnu system mapped-devices)
 (gnu system nss)
 (guix build-system gnu)
 (guix git-download)
 ((guix licenses) #:prefix license:)
 (guix packages))
(use-package-modules
 admin
 android
 audio
 autotools
 base
 bash
 bison
 bootloaders
 certs
 commencement
 compression
 cryptsetup
 databases
 disk
 display-managers
 emacs
 emacs-xyz
 file
 flashing-tools
 freedesktop
 gnome
 gnupg
 linux
 mail
 mpd
 networking
 ncurses
 package-management
 patchutils
 pulseaudio
 python
 rsync
 screen
 ssh
 terminals
 tls
 tor
 version-control
 video
 vim
 virtualization
 web
 web-browsers
 wm
 xdisorg
 xfce
 xorg)
(use-service-modules
 databases
 desktop
 mail
 networking
 sound
 virtualization
 xorg)

(define-public fdm-git
  (package
(name "fdm-git")
(version "2.0+25")
(source
 (origin
   (method git-fetch)
   (uri (git-reference
 (url "https://github.com/nicm/fdm;)
 (commit "c245d210a5b0049f48c78e40af44d2889ecf217f")))
   (file-name (git-file-name name version))
   (sha256
(base32 "06al4rs11c859zwfqknicn31nz66w1g73bsb61463dk12q06pwy7"
(build-system gnu-build-system)
(inputs
 `(("tdb" ,tdb)
   ("openssl" ,openssl)
   ("zlib" ,zlib)))
(native-inputs
 `(("autoconf" ,autoconf)
   ("automake" ,automake)
   ("bison-3.6" ,bison-3.6)))
(home-page "https://github.com/nicm/fdm;)
(synopsis "Mail Retrieval Agent (MRA) and Mail Delivery Agent (MDA)")
(description "fdm is a program designed to fetch mail from POP3
or IMAP servers, or receive local mail from stdin, and
deliver it in various ways.")
(license
 ;; Why point to a source file?  Well, all the individual files have a
 ;; copy of this license in their headers, but there's no seprate file
 ;; with that information.
 (license:non-copyleft
  "https://github.com/nicm/fdm/blob/master/command.c;

(define %lvm-vg
  (list
   (mapped-device
(source (uuid "fd8d9fd8-56a5-4c61-9f6e-35371ff964f0"))
(target "internal-cleartext")
(type luks-device-mapping))
   (mapped-device
(source "primary_laptop")
(targets (list "primary_laptop-guix32"))
(type lvm-device-mapping
(define %guix32-rootfs
  (file-system
   (device "/dev/mapper/primary_laptop-guix32")
   (mount-point "/")
   (type "ext4")
   (dependencies %lvm-vg)))
(define %parabola32-rootfs
  (file-system
   (mount-point "/srv/distros/parabola32")
   (device "/dev/mapper/primary_laptop-parabola32")
   (type "ext4")
   (dependencies %lvm-vg)
   (create-mount-point? #t)
   (mount-may-fail? #t)))

(define (parabola32-bind-mount path)
  (file-system
   (mount-point path)
   (device (string-append "/srv/distros/parabola32" path))
   (type "none")
   (dependencies (list %parabola32-rootfs))
   (flags '(bind-mount))
   (create-mount-point? #t)
   (mount-may-fail? #t)))

(operating-system
 (host-name "primary_laptop")
 (timezone "Europe/Paris")
 (locale "en_US.utf8")
 (kernel-arguments (append (list
			"iomem=relaxed"
			"modprobe.blacklist=pcspkr"
			"quiet")))
 (initrd-modules (cons "i915" %base-initrd-modules))
 (keyboard-layout (keyboard-layout "us" "altgr-intl"))
 (bootloader (bootloader-configuration (bootloader (bootloader

bug#52727: When logged as user, GUILE_LOAD_COMPILED_PATH points to the system cache instead of the user cache

2021-12-22 Thread Liliana Marie Prikler
Am Mittwoch, dem 22.12.2021 um 11:32 +0100 schrieb Maxime Devos:
> Liliana Marie Prikler schreef op wo 22-12-2021 om 08:57 [+0100]:
> > No.  The Guix command as built by `guix pull' sets its own load path,
> > but respects system paths too.  You can check by spawning a REPL:
> > [...]
> 
> But are there any good reasons to respect $GUILE_LOAD{,_COMPILE}_PATH
> at all? Usually, we use wrap-program etc. to set load paths (guile,
> python, PATH or otherwise). Maybe guile-launcher can be modified to set
> the load path instead of appending to it?
IIUC the guix command does not particularly need to provide support for
multiple profiles, so we could isolate it.  After all, extensions ought
to be installed in the user's (single) current-guix profile, no? 
(Disregarding the use of guix environment/guix shell, of course.)  Or
more accurately, GUIX_EXTENSIONS_PATH serves as a different escape
hatch.






bug#52727: When logged as user, GUILE_LOAD_COMPILED_PATH points to the system cache instead of the user cache

2021-12-22 Thread Maxime Devos
Liliana Marie Prikler schreef op wo 22-12-2021 om 08:57 [+0100]:
> No.  The Guix command as built by `guix pull' sets its own load path,
> but respects system paths too.  You can check by spawning a REPL: [...]

But are there any good reasons to respect $GUILE_LOAD{,_COMPILE}_PATH
at all? Usually, we use wrap-program etc. to set load paths (guile,
python, PATH or otherwise). Maybe guile-launcher can be modified to set
the load path instead of appending to it?

Greetings,
Maxime.






bug#52727: When logged as user, GUILE_LOAD_COMPILED_PATH points to the system cache instead of the user cache

2021-12-22 Thread Maxime Devos
Liliana Marie Prikler schreef op wo 22-12-2021 om 08:57 [+0100]:
> For the record, guile has been a part of the system profile since
> %base-packages were first defined, so if your load paths break, there
> is probably a larger issue at hand.  In this particular case, your
> local guix profile ought to shadow anything that's in /run/current-
> system, so I don't really get how the ABI match is triggered.  Perhaps
> you might want to debug that in a REPL.

Maybe the system guix has a package module that does not exist in the
user guix, so guix tries to load the system package module instead of
the non-existing user package module?

Greetings,
Maxime






bug#52727: When logged as user, GUILE_LOAD_COMPILED_PATH points to the system cache instead of the user cache

2021-12-21 Thread Liliana Marie Prikler
Hi Denis,

Am Mittwoch, dem 22.12.2021 um 01:16 +0100 schrieb Denis 'GNUtoo'
Carikli:
> [A]s user GUILE_LOAD_COMPILED_PATH is somehow exported to system
> paths:
> > [gnutoo@primary_laptop ~]$ echo $GUILE_LOAD_COMPILED_PATH
> > /run/current-system/profile/lib/guile/3.0/site-ccache:/run/current-
> > system/profile/share/guile/site/3.0
> 
> So if I instead set it to the right paths it works again:
> > [gnutoo@primary_laptop guix]$ export
> > GUILE_LOAD_COMPILED_PATH="/home/gnutoo/.config/guix/current/lib/guile
> > /3.0/site-
> > ccache:/home/gnutoo/.config/guix/current/share/guile/site/3.0"
> > [gnutoo@primary_laptop guix]$ guix package -i hello
> > The following package will be upgraded:
> >    hello (dependencies or package changed)
> > 
> > nothing to be done
> 
> 'GUILE_LOAD_COMPILED_PATH="" guix package -i hello' also works.
> 
> In my case the issue is that having
> '/run/current-system/profile/lib/guile/3.0/site-ccache' in
> GUILE_LOAD_COMPILED_PATH makes it fail:
> > [gnutoo@primary_laptop guix]$ export
> > GUILE_LOAD_COMPILED_PATH=/run/current-
> > system/profile/lib/guile/3.0/site-ccache
> > [gnutoo@primary_laptop guix]$ guix package -i hello Backtrace:
> > In ice-9/boot-9.scm:
> >    222:29 19 (map1 (((gnu packages gnupg)) ((gnu packages golang))
> > …))
> [...]
> 
> And apparently it fails just because it is in the path:
> > [gnutoo@primary_laptop guix]$ export
> > GUILE_LOAD_COMPILED_PATH="/home/gnutoo/.config/guix/current/lib/guile
> > /3.0/site-
> > ccache:/home/gnutoo/.config/guix/current/share/guile/site/3.0:/run/cu
> > rrent-system/profile/lib/guile/3.0/site-ccache"
> > [gnutoo@primary_laptop guix]$ guix package -i hello Backtrace:
> > In ice-9/boot-9.scm:
> >    222:29 19 (map1 (((gnu packages gnupg)) ((gnu packages golang))
> > …))
> [...]
> 
> This behavior probably happens becuase the system guix wasn't updated
> with guix system reconfigure for some time, and that the user relies on
> the system guile cache.
> 
> And as I understand from #guix on liberachat, I'm supposed to be able
> to not keep my user profile and my guix system in sync.
This is only true to some extent.  The local guix command still relies
on things in the system, such as the guix daemon itself, so you ought
to keep it up to date.

GUILE_LOAD_PATH does not point to the system cache "instead of" the
user cache, it gets expanded via profiles as everything else.  Since
Guix has a system-wide installation of guile-3.0-latest, the guile
paths get set.  You should probably install Guile locally instead of
system-wide if you plan on having the two diverge farther.

> Would the solution to that be to correctly export
> GUILE_LOAD_COMPILED_PATH in  ~/.guix-profile/etc/profile like it is
> done in the patch I attached (with an extra small modification in the
> commit message to mention the bug report)?
No.  The Guix command as built by `guix pull' sets its own load path,
but respects system paths too.  You can check by spawning a REPL:

scheme@(guix-user)> %load-path
$1 = ("/gnu/store/yi47s6iy3glwzimy3nch1h7c9hjzmyw8-guix-module-
union/share/guile/site/3.0"
"/gnu/store/3h3jn0745ngd87zp83k5smwhykxvdfgf-guile-
3.0.7/share/guile/3.0" "/gnu/store/3h3jn0745ngd87zp83k5smwhykxvdfgf-
guile-3.0.7/share/guile/3.0"
"/gnu/store/3h3jn0745ngd87zp83k5smwhykxvdfgf-guile-
3.0.7/share/guile/site/3.0"
"/gnu/store/3h3jn0745ngd87zp83k5smwhykxvdfgf-guile-
3.0.7/share/guile/site" "/gnu/store/3h3jn0745ngd87zp83k5smwhykxvdfgf-
guile-3.0.7/share/guile" "/run/current-
system/profile/share/guile/site/3.0")

> Other commits fixing bugs in that same profile mentioned bug reports,
> so I assume that it's simplier to discuss the bug in a bug report
> than directly sending a patch to fix the issue.
> 
> Note that I also didn't test the patch yet but I did test that export
> command.
For the record, guile has been a part of the system profile since
%base-packages were first defined, so if your load paths break, there
is probably a larger issue at hand.  In this particular case, your
local guix profile ought to shadow anything that's in /run/current-
system, so I don't really get how the ABI match is triggered.  Perhaps
you might want to debug that in a REPL.

Cheers





bug#52727: When logged as user, GUILE_LOAD_COMPILED_PATH points to the system cache instead of the user cache

2021-12-21 Thread Denis 'GNUtoo' Carikli
Hi,

When running guix package -i hello as user (gnutoo) I have:
> [gnutoo@primary_laptop ~]$ guix package -i hello
> Backtrace:
> In ice-9/boot-9.scm:
>222:29 19 (map1 (((gnu packages gnupg)) ((gnu packages golang)) …))
>222:29 18 (map1 (((gnu packages golang)) ((gnu packages #)) (#) …))
>222:29 17 (map1 (((gnu packages graphics)) ((gnu packages gtk)) …))
>222:29 16 (map1 (((gnu packages gtk)) ((gnu packages guile)) (#)
> …)) 222:29 15 (map1 (((gnu packages guile)) ((gnu packages linux)) #
> …)) 222:29 14 (map1 (((gnu packages linux)) ((gnu packages #)) ((…))
> …)) 222:29 13 (map1 (((gnu packages ncurses)) ((gnu packages nss)) #
> …)) 222:29 12 (map1 (((gnu packages nss)) ((gnu packages perl)) (#)
> …)) 222:29 11 (map1 (((gnu packages perl)) ((gnu packages #)) ((…))
> …)) 222:17 10 (map1 (((gnu packages perl-web)) ((gnu packages #)) #
> …)) 3326:17  9 (resolve-interface (gnu packages perl-web) #:select _
> # …) In ice-9/threads.scm:
> 390:8  8 (_ _)
> In ice-9/boot-9.scm:
>   3252:13  7 (_)
> In ice-9/threads.scm:
> 390:8  6 (_ _)
> In ice-9/boot-9.scm:
>   3536:20  5 (_)
>2835:4  4 (save-module-excursion # ice-9/boo…>) 3556:26  3 (_)
> In unknown file:
>2 (primitive-load-path "gnu/packages/perl-web"
> #) In gnu/packages/perl-web.scm:
>  36:5  1 (_)
> In ice-9/boot-9.scm:
>   1685:16  0 (raise-exception _ #:continuable? _)
> 
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> Throw to key `record-abi-mismatch-error' with args `(abi-check "~a:
> record ABI mismatch; recompilation needed" (#>)
> ())'.

However that works fine with sudo su:
> [gnutoo@primary_laptop ~]$ sudo su
> [root@primary_laptop gnutoo]# guix package -i hello
> guix package: warning: Consider running 'guix pull' followed by
> 'guix package -u' to get up-to-date packages and security updates.
> 
> The following package will be installed:
>hello 2.10
> 
> The following derivation will be built:
>/gnu/store/ck96mk8hphd9k70a06y8ciqy0p3yp4qa-profile.drv
> 
> 0.1 MB will be downloaded
>  hello-2.10  52KiB
> 444KiB/s 00:00 [##]
> 100.0% building CA certificate bundle... listing Emacs
> sub-directories... building fonts directory...
> building directory of Info manuals...
> building profile with 1 package...
> hint: Consider setting the necessary environment variables by running:
> 
>  GUIX_PROFILE="/root/.guix-profile"
>  . "$GUIX_PROFILE/etc/profile"
> 
> Alternately, see `guix package --search-paths -p
> "/root/.guix-profile"'.

As I understand from what I was told on #guix, when running sudo su,
guix comes from the system:
> [root@primary_laptop ~]# which guix
> /run/current-system/profile/bin/guix

Whereas when running it from the user, it doesn't:
> [gnutoo@primary_laptop ~]$ which guix
> /home/gnutoo/.config/guix/current/bin/guix

And as user GUILE_LOAD_COMPILED_PATH is somehow exported to system
paths:
> [gnutoo@primary_laptop ~]$ echo $GUILE_LOAD_COMPILED_PATH
> /run/current-system/profile/lib/guile/3.0/site-ccache:/run/current-system/profile/share/guile/site/3.0

So if I instead set it to the right paths it works again:
> [gnutoo@primary_laptop guix]$ export
> GUILE_LOAD_COMPILED_PATH="/home/gnutoo/.config/guix/current/lib/guile/3.0/site-ccache:/home/gnutoo/.config/guix/current/share/guile/site/3.0"
> [gnutoo@primary_laptop guix]$ guix package -i hello
> The following package will be upgraded:
>hello (dependencies or package changed)
> 
> nothing to be done

'GUILE_LOAD_COMPILED_PATH="" guix package -i hello' also works.

In my case the issue is that having
'/run/current-system/profile/lib/guile/3.0/site-ccache' in
GUILE_LOAD_COMPILED_PATH makes it fail:
> [gnutoo@primary_laptop guix]$ export
> GUILE_LOAD_COMPILED_PATH=/run/current-system/profile/lib/guile/3.0/site-ccache
> [gnutoo@primary_laptop guix]$ guix package -i hello Backtrace:
> In ice-9/boot-9.scm:
>222:29 19 (map1 (((gnu packages gnupg)) ((gnu packages golang)) …))
[...]

And apparently it fails just because it is in the path:
> [gnutoo@primary_laptop guix]$ export
> GUILE_LOAD_COMPILED_PATH="/home/gnutoo/.config/guix/current/lib/guile/3.0/site-ccache:/home/gnutoo/.config/guix/current/share/guile/site/3.0:/run/current-system/profile/lib/guile/3.0/site-ccache"
> [gnutoo@primary_laptop guix]$ guix package -i hello Backtrace:
> In ice-9/boot-9.scm:
>222:29 19 (map1 (((gnu packages gnupg)) ((gnu packages golang)) …))
[...]

This behavior probably happens becuase the system guix wasn't updated
with guix system reconfigure for some time, and that the user relies on
the system guile cache.

And as I understand from #guix on liberachat, I'm supposed to be able
to not keep my user profile and my guix system in sync.

Would the solution to that be to correctly export
GUILE_LOAD_COMPILED_PATH in  ~/.guix-profile/etc/profile like it is
done in the patch I attached (with an extra small modification in the
commit message to mention the bug report)?

Other commits