Incorrect handling of -L flag on guix system commands

  • Open
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Sergio Pastor Pérez
Owner
unassigned
Submitted by
Sergio Pastor Pérez
Severity
normal
S
S
Sergio Pastor Pérez wrote on 9 Oct 2023 12:16
(address . bug-guix@gnu.org)
DU2P193MB2132FC35A4F3B48A2C83AFE2F3CEA@DU2P193MB2132.EURP193.PROD.OUTLOOK.COM
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:
Toggle snippet (4 lines)
λ ls
base-system.scm bordercollie.scm sheepbook.scm

base-system.scm:
Toggle snippet (8 lines)
(define-module (base-system)
#:use-module (gnu))
...
(define-public %base-system
(operating-system
...))

bordercollie.scm:
Toggle snippet (8 lines)
(define-module (bordercollie)
#:use-module (base-system)
...)
(operating-system
(inherit %base-system)
...)

sheepbook.scm:
Toggle snippet (8 lines)
(define-module (sheepbook)
#:use-module (base-system)
...)
(operating-system
(inherit %base-system)
...)

Toggle snippet (7 lines)
λ guix system build -L . bordercollie.scm
error: %useful-gnome-extensions: unbound variable
hint: Did you forget `(use-modules (base-system))'?

/gnu/store/gf21yc9ii1cfd3ki9hnn8ac5d65923ir-system

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:
Toggle snippet (4 lines)
λ GUILE_LOAD_PATH=$(pwd):$GUILE_LOAD_PATH guix system build bordercollie.scm
/gnu/store/gf21yc9ii1cfd3ki9hnn8ac5d65923ir-system

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.
L
L
Ludovic Courtès wrote on 12 Oct 2023 16:28
(name . Sergio Pastor Pérez)(address . sergio.pastorperez@outlook.es)(address . 66419@debbugs.gnu.org)
87ttqvlxss.fsf@gnu.org
Hi,

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

Toggle quote (6 lines)
> λ 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’.
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 66419@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 66419
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch