GNU bug report logs - #66419
Incorrect handling of -L flag on guix system commands

Previous Next

Package: guix;

Reported by: Sergio Pastor Pérez <sergio.pastorperez <at> outlook.es>

Date: Mon, 9 Oct 2023 10:23:01 UTC

Severity: normal

To reply to this bug, email your comments to 66419 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 bug-guix <at> gnu.org:
bug#66419; Package guix. (Mon, 09 Oct 2023 10:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sergio Pastor Pérez <sergio.pastorperez <at> outlook.es>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 09 Oct 2023 10:23:02 GMT) Full text and rfc822 format available.

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

From: Sergio Pastor Pérez <sergio.pastorperez <at> outlook.es>
To: bug-guix <at> gnu.org
Subject: Incorrect handling of -L flag on guix system commands
Date: Mon, 09 Oct 2023 12:16:50 +0200
Good morning.

I've noticed that in system configurations split into different modules,
when using the -L flag, the `guix system build` command incorrectly
issues some errors. The error is ignored and the system is built
successfully.

For example, given a base system and 2 systems that inherit from it, the
error appears when building any of them:
--8<---------------cut here---------------start------------->8---
λ ls
base-system.scm  bordercollie.scm  sheepbook.scm
--8<---------------cut here---------------end--------------->8---

base-system.scm:
--8<---------------cut here---------------start------------->8---
(define-module (base-system)
  #:use-module (gnu))
...
(define-public %base-system
  (operating-system
   ...))
--8<---------------cut here---------------end--------------->8---

bordercollie.scm:
--8<---------------cut here---------------start------------->8---
(define-module (bordercollie)
  #:use-module (base-system)
  ...)
(operating-system
  (inherit %base-system)
  ...)
--8<---------------cut here---------------end--------------->8---

sheepbook.scm:
--8<---------------cut here---------------start------------->8---
(define-module (sheepbook)
  #:use-module (base-system)
  ...)
(operating-system
  (inherit %base-system)
  ...)
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
λ guix system build -L . bordercollie.scm 
error: %useful-gnome-extensions: unbound variable
hint: Did you forget `(use-modules (base-system))'?

/gnu/store/gf21yc9ii1cfd3ki9hnn8ac5d65923ir-system
--8<---------------cut here---------------end--------------->8---

As you can see this command has built successfully. Note that in this
particular case the error says that the unbound variable is
`%useful-gnome-extensions'. It will complain always about the first
think it encounters.

On the other hand relying on the `GUILE_LOAD_PATH', instead of using the
'-L' flag, removes the error:
--8<---------------cut here---------------start------------->8---
λ GUILE_LOAD_PATH=$(pwd):$GUILE_LOAD_PATH guix system build bordercollie.scm
/gnu/store/gf21yc9ii1cfd3ki9hnn8ac5d65923ir-system
--8<---------------cut here---------------end--------------->8---

I've noticed that for the error to appear, there has to be 2 systems
inheriting from the `base-system` module. If I remove `bordercollie.scm`
or `sheepbook.scm`, the other will build without issuing the error.

Regards,
Sergio.




Information forwarded to bug-guix <at> gnu.org:
bug#66419; Package guix. (Thu, 12 Oct 2023 14:30:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Sergio Pastor Pérez <sergio.pastorperez <at> outlook.es>
Cc: 66419 <at> debbugs.gnu.org
Subject: Re: bug#66419: Incorrect handling of -L flag on guix system commands
Date: Thu, 12 Oct 2023 16:28:51 +0200
Hi,

Sergio Pastor Pérez <sergio.pastorperez <at> outlook.es> skribis:

> λ guix system build -L . bordercollie.scm 
> error: %useful-gnome-extensions: unbound variable
> hint: Did you forget `(use-modules (base-system))'?
>
> /gnu/store/gf21yc9ii1cfd3ki9hnn8ac5d65923ir-system

‘-L’ does more than setting ‘GUILE_LOAD_PATH’; it’s equivalent to ‘-L’
in other ‘guix’ commands, meaning that it changes ‘%package-search-path’
(like the ‘GUIX_PACKAGE_PATH’ environment variable).

In doing so, it causes package lookup by name to traverse all the .scm
files in $PWD in this case.  In other words, ‘guix system -L.’ ends up
loading ./*.scm.  This is probably the source of confusion.

HTH,
Ludo’.




This bug report was last modified 205 days ago.

Previous Next


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