The local-file()'s error message is misleading.

  • Done
  • quality assurance status badge
Details
3 participants
  • Vitaliy Shatrov
  • Ludovic Courtès
  • Brendan Tildesley
Owner
unassigned
Submitted by
Vitaliy Shatrov
Severity
normal

Debbugs page

Vitaliy Shatrov wrote 4 years ago
(name . Das Guixen)(address . bug-guix@gnu.org)
3abd04a2adce73691b7ff963099d47ce@disroot.org
Hello there.
I ran in bash shell:



pwd
--> /home/vits

conf=~/guix/configuration/configuration.scm

ls $conf # file exists
--> ~/guix/configuration/configuration.scm

guix system build $conf
--> guix system: error: failed to load
'/home/vits/guix/configuration/configuration.scm': No such file or directory



The commands above will result in a successfull build if i
`cd guix/configuration` before doing `guix system build`
(both with rel. and abs. names).

Attached is WORKING config.scm. Error was caused by local-file()
used with _relative_ paths. Those were commented out, and this
config.scm works from any directory.

#guix:
Toggle quote (2 lines)
> ... error message is very misleading.

Better of course if the offending file will be print out:
"failed to load (...) /home/vits/auto-login: no such file or directory"

---
Thanks for attention, Vitaliy.
Attachment: config.scm
Ludovic Courtès wrote 4 years ago
(name . Vitaliy Shatrov)(address . guix.vits@disroot.org)(address . 43736-done@debbugs.gnu.org)
87zh55kvbz.fsf@inria.fr
Hi,

"Vitaliy Shatrov" <guix.vits@disroot.org> skribis:

Toggle quote (6 lines)
> ;; (define (custom-local-file str) ; shorthand, preserves permissions
> ;; (let* ((file (local-file str #:recursive? #t))
> ;; (dir (dirname (local-file-absolute-file-name file))))
> ;; (display (string-append "loading local file '" str "' from " dir "...\n"))
> ;; file))

[...]

Toggle quote (3 lines)
> ;; (auto-login (custom-local-file "auto-login"))
> ;; (syslog.conf (custom-local-file "syslog.conf")))

This will not have the desired effect. ‘local-file’ is special syntax:
it captures the source directory so that at run time it can resolve file
names relative to the source directory.

The ‘custom-local-file’ procedure does not do that. Consequently, file
names get resolved relative to $PWD instead.

Commit f43ffee90882c2d61b46d69728daa7432be297e4 improves on that by
emitting a warning at run time when ‘local-file’ is passed a non-literal
relative file name.

Thanks,
Ludo’.
Closed
Brendan Tildesley wrote 4 years ago
I think f43ffee... broke guix pull
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 43736@debbugs.gnu.org)
12f6346b-27e5-c4c3-153b-4d0d484d615e@brendan.scot
I just got this running guix pull building guix-system-tests. looks
kinda related to your patch since it mentions local-file



