unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / Atom feed
* bug#46390: “guix lint -L relative/path foo“ fails
@ 2021-02-08 22:39 zimoun
  2021-02-22 11:15 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: zimoun @ 2021-02-08 22:39 UTC (permalink / raw)
  To: 46390

Hi,

Here an example to reproduce.  Everything is fine with the full path…

--8<---------------cut here---------------start------------->8---
$ cat /tmp/example/hello.scm
(define-module (hello)
  #:use-module (guix packages)
  #:use-module (guix build-system gnu)
  #:use-module (guix git-download)
  #:use-module (guix licenses))

(define-public hi
  (package
    (name "hi")
    (version "2.10")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://example.org/hello-example.git")
                    (commit "e1eefd033b8a2c4c81babc6fde08ebb116c6abb8")))
              (sha256
               (base32
                "1im1gglfm4k10bh4mdaqzmx3lm3kivnsmxrvl6vyvmfqqzljq75l"))))
    (build-system gnu-build-system)
    (synopsis "Hello, GNU world: An example GNU package")
    (description
     "GNU Hello prints the message \"Hello, world!\" and then exits.  It
serves as an example of standard GNU coding practices.  As such, it supports
command-line arguments, multiple languages, and so on.")
    (home-page "https://www.gnu.org/software/hello/")
    (license gpl3+)))

$ guix lint -L /tmp/example hi -c source-file-name
/tmp/example/hello.scm:11:12: hi@2.10 : le nom du fichier source devrait contenir le nom du paquet
--8<---------------cut here---------------end--------------->8---

…but breaks with relative path:

--8<---------------cut here---------------start------------->8---
$ cd /tmp/
$ guix lint -L example hi -c source-file-name
Backtrace:
          13 (primitive-load "/home/sitour/.config/guix/current/bin/guix")
In guix/ui.scm:
  2150:12 12 (run-guix-command _ . _)
