unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43736: The local-file()'s error message is misleading.
@ 2020-10-01  4:56 Vitaliy Shatrov
  2020-10-02  6:14 ` Ludovic Courtès
  2020-10-02  6:54 ` bug#43736: I think f43ffee... broke guix pull Brendan Tildesley
  0 siblings, 2 replies; 4+ messages in thread
From: Vitaliy Shatrov @ 2020-10-01  4:56 UTC (permalink / raw)
  To: 43736

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

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:
> ... 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 #2: config.scm --]
[-- Type: application/octet-stream, Size: 6978 bytes --]

;; These both are decorative.
(eval-when (expand)             ; evaluated _before_ use-modules()
  (define default-uses (module-uses (current-module))))

(define additional-uses         ; evaluated _after_ use-modules()
  (let ((loaded-by-default? (lambda (x) (if (find (lambda (y) (eq? x y))
                                                  default-uses) #t #f))))
  (remove loaded-by-default? (module-uses (current-module)))))


(use-modules (gnu)       ; auto-load many useful things
             (gnu bootloader u-boot)        ; auto-load (gnu bootloader)
             (srfi srfi-1))
(use-service-modules admin
                     desktop
                     networking)
(use-package-modules linux
                     certs)


;; (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))

(define (pretty-print-modules message l)     ; decorative procedure
  (display message)
  (for-each (lambda (module)
              (display "   ")
              (display (module-name module))
              (newline))
            l))

(define custom-base-services
  ;; customized %base-services of 81ea278e05986f9ccee078bd00d4d7fc309dd19c.
  (let ((ttys (map (lambda (n) (string-append "tty" (number->string n)))
                   (iota 3 1)))
;;      (auto-login (custom-local-file "auto-login"))
;;      (syslog.conf (custom-local-file "syslog.conf")))
        (auto-login (plain-file "auto-login" "dummy"))
        (syslog.conf (plain-file "syslog.conf" "dummy")))
    (append
     (list
      ;; (?) Provide the login prompts on VT.
      (service login-service-type)

      ;; > Should start before any 'term-' service.
      ;; Set VT to UTF-8 mode.
      ;; (?) UTF-8 is default with the new Linux.  Remove?
      (service virtual-terminal-service-type)

      ;; The big enough VT fonts.
      (service console-font-service-type
               (map (lambda (tty) (cons tty "LatGrkCyr-12x22"))
                    ttys)))

     ;; Agetty.  Auto-login Users without a password.
     (map (lambda (tty)
            (service agetty-service-type
                     (agetty-configuration (login-program auto-login)
                                           ;; -L:  no carrier detect
                                           ;; -o:  pass arguments to `login`.
                                           (extra-options '("-L" "-o" "\\u"))
                                           (term "linux")
                                           (tty tty))))
          ttys)

     (list
      ;; `dhclient` from %base-packages can be used if this do not work.
      ;; Some services misbehave without a fast static configuraiton.
      (service static-networking-service-type
               (list (static-networking (interface "lo")
                                        (ip "127.0.0.1")
                                        (requirement '())
                                        (provision '(loopback)))

                     (static-networking (interface "eth0")
                                        (ip "192.168.0.127")
                                        (gateway "192.168.0.1"))))

      ;; Currently i assume a tmpfs /var/log.
      (syslog-service (syslog-configuration (config-file syslog.conf)))

      ;; > Save some entropy ... when rebooting.
      (service urandom-seed-service-type)

      ;; Tell Guix how to geek.
      (service guix-service-type
               (guix-configuration (extra-options '("--gc-keep-derivations=yes"
                                                    "--gc-keep-outputs=yes"))))

      ;; (!) Very important for Guix.
      (service nscd-service-type
               (nscd-configuration    ; changed fields: 'persistent?' -> #f
                (caches
                 (list (nscd-cache (database 'hosts)
                                   ;; Aggressively cache the host name cache
                                   ;; to improve privacy and resilience.
                                   (positive-time-to-live (* 3600 12))
                                   (negative-time-to-live 20)
                                   (persistent? #f))
                       (nscd-cache (database 'services)
                                   ;; Services are unlikely to change,
                                   ;; so we can be even more aggressive.
                                   (positive-time-to-live (* 3600 24))
                                   (negative-time-to-live 3600)
                                   (check-files? #t)   ;check /etc/services changes
                                   (persistent? #f))))))

      ;; (?) > The LVM2 rules are needed as soon as LVM2 or the device-mapper is
      ;; > used, so enable them by default.  The FUSE and ALSA rules are
      ;; > less critical, but handy.
      (service udev-service-type
               (udev-configuration
                (rules (list lvm2 fuse alsa-utils crda))))))))




(display "\n    B U I L D I N G    A    G N U    S Y S T E M\n\n")

(pretty-print-modules "\nThese modules were loaded by defualt:\n"
                      default-uses)

(pretty-print-modules "\nThe additional modules was loaded:\n"
                      additional-uses)

(newline)


(operating-system
 (host-name "simon")
 (timezone  "Asia/Krasnoyarsk")

 (kernel linux-libre-arm64-generic)

 (initrd-modules '())

 (bootloader (bootloader-configuration
              (bootloader u-boot-rockpro64-rk3399-bootloader)
              (target     "/dev/mmcblk2")))

 (file-systems
  (cons*
   (file-system (device (file-system-label "simonRoot"))
                (mount-point "/")
                (type "ext4")
                (flags '(no-atime)))
   (file-system (device (file-system-label "simonHome"))
                (mount-point "/home")
                (type "ext4")
                (flags '(no-atime)))
   (file-system (device "tmpfs")
                (mount-point "/var/log")
                (type "tmpfs")
                (flags '(no-atime no-exec no-suid no-dev))
                (options "size=64M,mode=755")
                (check? #f))
   %base-file-systems))

 (users
  (cons
   (user-account (name    "vits")
                 (comment "Vitaliy Shatrov")
                 (uid     1000)
                 (group "users")
                 (supplementary-groups '("audio" "netdev" "video" "wheel")))
   %base-user-accounts))

 (packages (cons*
            ;; HTTPS
            nss-certs
            ;; tty monitor resolution
            fbset
            ;; IDK
            %base-packages))

 (services
  (append custom-base-services
          (list (service elogind-service-type)
                (service openntpd-service-type
                         (openntpd-configuration
                          (allow-large-adjustment? #t)))))))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#43736: The local-file()'s error message is misleading.
  2020-10-01  4:56 bug#43736: The local-file()'s error message is misleading Vitaliy Shatrov
@ 2020-10-02  6:14 ` Ludovic Courtès
  2020-10-02  6:54 ` bug#43736: I think f43ffee... broke guix pull Brendan Tildesley
  1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2020-10-02  6:14 UTC (permalink / raw)
  To: Vitaliy Shatrov; +Cc: 43736-done

Hi,

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

> ;; (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))

[...]

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#43736: I think f43ffee... broke guix pull
  2020-10-01  4:56 bug#43736: The local-file()'s error message is misleading Vitaliy Shatrov
  2020-10-02  6:14 ` Ludovic Courtès
@ 2020-10-02  6:54 ` Brendan Tildesley
  2020-10-03  9:25   ` Ludovic Courtès
  1 sibling, 1 reply; 4+ messages in thread
From: Brendan Tildesley @ 2020-10-02  6:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 43736

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

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 #2: Type: text/html, Size: 5966 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#43736: I think f43ffee... broke guix pull
  2020-10-02  6:54 ` bug#43736: I think f43ffee... broke guix pull Brendan Tildesley
@ 2020-10-03  9:25   ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2020-10-03  9:25 UTC (permalink / raw)
  To: Brendan Tildesley; +Cc: 43736-done

Hi,

Brendan Tildesley <mail@brendan.scot> skribis:

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-03  9:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-01  4:56 bug#43736: The local-file()'s error message is misleading Vitaliy Shatrov
2020-10-02  6:14 ` Ludovic Courtès
2020-10-02  6:54 ` bug#43736: I think f43ffee... broke guix pull Brendan Tildesley
2020-10-03  9:25   ` Ludovic Courtès

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