GNU bug report logs - #75458
(guix platforms) & co. can end up loading incompatible modules

Previous Next

Package: guix;

Reported by: Ludovic Courtès <ludovic.courtes <at> inria.fr>

Date: Thu, 9 Jan 2025 11:02:02 UTC

Severity: important

To reply to this bug, email your comments to 75458 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to florent.pruvost <at> inria.fr, romain.garbage <at> inria.fr, bug-guix <at> gnu.org:
bug#75458; Package guix. (Thu, 09 Jan 2025 11:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ludovic Courtès <ludovic.courtes <at> inria.fr>:
New bug report received and forwarded. Copy sent to florent.pruvost <at> inria.fr, romain.garbage <at> inria.fr, bug-guix <at> gnu.org. (Thu, 09 Jan 2025 11:02:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludovic.courtes <at> inria.fr>
To: bug-guix <at> gnu.org
Subject: (guix platforms) & co. can end up loading incompatible modules
Date: Thu, 09 Jan 2025 12:01:12 +0100
[Message part 1 (text/plain, inline)]
Hello,

A colleague reported this weird “unbound variable” error message, which
is ignored in this case but can be fatal in other cases (see below):

--8<---------------cut here---------------start------------->8---
$ guix time-machine -C /tmp/channels.scm -- shell emacs-elementaryx-ox-publish-as-default bash-minimal -n
error: #{ %make-platform-procedure/abi-check}#: unbound variable
hint: Did you forget a `use-modules' form?

14.4 MB would be downloaded
$ cat /tmp/channels.scm 
(list (channel
        (name 'guix)
        (url "https://git.savannah.gnu.org/git/guix.git")
        (branch "master")
        (commit
          "5a95cf76e1d0f9fdff5b232b42337c657b76d1d4")
        (introduction
          (make-channel-introduction
            "9edb3f66fd807b096b48283debdcddccfea34bad"
            (openpgp-fingerprint
              "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA"))))
      (channel
        (name 'guix-hpc)
        (url "https://gitlab.inria.fr/guix-hpc/guix-hpc.git")
        (branch "master")
        (commit
          "b7608db6ecff32e2569ed8407d62ac1485e2856a")))
--8<---------------cut here---------------end--------------->8---

The crux of the problem is that ‘platforms’ happily browses any
‘guix/platforms’ it finds in the load path; in my case, after looking
for guix/platforms modules in this specific Guix instance, it goes on to
browse ~/.guix-home/profile/… and /run/current-system/profile/…, both of
which being on GUILE_LOAD_PATH.  The modules it finds there, in this
case, are not ABI-compatible with those of the Guix instance, hence the
error message.

Reduced case:

--8<---------------cut here---------------start------------->8---
$ guix time-machine -C /tmp/channels.scm -- repl -q
GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guix-user)> ,use(guix platform)
scheme@(guix-user)> (platform-modules)
error: #{ %make-platform-procedure/abi-check}#: unbound variable
hint: Did you forget a `use-modules' form?

$1 = (#<interface (guix platforms arm) 7f2929e0c8c0> #<interface (guix platforms avr) 7f2929e0c640> #<interface (guix platforms mips) 7f2929e0c3c0> #<interface (guix platforms or1k) 7f2929e0c140> #<interface (guix platforms powerpc) 7f2929ebde60> #<interface (guix platforms riscv) 7f2929ebdbe0> #<interface (guix platforms x86) 7f2929ebd960> #<interface (guix platforms arm) 7f2929e0c8c0> #<interface (guix platforms avr) 7f2929e0c640> #<interface (guix platforms mips) 7f2929e0c3c0> #<interface (guix platforms or1k) 7f2929e0c140> #<interface (guix platforms powerpc) 7f2929ebde60> #<interface (guix platforms riscv) 7f2929ebdbe0> #<interface (guix platforms x86) 7f2929ebd960>)
scheme@(guix-user)> %load-path
$2 = ("/gnu/store/n9xy5r1a0njyn8ml33p4mm8rxfn93drb-guix-module-union/share/guile/site/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/site/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/site" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile" "/home/ludo/.guix-home/profile/share/guile/site/3.0" "/home/ludo/.guix-home/profile/share/guile/site/3.0" "/run/current-system/profile/share/guile/site/3.0")
--8<---------------cut here---------------end--------------->8---

The same problem exists in:

  • ‘image-modules’ in (gnu system images);

  • ‘build-system-modules’ in (guix import utils);

  • ‘importer-modules’ in (guix upstream);

  • ‘bootloader-modules’ in (gnu bootloader).

One radical way to fix it would be to not use anything outside the
module union:

[Message part 2 (text/x-patch, inline)]
diff --git a/guix/self.scm b/guix/self.scm
index 2652688c71..85fa3e1467 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -620,22 +620,20 @@ (define* (guix-command modules
                     (set! %load-extensions '(".scm"))
 
                     (set! %load-path
-                      (append (list (string-append #$module-directory
-                                                   "/share/guile/site/"
-                                                   (effective-version))
-                                    (string-append #$guile "/share/guile/"
-                                                   (effective-version)))
-                              %load-path))
+                          (list (string-append #$module-directory
+                                               "/share/guile/site/"
+                                               (effective-version))
+                                (string-append #$guile "/share/guile/"
+                                               (effective-version))))
 
                     (set! %load-compiled-path
-                      (append (list (string-append #$module-directory
-                                                   "/lib/guile/"
-                                                   (effective-version)
-                                                   "/site-ccache")
-                                    (string-append #$guile "/lib/guile/"
-                                                   (effective-version)
-                                                   "/ccache"))
-                              %load-compiled-path))
+                          (list (string-append #$module-directory
+                                               "/lib/guile/"
+                                               (effective-version)
+                                               "/site-ccache")
+                                (string-append #$guile "/lib/guile/"
+                                               (effective-version)
+                                               "/ccache")))
 
                     ;; To maximize the chances that locales are set up right
                     ;; out-of-the-box, bundle "common" UTF-8 locales.
[Message part 3 (text/plain, inline)]
That would make it impossible to use external Guile libraries from ‘guix
repl’, for example.

Another solution would be for all the ‘all-modules’ call sites to limit
their search to (current-profile).  Probably better.

Thoughts?

Ludo’.

Severity set to 'important' from 'normal' Request was from Ludovic Courtès <ludo <at> chbouib.org> to control <at> debbugs.gnu.org. (Tue, 15 Apr 2025 08:25:03 GMT) Full text and rfc822 format available.

This bug report was last modified 69 days ago.

Previous Next


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