lint failure for packages on load path specified with -L

  • Done
  • quality assurance status badge
Details
3 participants
  • Jack Hill
  • Ludovic Courtès
  • zimoun
Owner
unassigned
Submitted by
Jack Hill
Severity
normal
J
J
Jack Hill wrote on 26 Jul 2020 06:20
(address . bug-guix@gnu.org)
alpine.DEB.2.21.2007260012240.4809@marsh.hcoop.net
Hi Guix,

I'm running guix from commit 30aa5dd7e7180d163d409b080bf89e8a15a5ba4d.
I've created a package in local directory lint-test. `guix lint` errors
when processing this package, but other guix commands like build and show
work as expected. A session with these commands:

```
jackhill@alperton ~$ guix lint -L lint-test my-hello
Backtrace:y-hello@2.10 [formatting]...
8 (primitive-load "/home/jackhill/.config/guix/current/bi…")
In guix/ui.scm:
1974:12 7 (run-guix-command _ . _)
In ice-9/boot-9.scm:
1736:10 6 (with-exception-handler _ _ #:unwind? _ # _)
In guix/store.scm:
631:22 5 (thunk)
In srfi/srfi-1.scm:
634:9 4 (for-each #<procedure 7f40c0484020 at guix/scripts/lin…> …)
In guix/scripts/lint.scm:
60:4 3 (run-checkers _ _ #:store _)
In srfi/srfi-1.scm:
634:9 2 (for-each #<procedure 7f40b2ab53f0 at guix/scripts/lin…> …)
241:2 1 (for-each _ _)
In ice-9/boot-9.scm:
1669:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1669:16: In procedure raise-exception:
In procedure for-each: Wrong type argument: #f
jackhill@alperton ~$ guix build -L lint-test my-hello
/gnu/store/h21bncim3hshjpfbs1dn4kvg1ri6zb7z-my-hello-2.10
jackhill@alperton ~$ guix show -L lint-test my-hello
name: my-hello
version: 2.10
outputs: out
systems: x86_64-linux i686-linux
dependencies:
location: lint-test/my-hello.scm:8:2
license: GPL 3+
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.
```

my-hello.scm looks like:

```
(define-module (my-hello)
#:use-module (guix build-system gnu)
#:use-module (guix download)
#:use-module (guix licenses)
#:use-module (guix packages))

(define-public my-hello
(package
(name "my-hello")
(version "2.10")
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnu/hello/hello-" version
".tar.gz"))
(sha256
(base32
"0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
(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.")
(license gpl3+)))
```

Best,
Jack
J
J
Jack Hill wrote on 27 Jul 2020 05:36
(address . 42543@debbugs.gnu.org)
alpine.DEB.2.21.2007262318180.4809@marsh.hcoop.net
I believe that this problem is in the formatting checker. As I understand
it, that checker reads the actual sorece file. With that information, I
tried re-running link the the full path passed to -L, and it works as
expected:

guix lint -L /home/jackhill/lint-test my-hello

passing just the relative path, i.e. ./lint-test does not work. Passing
the full path also changes the local reported by guix show.

It seems like canonicalizing the locad path is the right thing to do.

Thoughts?
Jack
Z
Z
zimoun wrote on 27 Jul 2020 23:47
[PATCH 0/2] Canonicalize 'load-path' option
(address . 42543@debbugs.gnu.org)(name . zimoun)(address . zimon.toutoune@gmail.com)
20200727214754.14297-1-zimon.toutoune@gmail.com
Dear,

These 2 patches 'canonicalize-path' the command-line argument. I have not
enough power to burn CPU and run all the test suite. But from my local test,
it seems ok.

The second patch “improves“ the 'load-path' option by re-using
'%standard-build-options'; which means importing (guix scripts build). It
does not appear to me an issue and probably something historical and
forgotten. Otherwise, please tell me.


All the best,
simon

zimoun (2):
scripts: build: Canonicalize 'load-path' option.
scripts: repl: Canonicalize 'load-path' option.

guix/scripts/build.scm | 10 ++++++----
guix/scripts/repl.scm | 10 ++++------
2 files changed, 10 insertions(+), 10 deletions(-)


