unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44115: “guix import -r“ fails with Bactktrace instead of error
@ 2020-10-21 13:19 zimoun
  2020-10-29 22:12 ` Lulu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zimoun @ 2020-10-21 13:19 UTC (permalink / raw)
  To: 44115

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





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

* bug#44115: “guix import -r“ fails with Bactktrace instead of error
  2020-10-21 13:19 bug#44115: “guix import -r“ fails with Bactktrace instead of error zimoun
@ 2020-10-29 22:12 ` Lulu
  2020-10-29 22:39 ` bug#44115: [PATCH] import: Make failed recursive imports yield an error instead of backtrace Lulu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Lulu @ 2020-10-29 22:12 UTC (permalink / raw)
  To: 44115@debbugs.gnu.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




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

* bug#44115: [PATCH] import: Make failed recursive imports yield an error instead of backtrace.
  2020-10-21 13:19 bug#44115: “guix import -r“ fails with Bactktrace instead of error zimoun
  2020-10-29 22:12 ` Lulu
@ 2020-10-29 22:39 ` Lulu
  2021-01-18 20:25 ` bug#44115: “guix import -r“ fails with Bactktrace instead of error zimoun
  2022-03-07 21:55 ` Ludovic Courtès
  3 siblings, 0 replies; 5+ messages in thread
From: Lulu @ 2020-10-29 22:39 UTC (permalink / raw)
  To: guix-patches@gnu.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(-)

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




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

* bug#44115: “guix import -r“ fails with Bactktrace instead of error
  2020-10-21 13:19 bug#44115: “guix import -r“ fails with Bactktrace instead of error zimoun
  2020-10-29 22:12 ` Lulu
  2020-10-29 22:39 ` bug#44115: [PATCH] import: Make failed recursive imports yield an error instead of backtrace Lulu
@ 2021-01-18 20:25 ` zimoun
  2022-03-07 21:55 ` Ludovic Courtès
  3 siblings, 0 replies; 5+ messages in thread
From: zimoun @ 2021-01-18 20:25 UTC (permalink / raw)
  To: 44115

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:

--8<---------------cut here---------------start------------->8---
# 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")'.
--8<---------------cut here---------------end--------------->8---

and

--8<---------------cut here---------------start------------->8---
# 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"
--8<---------------cut here---------------end--------------->8---


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

--8<---------------cut here---------------start------------->8---
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)
--8<---------------cut here---------------end--------------->8---

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

--8<---------------cut here---------------start------------->8---
# 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
--8<---------------cut here---------------end--------------->8---


Last and annoying, the commit bea3b17739 introduces the regression:

--8<---------------cut here---------------start------------->8---
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
--8<---------------cut here---------------end--------------->8---


All the best,
simon




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

* bug#44115: “guix import -r“ fails with Bactktrace instead of error
  2020-10-21 13:19 bug#44115: “guix import -r“ fails with Bactktrace instead of error zimoun
                   ` (2 preceding siblings ...)
  2021-01-18 20:25 ` bug#44115: “guix import -r“ fails with Bactktrace instead of error zimoun
@ 2022-03-07 21:55 ` Ludovic Courtès
  3 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2022-03-07 21:55 UTC (permalink / raw)
  To: zimoun; +Cc: 44115-done, 54258-done

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

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




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

end of thread, other threads:[~2022-03-07 21:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21 13:19 bug#44115: “guix import -r“ fails with Bactktrace instead of error zimoun
2020-10-29 22:12 ` Lulu
2020-10-29 22:39 ` bug#44115: [PATCH] import: Make failed recursive imports yield an error instead of backtrace Lulu
2021-01-18 20:25 ` bug#44115: “guix import -r“ fails with Bactktrace instead of error zimoun
2022-03-07 21:55 ` 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).