In ice-9/boot-9.scm:
  1736:10 11 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
  1731:15 10 (with-exception-handler #<procedure 7ff41750b750 at ice-9/boot-9.scm:1815:7 (exn)> _ #:unwind? _ #:unwind-for-type _)
In srfi/srfi-1.scm:
    634:9  9 (for-each #<procedure 7ff4175090e0 at guix/scripts/lint.scm:222:23 (spec)> ("hi"))
In guix/scripts/lint.scm:
     65:4  8 (run-checkers #<package hi@2.10 example/hello.scm:8 7ff415cc7dc0> (#<<lint-checker> name: source-file-name descripti…>) …)
In srfi/srfi-1.scm:
    634:9  7 (for-each #<procedure 7ff40797f480 at guix/scripts/lint.scm:65:14 (checker)> (#<<lint-checker> name: source-file-name…>))
In guix/scripts/lint.scm:
    74:21  6 (_ _)
In guix/lint.scm:
    897:9  5 (check-source-file-name _)
   148:18  4 (%make-warning #<package hi@2.10 example/hello.scm:8 7ff415cc7dc0> "the source file name should contain the package n…" …)
In ice-9/boot-9.scm:
  1731:15  3 (with-exception-handler #<procedure 7ff40797f1e0 at ice-9/boot-9.scm:1815:7 (exn)> _ #:unwind? _ #:unwind-for-type _)
In ice-9/ports.scm:
   440:11  2 (call-with-input-file #f #<procedure 7ff40797f120 at guix/packages.scm:482:11 (port)> #:binary _ #:encoding _ # _)
In unknown file:
           1 (open-file #f "r" #:encoding #f #:guess-encoding #f)
In ice-9/boot-9.scm:
  1669:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1669:16: In procedure raise-exception:
Wrong type (expecting string): #f
--8<---------------cut here---------------end--------------->8---

The reason is from ’package-field-location’ in (guix packages):

--8<---------------cut here---------------start------------->8---
     (catch 'system-error
       (lambda ()
         ;; In general we want to keep relative file names for modules.
         (call-with-input-file (search-path %load-path file)
--8<---------------cut here---------------end--------------->8---

the ’search-path’ returns #f.  Somehow, the %load-path should only
contain absolute paths and here it is not the case.  Therefore, the fix
should be in (guix build):

--8<---------------cut here---------------start------------->8---
(define %standard-build-options
  ;; List of standard command-line options for tools that build something.
  (list (option '(#\L "load-path") #t #f
                (lambda (opt name arg result . rest)
                  ;; XXX: Imperatively modify the search paths.
                  (%package-module-path (cons arg (%package-module-path)))
                  (%patch-path (cons arg (%patch-path)))
                  (set! %load-path (cons arg %load-path))
                  (set! %load-compiled-path (cons arg %load-compiled-path))
--8<---------------cut here---------------end--------------->8---

For instance using ’canonicalize-path’.


All the best,
simon




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

* bug#46390: “guix lint -L relative/path foo“ fails
  2021-02-08 22:39 bug#46390: “guix lint -L relative/path foo“ fails zimoun
@ 2021-02-22 11:15 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2021-02-22 11:15 UTC (permalink / raw)
  To: zimoun; +Cc: 46390-done

Hi,

zimoun <zimon.toutoune@gmail.com> skribis:

> …but breaks with relative path:
>
> $ cd /tmp/
> $ guix lint -L example hi -c source-file-name
> Backtrace:
>           13 (primitive-load "/home/sitour/.config/guix/current/bin/guix")
> In guix/ui.scm:
>   2150:12 12 (run-guix-command _ . _)
> In ice-9/boot-9.scm:
>   1736:10 11 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
>   1731:15 10 (with-exception-handler #<procedure 7ff41750b750 at ice-9/boot-9.scm:1815:7 (exn)> _ #:unwind? _ #:unwind-for-type _)
> In srfi/srfi-1.scm:
>     634:9  9 (for-each #<procedure 7ff4175090e0 at guix/scripts/lint.scm:222:23 (spec)> ("hi"))
> In guix/scripts/lint.scm:
>      65:4  8 (run-checkers #<package hi@2.10 example/hello.scm:8 7ff415cc7dc0> (#<<lint-checker> name: source-file-name descripti…>) …)
> In srfi/srfi-1.scm:
>     634:9  7 (for-each #<procedure 7ff40797f480 at guix/scripts/lint.scm:65:14 (checker)> (#<<lint-checker> name: source-file-name…>))
> In guix/scripts/lint.scm:
>     74:21  6 (_ _)
> In guix/lint.scm:
>     897:9  5 (check-source-file-name _)
>    148:18  4 (%make-warning #<package hi@2.10 example/hello.scm:8 7ff415cc7dc0> "the source file name should contain the package n…" …)
> In ice-9/boot-9.scm:
>   1731:15  3 (with-exception-handler #<procedure 7ff40797f1e0 at ice-9/boot-9.scm:1815:7 (exn)> _ #:unwind? _ #:unwind-for-type _)
> In ice-9/ports.scm:
>    440:11  2 (call-with-input-file #f #<procedure 7ff40797f120 at guix/packages.scm:482:11 (port)> #:binary _ #:encoding _ # _)
> In unknown file:
>            1 (open-file #f "r" #:encoding #f #:guess-encoding #f)
> In ice-9/boot-9.scm:
>   1669:16  0 (raise-exception _ #:continuable? _)
>
> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
> Wrong type (expecting string): #f
>
>
> The reason is from ’package-field-location’ in (guix packages):
>
>      (catch 'system-error
>        (lambda ()
>          ;; In general we want to keep relative file names for modules.
>          (call-with-input-file (search-path %load-path file)

Indeed.  Fixed in 9a38bed2cf32e9462badfa43e74cdd4580e804fc.

Thanks!

Ludo’.




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

end of thread, other threads:[~2021-02-22 11:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 22:39 bug#46390: “guix lint -L relative/path foo“ fails zimoun
2021-02-22 11:15 ` Ludovic Courtès

unofficial mirror of bug-guix@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-bugs/0 guix-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-bugs guix-bugs/ https://yhetil.org/guix-bugs \
		bug-guix@gnu.org
	public-inbox-index guix-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.bugs
	nntp://news.gmane.io/gmane.comp.gnu.guix.bugs


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git