base-commit: 7b58d009a952e0c36446a0a5d06582f1e9822bb6
--
2.26.2
Z
Z
zimoun wrote on 27 Jul 2020 23:47
[PATCH 1/2] scripts: build: Canonicalize 'load-path' option.
(address . 42543@debbugs.gnu.org)(name . zimoun)(address . zimon.toutoune@gmail.com)
20200727214754.14297-2-zimon.toutoune@gmail.com
Reported by Jack Hill <jackhill@jackhill.us>.

* guix/scripts/build.scm (%standard-build-options): Canonicalize 'load-path'.
---
guix/scripts/build.scm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

Toggle diff (32 lines)
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 8ff2fd1910..f41221dd43 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -568,10 +569,11 @@ talking to a remote daemon\n")))
(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))
+ (let ((path (canonicalize-path arg)))
+ (%package-module-path (cons path (%package-module-path)))
+ (%patch-path (cons path (%patch-path)))
+ (set! %load-path (cons path %load-path))
+ (set! %load-compiled-path (cons path %load-compiled-path)))
(apply values (cons result rest))))
(option '(#\K "keep-failed") #f #f

base-commit: 7b58d009a952e0c36446a0a5d06582f1e9822bb6
--
2.26.2
Z
Z
zimoun wrote on 27 Jul 2020 23:47
[PATCH 2/2] scripts: repl: Canonicalize 'load-path' option.
(address . 42543@debbugs.gnu.org)(name . zimoun)(address . zimon.toutoune@gmail.com)
20200727214754.14297-3-zimon.toutoune@gmail.com
* guix/scripts/repl.scm: Use (guix scripts build) '%standard-build-options' to
deal with 'load-path' option.
---
guix/scripts/repl.scm | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

Toggle diff (30 lines)
diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm
index 0ea9c3655c..59edb543d1 100644
--- a/guix/scripts/repl.scm
+++ b/guix/scripts/repl.scm
@@ -21,6 +21,7 @@
(define-module (guix scripts repl)
#:use-module (guix ui)
#:use-module (guix scripts)
+ #:use-module ((guix scripts build) #:select (%standard-build-options))
#:use-module (guix repl)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
@@ -57,12 +58,9 @@
(option '(#\q) #f #f
(lambda (opt name arg result)
(alist-cons 'ignore-dot-guile? #t result)))
- (option '(#\L "load-path") #t #f
- (lambda (opt name arg result)
- ;; XXX: Imperatively modify the search paths.
- (set! %load-path (cons arg %load-path))
- (set! %load-compiled-path (cons arg %load-compiled-path))
- result))))
+ (find (lambda (option)
+ (member "load-path" (option-names option)))
+ %standard-build-options)))
(define (show-help)
--
2.26.2
Z
Z
zimoun wrote on 27 Jul 2020 23:54
Re: bug#42543: lint failure for packages on load path specified with -L
86365c1v5p.fsf@gmail.com
Dear,

The issue was in the “formatting” and “source” checkers, something
inconsistent with other parts (see “search-path %load-path”).

Therefore, “--load-path=path/to/modules” is now ’canonicalize-path’,
directly in “(guix scripts build)%standard-build-options” from where the
other load-path options derive.



All the best,
simon
Z
Z
zimoun wrote on 28 Jul 2020 00:54
tag #42543 patch
(address . control@debbugs.gnu.org)
86r1swzi03.fsf@gmail.com
tags 42543 patch
thanks
J
J
Jack Hill wrote on 28 Jul 2020 05:50
Re: bug#42543: lint failure for packages on load path specified with -L
(name . zimoun)(address . zimon.toutoune@gmail.com)(address . 42543@debbugs.gnu.org)
alpine.DEB.2.21.2007272347270.4809@marsh.hcoop.net
On Mon, 27 Jul 2020, zimoun wrote:

Toggle quote (11 lines)
> Dear,
>
> The issue was in the “formatting” and “source” checkers, something
> inconsistent with other parts (see “search-path %load-path”).
>
> Therefore, “--load-path=path/to/modules” is now ’canonicalize-path’,
> directly in “(guix scripts build)%standard-build-options” from where the
> other load-path options derive.
>
> See patch http://issues.guix.gnu.org/42543#2

Thank you. I've applied the patches and it fixes the problem for me. My
computer had some free cycles, so I ran the Guix test suite (make check)
and all looks good:

============================================================================
Testsuite summary for GNU Guix 1.0.1.20277-f43458
============================================================================
# TOTAL: 1065
# PASS: 1058
# SKIP: 5
# XFAIL: 2
# FAIL: 0
# XPASS: 0
# ERROR: 0
============================================================================

Best wishes,
Jack
L
L
Ludovic Courtès wrote on 5 Aug 2020 22:28
(name . Jack Hill)(address . jackhill@jackhill.us)(address . 42543@debbugs.gnu.org)
87d044on1k.fsf@gnu.org
Hi,

Jack Hill <jackhill@jackhill.us> skribis:

Toggle quote (22 lines)
> jackhill@alperton ~$ guix lint -L lint-test my-hello
> Backtrace:y-hello@2.10 [formatting]...
> 8 (primitive-load "/home/jackhill/.config/guix/current/bi…")
> In guix/ui.scm:
> 1974:12 7 (run-guix-command _ . _)
> In ice-9/boot-9.scm:
> 1736:10 6 (with-exception-handler _ _ #:unwind? _ # _)
> In guix/store.scm:
> 631:22 5 (thunk)
> In srfi/srfi-1.scm:
> 634:9 4 (for-each #<procedure 7f40c0484020 at guix/scripts/lin…> …)
> In guix/scripts/lint.scm:
> 60:4 3 (run-checkers _ _ #:store _)
> In srfi/srfi-1.scm:
> 634:9 2 (for-each #<procedure 7f40b2ab53f0 at guix/scripts/lin…> …)
> 241:2 1 (for-each _ _)
> In ice-9/boot-9.scm:
> 1669:16 0 (raise-exception _ #:continuable? _)
>
> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
> In procedure for-each: Wrong type argument: #f

I can’t reproduce this problem:

Toggle snippet (50 lines)
$ cat /tmp/t/my-hello.scm
(define-module (my-hello)
#:use-module (guix build-system gnu)
#:use-module (guix download)
#:use-module (guix licenses)
#:use-module (guix packages))

(define-public my-hello
(package
(name "my-hello")
(version "2.10")
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnu/hello/hello-" version
".tar.gz"))
(sha256
(base32
"0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
(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/t my-hello
$ echo $?
0
$ guix show -L /tmp/t my-hello
name: my-hello
version: 2.10
outputs: out
systems: x86_64-linux i686-linux
dependencies:
location: /tmp/t/my-hello.scm:8:2
homepage: https://www.gnu.org/software/hello/
license: GPL 3+
synopsis: Saluton, mondo GNU: ekzemplo de pako GNU
description: GNU Hello montras la mesa?on "Hello, world!" kaj fini?as. ?i funkcias kiel ekzemplo de norma
+ kodumada tradicio de GNU. Tiel, ?i subtenas komand-liniajn argumentojn, plurajn lingvojn, kaj tiel plu.

$ guix describe
Generacio 152 Aug 04 2020 17:34:23 (nuna)
guix abe3c5e
repository URL: https://git.savannah.gnu.org/git/guix.git
branch: master
commit: abe3c5ed7d04985c987e6c81aeb1284354ea0c77

Do you still have this problem?

(Besides, ‘canonicalize-path’ should be used sparsely: it’s quite
expensive and sometimes confusing for users. With the proposed patches,
“-L /does/not/exist” would now lead to an error.)

Thanks,
Ludo’.
J
J
Jack Hill wrote on 5 Aug 2020 23:42
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 42543@debbugs.gnu.org)
alpine.DEB.2.21.2008051720370.4809@marsh.hcoop.net
Hi Ludo’! Hope you've enjoyed your (short) time away from the keyboard :)

On Wed, 5 Aug 2020, Ludovic Courtès wrote:

Toggle quote (28 lines)
> Hi,
>
> Jack Hill <jackhill@jackhill.us> skribis:
>
>> jackhill@alperton ~$ guix lint -L lint-test my-hello
>> Backtrace:y-hello@2.10 [formatting]...
>> 8 (primitive-load "/home/jackhill/.config/guix/current/bi…")
>> In guix/ui.scm:
>> 1974:12 7 (run-guix-command _ . _)
>> In ice-9/boot-9.scm:
>> 1736:10 6 (with-exception-handler _ _ #:unwind? _ # _)
>> In guix/store.scm:
>> 631:22 5 (thunk)
>> In srfi/srfi-1.scm:
>> 634:9 4 (for-each #<procedure 7f40c0484020 at guix/scripts/lin…> …)
>> In guix/scripts/lint.scm:
>> 60:4 3 (run-checkers _ _ #:store _)
>> In srfi/srfi-1.scm:
>> 634:9 2 (for-each #<procedure 7f40b2ab53f0 at guix/scripts/lin…> …)
>> 241:2 1 (for-each _ _)
>> In ice-9/boot-9.scm:
>> 1669:16 0 (raise-exception _ #:continuable? _)
>>
>> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
>> In procedure for-each: Wrong type argument: #f
>
> I can’t reproduce this problem:

[…]

Toggle quote (16 lines)
> $ guix lint -L /tmp/t my-hello
> $ echo $?
> 0
> $ guix show -L /tmp/t my-hello
> name: my-hello
> version: 2.10
> outputs: out
> systems: x86_64-linux i686-linux
> dependencies:
> location: /tmp/t/my-hello.scm:8:2
> homepage: https://www.gnu.org/software/hello/
> license: GPL 3+
> synopsis: Saluton, mondo GNU: ekzemplo de pako GNU
> description: GNU Hello montras la mesa?on "Hello, world!" kaj fini?as. ?i funkcias kiel ekzemplo de norma
> + kodumada tradicio de GNU. Tiel, ?i subtenas komand-liniajn argumentojn, plurajn lingvojn, kaj tiel plu.

You've passed an absolute path to -L. Indeed, I don't don't see the
problem when I do that, only when using a relative path. Can you try
running `guix lint -L t my-hello` while your current working directory is
/tmp?

Toggle quote (2 lines)
> Do you still have this problem?

Yes, confirmed just now with 05f3d34094b23dc9612ff6641a0257bc4f7dcd12

Toggle quote (4 lines)
> (Besides, ‘canonicalize-path’ should be used sparsely: it’s quite
> expensive and sometimes confusing for users. With the proposed patches,
> “-L /does/not/exist” would now lead to an error.)

Perhaps this can be solved a different way. Could we propagate the
knowledge of the current working directory, and construct absolute path
when needed?

However, now that you, hopefully, better understand the problem, do we
want to support relative paths passed to -L? It seems that they happen to
work some places now, but not others (guix edit is another place where it
doesn't work). I would be equally happy if we decided to not support
relative paths, and warn the user when was was provided to -L.

I also think it might make sense for -L /does/not/exist to print a
(friendly) error rather than silently not loading modules, but I'm open to
arguments to the contrary.

Best,
Jack
Z
Z
zimoun wrote on 6 Aug 2020 00:33
bug#42543: lint failure for packages on load path specified with -L
(name . Ludovic Courtès)(address . ludo@gnu.org)
CAJ3okZ2gYUOCVcsWh5ifVoA+R0Mx_roOLCVj3jftifYqPzHa-w@mail.gmail.com
Hi Ludo,

I confirm the bug and please consider the fix sent in this thread:


Well, it tweaks using 'canonicalize-path' which is maybe not the right
thing. Let me know.

Cheers,
simon


On Wednesday, 5 August 2020, Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (94 lines)
> Hi,
>
> Jack Hill <jackhill@jackhill.us> skribis:
>
> > jackhill@alperton ~$ guix lint -L lint-test my-hello
> > Backtrace:y-hello@2.10 [formatting]...
> > 8 (primitive-load "/home/jackhill/.config/guix/current/bi…")
> > In guix/ui.scm:
> > 1974:12 7 (run-guix-command _ . _)
> > In ice-9/boot-9.scm:
> > 1736:10 6 (with-exception-handler _ _ #:unwind? _ # _)
> > In guix/store.scm:
> > 631:22 5 (thunk)
> > In srfi/srfi-1.scm:
> > 634:9 4 (for-each #<procedure 7f40c0484020 at guix/scripts/lin…> …)
> > In guix/scripts/lint.scm:
> > 60:4 3 (run-checkers _ _ #:store _)
> > In srfi/srfi-1.scm:
> > 634:9 2 (for-each #<procedure 7f40b2ab53f0 at guix/scripts/lin…> …)
> > 241:2 1 (for-each _ _)
> > In ice-9/boot-9.scm:
> > 1669:16 0 (raise-exception _ #:continuable? _)
> >
> > ice-9/boot-9.scm:1669:16: In procedure raise-exception:
> > In procedure for-each: Wrong type argument: #f
>
> I can’t reproduce this problem:
>
> --8<---------------cut here---------------start------------->8---
> $ cat /tmp/t/my-hello.scm
> (define-module (my-hello)
> #:use-module (guix build-system gnu)
> #:use-module (guix download)
> #:use-module (guix licenses)
> #:use-module (guix packages))
>
> (define-public my-hello
> (package
> (name "my-hello")
> (version "2.10")
> (source (origin
> (method url-fetch)
> (uri (string-append "mirror://gnu/hello/hello-" version
> ".tar.gz"))
> (sha256
> (base32
> "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
> (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/t my-hello
> $ echo $?
> 0
> $ guix show -L /tmp/t my-hello
> name: my-hello
> version: 2.10
> outputs: out
> systems: x86_64-linux i686-linux
> dependencies:
> location: /tmp/t/my-hello.scm:8:2
> homepage: https://www.gnu.org/software/hello/
> license: GPL 3+
> synopsis: Saluton, mondo GNU: ekzemplo de pako GNU
> description: GNU Hello montras la mesa?on "Hello, world!" kaj fini?as. ?i
> funkcias kiel ekzemplo de norma
> + kodumada tradicio de GNU. Tiel, ?i subtenas komand-liniajn argumentojn,
> plurajn lingvojn, kaj tiel plu.
>
> $ guix describe
> Generacio 152 Aug 04 2020 17:34:23 (nuna)
> guix abe3c5e
> repository URL: https://git.savannah.gnu.org/git/guix.git
> branch: master
> commit: abe3c5ed7d04985c987e6c81aeb1284354ea0c77
> --8<---------------cut here---------------end--------------->8---
>
> Do you still have this problem?
>
> (Besides, ‘canonicalize-path’ should be used sparsely: it’s quite
> expensive and sometimes confusing for users. With the proposed patches,
> “-L /does/not/exist” would now lead to an error.)
>
> Thanks,
> Ludo’.
>
>
>
>
Attachment: file
L
L
Ludovic Courtès wrote on 23 Aug 2020 23:10
(name . Jack Hill)(address . jackhill@jackhill.us)(address . 42543-done@debbugs.gnu.org)
87lfi59ih6.fsf@gnu.org
Hello!

Jack Hill <jackhill@jackhill.us> skribis:

Toggle quote (24 lines)
>> Jack Hill <jackhill@jackhill.us> skribis:
>>
>>> jackhill@alperton ~$ guix lint -L lint-test my-hello
>>> Backtrace:y-hello@2.10 [formatting]...
>>> 8 (primitive-load "/home/jackhill/.config/guix/current/bi…")
>>> In guix/ui.scm:
>>> 1974:12 7 (run-guix-command _ . _)
>>> In ice-9/boot-9.scm:
>>> 1736:10 6 (with-exception-handler _ _ #:unwind? _ # _)
>>> In guix/store.scm:
>>> 631:22 5 (thunk)
>>> In srfi/srfi-1.scm:
>>> 634:9 4 (for-each #<procedure 7f40c0484020 at guix/scripts/lin…> …)
>>> In guix/scripts/lint.scm:
>>> 60:4 3 (run-checkers _ _ #:store _)
>>> In srfi/srfi-1.scm:
>>> 634:9 2 (for-each #<procedure 7f40b2ab53f0 at guix/scripts/lin…> …)
>>> 241:2 1 (for-each _ _)
>>> In ice-9/boot-9.scm:
>>> 1669:16 0 (raise-exception _ #:continuable? _)
>>>
>>> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
>>> In procedure for-each: Wrong type argument: #f

[...]

Toggle quote (5 lines)
> You've passed an absolute path to -L. Indeed, I don't don't see the
> problem when I do that, only when using a relative path. Can you try
> running `guix lint -L t my-hello` while your current working directory
> is /tmp?

Oops you’re right. I’ve fixed the root issue with
d10474c38d58bdc676e64336769dc2e00cdfa8ed (avoiding ‘canonicalize-path’).

Thanks,
Ludo’.
Closed
J
J
Jack Hill wrote on 24 Aug 2020 22:23
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 42543-done@debbugs.gnu.org)
alpine.DEB.2.21.2008241623170.4809@marsh.hcoop.net
On Sun, 23 Aug 2020, Ludovic Courtès wrote:

Toggle quote (3 lines)
> I’ve fixed the root issue with d10474c38d58bdc676e64336769dc2e00cdfa8ed
> (avoiding ‘canonicalize-path’).

Awesome, thank you!
Closed
?
Your comment

This issue is archived.

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

To respond to this issue using the mumi CLI, first switch to it
mumi current 42543
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