“guix import -r“ fails with Bactktrace instead of error

  • Done
  • quality assurance status badge
Details
3 participants
  • Ludovic Courtès
  • Lulu
  • zimoun
Owner
unassigned
Submitted by
zimoun
Severity
normal
Merged with
Z
Z
zimoun wrote on 21 Oct 2020 15:19
(address . bug-guix@gnu.org)
87blgvg1i4.fsf@gmail.com
Dear,

Compare:

$ guix import elpa foo
guix import: error: failed to download package 'foo'

with:

$ guix import elpa foo -r
Backtrace:
4 (primitive-load "/home/simon/.config/guix/current/bin/guix")
In guix/ui.scm:
2116:12 3 (run-guix-command _ . _)
In guix/scripts/import.scm:
120:11 2 (guix-import . _)
In guix/scripts/import/elpa.scm:
103:16 1 (guix-import-elpa . _)
In guix/import/utils.scm:
431:36 0 (recursive-import "foo" gnu #:repo->guix-package _ #:guix-name _)

guix/import/utils.scm:431:36: In procedure recursive-import:
Wrong number of values returned to continuation (expected 2)



Idem with the importers: ’hackage’, ’pypi’, ’cran’, ’crate’ and ’opam’.
Note the special mention to ’gem’:

$ guix import gem kikoo -r
#f


All the best,
simon
L
“guix import -r“ fails with Bactktrace instead of error
(name . 44115@debbugs.gnu.org)(address . 44115@debbugs.gnu.org)
1526955024.4020.1604009529477@office.mailbox.org
Okay, this one was a tad difficult but I think I got it down. A problem was that
there were hacks in importers to circumvent this problem without actually solving
it. I'm going to send in annotated patches soon.

--
Lulu
L
[bug#44115] [PATCH] import: Make failed recursive imports yield an error instead of backtrace.
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
674201342.4055.1604011162338@office.mailbox.org
* guix/import/utils.scm (recursive-import): Move error handling of recursive imports to a single point.
* guix/import/gem.scm (gem->guix-package): Fix the `values' hack and make the procedure return #f on failure.
* guix/import/pypi.scm (pypi->guix-package): Fix the condition hack and make the procedure return #f on failure.

---
guix/import/gem.scm | 2 +-
guix/import/pypi.scm | 5 +----
guix/import/utils.scm | 9 +++++++--
3 files changed, 9 insertions(+), 7 deletions(-)

Toggle diff (58 lines)
diff --git a/guix/import/gem.scm b/guix/import/gem.scm
index 3fe240f36a..c97df149ab 100644
--- a/guix/import/gem.scm
+++ b/guix/import/gem.scm
@@ -143,7 +143,7 @@ VERSION, HASH, HOME-PAGE, DESCRIPTION, DEPENDENCIES, and LICENSES."
dependencies
licenses)
dependencies-names))
- (values #f '()))))
+ #f)))
(define (guix-package->gem-name package)
"Given a PACKAGE built from rubygems.org, return the name of the
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 15116e349d..9c6a825243 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -478,10 +478,7 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE."
(info (and project (pypi-project-info project))))
(and project
(guard (c ((missing-source-error? c)
- (let ((package (missing-source-error-package c)))
- (leave (G_ "no source release for pypi package ~a ~a~%")
- (project-info-name info)
- (project-info-version info)))))
+ #f))
(make-pypi-sexp (project-info-name info)
(project-info-version info)
(and=> (latest-source-release project)
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 145515c489..815a05988e 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -36,6 +36,7 @@
#:use-module (guix store)
#:use-module (guix download)
#:use-module (guix sets)
+ #:use-module (guix ui)
#:use-module (gnu packages)
#:use-module (ice-9 match)
#:use-module (ice-9 rdelim)
@@ -428,8 +429,12 @@ name corresponding to the upstream name."
(not (null? (find-packages-by-name (guix-name name)))))
(define (lookup-node name)
- (receive (package dependencies) (repo->guix-package name repo)
- (make-node name package dependencies)))
+ (call-with-values (lambda () (repo->guix-package name repo))
+ (match-lambda*
+ ((#f)
+ (leave (G_ "failed to download package '~a' during recursive import~%") name))
+ ((package dependencies)
+ (make-node name package dependencies)))))
(map node-package
(topological-sort (list (lookup-node package-name))
--
2.29.1
Z
Z
zimoun wrote on 18 Jan 2021 21:25
Re: bug#44115: “guix import -r “ fails with Bactktrace instead of error
(address . 44115@debbugs.gnu.org)
864kje9emb.fsf@gmail.com
Hi,

The commit bea3b17739fc591b8cf6db1f8d28a6f6c9585577 changed a bit the
importers. However, even before this commit, the errors are incorrectly
reported for ’gnu’ and ’json’, without the --recursive option, e.g,
commit 23e2cd156f. And bea3b17739 does not change anything. This very
same backtrace:

Toggle snippet (28 lines)
# Importer: gnu
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
Backtrace:
10 (primitive-load "/home/simon/.cache/guix/inferiors/uefwax7zflbosucfo3nxhvvwwyvldkx447xk…")
In guix/ui.scm:
2118:12 9 (run-guix-command _ . _)
In guix/scripts/import.scm:
120:11 8 (guix-import . _)
In ice-9/boot-9.scm:
1736:10 7 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
1731:15 6 (with-exception-handler #<procedure 7f44f4628900 at ice-9/boot-9.scm:1815:7 (exn)> _ # _ …)
In guix/import/gnu.scm:
111:2 5 (gnu->guix-package "kikoo-lol" #:key-download _)
In guix/gnu-maintenance.scm:
364:20 4 (latest-ftp-release "kikoo-lol" #:server _ #:directory _ #:keep-file? _ # _ #:ftp-open _ …)
In guix/ftp-client.scm:
233:6 3 (ftp-list #<<ftp-connection> socket: #<input-output: socket 15> addrinfo: #(32 10 1 6 …> …)
In srfi/srfi-1.scm:
460:18 2 (fold #<procedure 7f44f4628720 at guix/ftp-client.scm:187:10 (dir result)> _ _)
In guix/ftp-client.scm:
74:8 1 (_ _ _)
In ice-9/boot-9.scm:
1669:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1669:16: In procedure raise-exception:
Throw to key `ftp-error' with args `(#<input-output: socket 15> "CWD kikoo-lol" 550 "Failed to change directory.\r")'.

and

Toggle snippet (24 lines)
# Importer: json
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
Backtrace:
7 (primitive-load "/home/simon/.cache/guix/inferiors/uefwax7zflbosucfo3nxhvvwwyvldkx447xk…")
In guix/ui.scm:
2118:12 6 (run-guix-command _ . _)
In guix/scripts/import.scm:
120:11 5 (guix-import . _)
In guix/scripts/import/json.scm:
91:11 4 (guix-import-json . _)
In ice-9/boot-9.scm:
1731:15 3 (with-exception-handler #<procedure 7f25ebaf6210 at ice-9/boot-9.scm:1815:7 (exn)> _ # _ …)
In guix/import/json.scm:
61:19 2 (_)
In ice-9/ports.scm:
440:11 1 (call-with-input-file "kikoo-lol" #<procedure 7f25ebad92c0 at ice-9/ports.scm:492:3 (p)> …)
In unknown file:
0 (open-file "kikoo-lol" "r" #:encoding #f #:guess-encoding #f)

ERROR: In procedure open-file:
In procedure open-file: No such file or directory: "kikoo-lol"


Then, for the same commit 23e2cd156f and the importers supporting the
--recursive option, the only one reporting correctly the error is the
’stackage’ importer:

Toggle snippet (91 lines)
for from in pypi hackage stackage elpa gem cran opam ;\
do echo "# Importer: $from" ;\
guix time-machine --commit=23e2cd156f -- import $from kikoo-lol -r ;\
done
# Importer: pypi
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
following redirection to `https://pypi.org/pypi/kikoo-lol/json/'...
Backtrace:
4 (primitive-load "/home/simon/.cache/guix/inferiors/uefwax7zflbosucfo3nxhvvwwyvldkx447xk…")
In guix/ui.scm:
2118:12 3 (run-guix-command _ . _)
In guix/scripts/import.scm:
120:11 2 (guix-import . _)
In guix/scripts/import/pypi.scm:
97:16 1 (guix-import-pypi . _)
In guix/import/utils.scm:
431:36 0 (recursive-import "kikoo-lol" #f #:repo->guix-package _ #:guix-name _)

guix/import/utils.scm:431:36: In procedure recursive-import:
Wrong number of values returned to continuation (expected 2)
# Importer: hackage
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
Backtrace:
4 (primitive-load "/home/simon/.cache/guix/inferiors/uefwax7zflbosucfo3nxhvvwwyvldkx447xk…")
In guix/ui.scm:
2118:12 3 (run-guix-command _ . _)
In guix/scripts/import.scm:
120:11 2 (guix-import . _)
In guix/scripts/import/hackage.scm:
132:26 1 (guix-import-hackage . _)
In guix/import/utils.scm:
431:36 0 (recursive-import "kikoo-lol" #f #:repo->guix-package _ #:guix-name _)

guix/import/utils.scm:431:36: In procedure recursive-import:
Wrong number of values returned to continuation (expected 2)
# Importer: stackage
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
guix import: error: kikoo-lol: Stackage package not found
# Importer: elpa
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
Backtrace:
4 (primitive-load "/home/simon/.cache/guix/inferiors/uefwax7zflbosucfo3nxhvvwwyvldkx447xk…")
In guix/ui.scm:
2118:12 3 (run-guix-command _ . _)
In guix/scripts/import.scm:
120:11 2 (guix-import . _)
In guix/scripts/import/elpa.scm:
103:16 1 (guix-import-elpa . _)
In guix/import/utils.scm:
431:36 0 (recursive-import "kikoo-lol" gnu #:repo->guix-package _ #:guix-name _)

guix/import/utils.scm:431:36: In procedure recursive-import:
Wrong number of values returned to continuation (expected 2)
# Importer: gem
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
#f

# Importer: cran
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
error: failed to retrieve package information from "https://cran.r-project.org/web/packages/kikoo-lol/DESCRIPTION": 404 ("Not Found")
Backtrace:
4 (primitive-load "/home/simon/.cache/guix/inferiors/uefwax7zflbosucfo3nxhvvwwyvldkx447xk…")
In guix/ui.scm:
2118:12 3 (run-guix-command _ . _)
In guix/scripts/import.scm:
120:11 2 (guix-import . _)
In srfi/srfi-1.scm:
586:17 1 (map1 (#f))
In guix/import/utils.scm:
258:2 0 (package->definition _)

guix/import/utils.scm:258:2: In procedure package->definition:
Throw to key `match-error' with args `("match" "no matching pattern" #f)'.
# Importer: opam
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
Package not found in opam repository: kikoo-lol
Backtrace:
4 (primitive-load "/home/simon/.cache/guix/inferiors/uefwax7zflbosucfo3nxhvvwwyvldkx447xk…")
In guix/ui.scm:
2118:12 3 (run-guix-command _ . _)
In guix/scripts/import.scm:
120:11 2 (guix-import . _)
In guix/scripts/import/opam.scm:
96:16 1 (guix-import-opam . _)
In guix/import/utils.scm:
431:36 0 (recursive-import "kikoo-lol" #f #:repo->guix-package _ #:guix-name _)

guix/import/utils.scm:431:36: In procedure recursive-import:
Wrong number of values returned to continuation (expected 2)

And now the commit bea3b17739 introduces instead this backtraces for
’opam’:

Toggle snippet (21 lines)
# Importer: opam
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
Backtrace:
6 (primitive-load "/home/simon/.cache/guix/inferiors/fbnvi5znqq6m3atsgadr35wm3anm7hwiouof…")
In guix/ui.scm:
2118:12 5 (run-guix-command _ . _)
In guix/scripts/import.scm:
120:11 4 (guix-import . _)
In guix/scripts/import/opam.scm:
96:16 3 (guix-import-opam . _)
In guix/import/utils.scm:
445:31 2 (recursive-import "kikoo-lol" #:repo->guix-package _ #:guix-name _ #:version _ #:repo _)
436:33 1 (lookup-node "kikoo-lol" #f)
In guix/import/opam.scm:
264:0 0 (opam->guix-package _ #:repository _ #:version _)

guix/import/opam.scm:264:0: In procedure opam->guix-package:
Unrecognized keyword: #:repo


Last and annoying, the commit bea3b17739 introduces the regression:

Toggle snippet (45 lines)
for ci in 23e2cd156f bea3b17739 ; do guix time-machine --commit=$ci -- import hackage process -r ; done
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...

Starting download of /tmp/guix-file.WAQrHM
From https://hackage.haskell.org/package/process/process-1.6.10.0.tar.gz...
….10.0.tar.gz 72KiB 559KiB/s 00:00 [##################] 100.0%
(define-public ghc-process
(package
(name "ghc-process")
(version "1.6.10.0")
(source
(origin
(method url-fetch)
(uri (string-append
"https://hackage.haskell.org/package/process/process-"
version
".tar.gz"))
(sha256
(base32
"01c50qhrsvymbifa3lzyq6g4hmj6jl3awjp1jmbhdkmfdfaq3v16"))))
(build-system haskell-build-system)
(home-page
"http://hackage.haskell.org/package/process")
(synopsis "Process libraries")
(description
"This package contains libraries for dealing with system processes. . The typed-process package is a more recent take on a process API, which uses this package internally. It features better binary support, easier concurrency, and a more composable API. You can read more about it at <https://github.com/fpco/typed-process/#readme>.")
(license bsd-3)))

Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
Backtrace:
4 (primitive-load "/home/simon/.cache/guix/inferiors/fbnvi5znqq6m3atsgadr35wm3anm7hwiouof…")
In guix/ui.scm:
2118:12 3 (run-guix-command _ . _)
In guix/scripts/import.scm:
120:11 2 (guix-import . _)
In guix/scripts/import/hackage.scm:
132:26 1 (guix-import-hackage . _)
In guix/import/utils.scm:
416:0 0 (recursive-import _ #:repo->guix-package _ #:guix-name _ #:version _ #:repo _)

guix/import/utils.scm:416:0: In procedure recursive-import:
Invalid keyword: #f


All the best,
simon
L
L
Ludovic Courtès wrote on 7 Mar 2022 22:53
control message for bug #44115
(address . control@debbugs.gnu.org)
87mti1a0pi.fsf@gnu.org
merge 44115 54258
quit
L
L
Ludovic Courtès wrote on 7 Mar 2022 22:55
Re: bug#44115: “guix import -r “ fails with Bactktrace instead of error
(name . zimoun)(address . zimon.toutoune@gmail.com)
87ilspa0n3.fsf@gnu.org
zimoun <zimon.toutoune@gmail.com> skribis:

Toggle quote (15 lines)
> $ guix import elpa foo -r
> Backtrace:
> 4 (primitive-load "/home/simon/.config/guix/current/bin/guix")
> In guix/ui.scm:
> 2116:12 3 (run-guix-command _ . _)
> In guix/scripts/import.scm:
> 120:11 2 (guix-import . _)
> In guix/scripts/import/elpa.scm:
> 103:16 1 (guix-import-elpa . _)
> In guix/import/utils.scm:
> 431:36 0 (recursive-import "foo" gnu #:repo->guix-package _ #:guix-name _)
>
> guix/import/utils.scm:431:36: In procedure recursive-import:
> Wrong number of values returned to continuation (expected 2)

Fixed, thanks to last year’s zimoun! :-)

5278cab3dc scripts: import: gem: Fix recursive error handling.
7229b0e858 import: cran: Return multiple values for unknown packages.
1fe81b349c import: elpa: Return multiple values for unknown packages.
6bb92098b4 import: hackage: Return multiple values for unknown packages.
434925379d import: pypi: Return multiple values for unknown packages.
ebb03447f8 import: pypi: Gracefully handle missing project home page.

Ludo’.
Closed
?
Your comment

This issue is archived.

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

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