unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludovic.courtes@inria.fr>
To: 75458@debbugs.gnu.org
Cc: Florent Pruvost <florent.pruvost@inria.fr>,
	"Romain GARBAGE" <romain.garbage@inria.fr>
Subject: bug#75458: (guix platforms) & co. can end up loading incompatible modules
Date: Thu, 09 Jan 2025 12:01:12 +0100	[thread overview]
Message-ID: <871pxcs13b.fsf@inria.fr> (raw)

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

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2226 bytes --]

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.

[-- Attachment #3: Type: text/plain, Size: 259 bytes --]


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

                 reply	other threads:[~2025-01-09 11:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871pxcs13b.fsf@inria.fr \
    --to=ludovic.courtes@inria.fr \
    --cc=75458@debbugs.gnu.org \
    --cc=florent.pruvost@inria.fr \
    --cc=romain.garbage@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).