[ 6/ 54] loading... 22.2% of 27 filesrandom seed for tests: 1601620953
[ 10/ 54] loading... 37.0% of 27 filesBacktrace:
In ice-9/eval.scm:
163:9 19 (_ #(#(#<directory (gnu tests install) 7fffeda39640>) #<<operating-system> kernel: #<package linux-libre@5.8.12 gnu/packages/linux.scm:721 7fffe91d3c80> kernel-loadable-modules: ()?> ?))
173:47 18 (_ #(#(#(#<directory (gnu tests install) 7fffeda39640>) #<<operating-system> kernel: #<package linux-libre@5.8.12 gnu/packages/linux.scm:721 7fffe91d3c80> kernel-loadable-module?> ?) ?))
159:9 17 (_ #(#(#(#<directory (gnu tests install) 7fffeda39640>) #<<operating-system> kernel: #<package linux-libre@5.8.12 gnu/packages/linux.scm:721 7fffe91d3c80> kernel-loadable-module?> ?) ?))
159:9 16 (_ #(#(#(#<directory (gnu tests install) 7fffeda39640>) #<<operating-system> kernel: #<package linux-libre@5.8.12 gnu/packages/linux.scm:721 7fffe91d3c80> kernel-loadable-module?> ?) ?))
293:34 15 (_ #(#(#<directory (gnu tests install) 7fffeda39640>) #<<operating-system> kernel: #<package linux-libre@5.8.12 gnu/packages/linux.scm:721 7fffe91d3c80> kernel-loadable-modules: () ?>))
In srfi/srfi-1.scm:
586:29 14 (map1 (#<<service> type: #<service-type virtual-terminal 7fffe95c6300> value: #t> #<<service> type: #<service-type kmscon 7fffe95d4d00> value: #<<kmscon-configuration> kmscon: #<pa?> ?))
586:29 13 (map1 (#<<service> type: #<service-type kmscon 7fffe95d4d00> value: #<<kmscon-configuration> kmscon: #<package kmscon@0.0.0-1.01dd0a2 gnu/packages/terminals.scm:256 7fffeac0d320> v?> ?))
586:29 12 (map1 (#<<service> type: #<service-type login 7fffe95c6240> value: #<<login-configuration> motd: #<<plain-file> name: "motd" content: "\n\x1b[1;37mWelcome to the installation of GN?> ?))
586:29 11 (map1 (#<<service> type: #<service-type documentation 7fffe68542c0> value: "tty2"> #<<service> type: #<service-type configuration-template 7fffe6854180> value: #t> #<<service> type?> ?))
586:29 10 (map1 (#<<service> type: #<service-type configuration-template 7fffe6854180> value: #t> #<<service> type: #<service-type mingetty 7fffe95c61c0> value: #<<mingetty-configuration> mi?> ?))
586:29 9 (map1 (#<<service> type: #<service-type mingetty 7fffe95c61c0> value: #<<mingetty-configuration> mingetty: #<package mingetty@1.08 gnu/packages/admin.scm:701 7fffe931bdc0> tty: "tt?> ?))
586:29 8 (map1 (#<<service> type: #<service-type mingetty 7fffe95c61c0> value: #<<mingetty-configuration> mingetty: #<package mingetty@1.08 gnu/packages/admin.scm:701 7fffe931bdc0> tty: "tt?> ?))
586:29 7 (map1 (#<<service> type: #<service-type mingetty 7fffe95c61c0> value: #<<mingetty-configuration> mingetty: #<package mingetty@1.08 gnu/packages/admin.scm:701 7fffe931bdc0> tty: "tt?> ?))
586:29 6 (map1 (#<<service> type: #<service-type mingetty 7fffe95c61c0> value: #<<mingetty-configuration> mingetty: #<package mingetty@1.08 gnu/packages/admin.scm:701 7fffe931bdc0> tty: "tt?> ?))
586:29 5 (map1 (#<<service> type: #<service-type syslog 7fffe95c6140> value: #<<syslog-configuration> syslogd: #<file-append #<package inetutils@1.9.4 gnu/packages/admin.scm:598 7fffe931bf0?> ?))
586:17 4 (map1 (#<<service> type: #<service-type guix 7fffe95c6040> value: #<<guix-configuration> guix: #<package guix@1.1.0-27.1c21468 gnu/packages/package-management.scm:135 7fffead81e60>?> ?))
In ice-9/eval.scm:
196:43 3 (_ #(#(#(#<directory (gnu tests install) 7fffeda39640>) #<<service> type: #<service-type guix 7fffe95c6040> value: #<<guix-configuration> guix: #<package guix@1.1.0-27.1c21468 gn?>) #))
293:34 2 (_ #(#(#(#<directory (gnu tests install) 7fffeda39640>) #<<service> type: #<service-type guix 7fffe95c6040> value: #<<guix-configuration> guix: #<package guix@1.1.0-27.1c21468 gn?>) #))
In gnu/packages/package-management.scm:
549:20 1 (_)
In guix/gexp.scm:
405:0 0 (%local-file _ _ _ #:literal? _ #:location _ #:recursive? _ #:select? _)

guix/gexp.scm:405:0: In procedure %local-file:
Invalid keyword: "guix-current"
Attachment: file
Ludovic Courtès wrote 4 years ago
(name . Brendan Tildesley)(address . mail@brendan.scot)(address . 43736-done@debbugs.gnu.org)
87k0w7hd9l.fsf@gnu.org
Hi,

Brendan Tildesley <mail@brendan.scot> skribis:

Toggle quote (8 lines)
> In gnu/packages/package-management.scm:
> 549:20 1 (_)
> In guix/gexp.scm:
> 405:0 0 (%local-file _ _ _ #:literal? _ #:location _ #:recursive? _ #:select? _)
>
> guix/gexp.scm:405:0: In procedure %local-file:
> Invalid keyword: "guix-current"

Indeed. Fixed in 9471aea76ace5c0998d889fc5fbde7a6bcafc654, thanks!

Ludo’.
Closed
?
Your comment

This issue is archived.

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

To respond to this issue using the mumi CLI, first switch to it
mumi current 43736
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
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help