GNU bug report logs - #42504
guix refresh --update fails for Rust packages

Previous Next

Package: guix;

Reported by: Alexandru-Sergiu Marton <brown121407 <at> posteo.ro>

Date: Fri, 24 Jul 2020 07:17:02 UTC

Severity: normal

Done: Danny Milosavljevic <dannym <at> scratchpost.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 42504 in the body.
You can then email your comments to 42504 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#42504; Package guix. (Fri, 24 Jul 2020 07:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alexandru-Sergiu Marton <brown121407 <at> posteo.ro>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Fri, 24 Jul 2020 07:17:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alexandru-Sergiu Marton <brown121407 <at> posteo.ro>
To: bug-guix <at> gnu.org
Subject: guix refresh --update fails for Rust packages
Date: Fri, 24 Jul 2020 10:16:17 +0300
Hi,

I tried to use the automatic updater for a Rust package but it had an
ugly fail. Here's the backtrace:

--8<---------------cut here---------------start------------->8---
[brown <at> 121408 guix][env]$ ./pre-inst-env guix refresh --update rust-instant
Backtrace:
In ice-9/boot-9.scm:
  1736:10 16 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In unknown file:
          15 (apply-smob/0 #<thunk 7f462a316580>)
In ice-9/boot-9.scm:
    718:2 14 (call-with-prompt _ _ #<procedure default-prompt-handler (k proc)>)
In ice-9/eval.scm:
    619:8 13 (_ #(#(#<directory (guile-user) 7f4629f52f00>)))
In guix/ui.scm:
  1974: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 7f461e6afbd0 at ice-9/boot-9.scm:1815:7 (exn)> _ #:unwind? _ #:unwind-for-type _)
  1736:10  9 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In guix/store.scm:
   631:22  8 (thunk)
  2025:24  7 (run-with-store #<store-connection 256.99 7f461e6b7eb0> #<procedure 7f461c337f00 at guix/scripts/refresh.scm:535:10 (state)> #:guile-for-build _ #:system _ #:target _)
In guix/scripts/refresh.scm:
   552:16  6 (_ _)
In srfi/srfi-1.scm:
    634:9  5 (for-each #<procedure 7f462019e0f0 at guix/scripts/refresh.scm:553:17 (t-916fdc98f4be2f1-1c8c)> (#<package rust-instant <at> 0.1.2 /home/brown/src/guix/gnu/packages/crates-io.scm:11321 7f4620de5d20>))
In guix/scripts/refresh.scm:
   318:20  4 (update-package #<store-connection 256.99 7f461e6b7eb0> #<package rust-instant <at> 0.1.2 /home/brown/src/guix/gnu/packages/crates-io.scm:11321 7f4620de5d20> _ #:key-download _ #:warn? _)
In guix/upstream.scm:
   376:34  3 (package-update/url-fetch #<store-connection 256.99 7f461e6b7eb0> _ #<<upstream-source> package: "rust-instant" version: "0.1.6" urls: ("https://crates.io/api/v1/crates/instant/0.1.6/download…> …)
In unknown file:
           2 (string-contains #f "z" #<undefined> #<undefined> #<undefined> #<undefined>)
In ice-9/boot-9.scm:
  1669:16  1 (raise-exception _ #:continuable? _)
  1669:16  0 (raise-exception _ #:continuable? _)

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

It's not only this package. Trying to update rust-serde gives a very
similar backtrace:

--8<---------------cut here---------------start------------->8---
Backtrace:
In ice-9/boot-9.scm:
  1736:10 16 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In unknown file:
          15 (apply-smob/0 #<thunk 7f4a4a9a6580>)
In ice-9/boot-9.scm:
    718:2 14 (call-with-prompt _ _ #<procedure default-prompt-handler (k proc)>)
In ice-9/eval.scm:
    619:8 13 (_ #(#(#<directory (guile-user) 7f4a4a5e2f00>)))
In guix/ui.scm:
  1974: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 7f4a3efbd390 at ice-9/boot-9.scm:1815:7 (exn)> _ #:unwind? _ #:unwind-for-type _)
  1736:10  9 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In guix/store.scm:
   631:22  8 (thunk)
  2025:24  7 (run-with-store #<store-connection 256.99 7f4a40a59000> #<procedure 7f4a3c9d6d20 at guix/scripts/refresh.scm:535:10 (state)> #:guile-for-build _ #:system _ #:target _)
In guix/scripts/refresh.scm:
   552:16  6 (_ _)
In srfi/srfi-1.scm:
    634:9  5 (for-each #<procedure 7f4a40aa13c0 at guix/scripts/refresh.scm:553:17 (t-916fdc98f4be2f1-1c8c)> (#<package rust-serde <at> 1.0.105 /home/brown/src/guix/gnu/packages/crates-io.scm:22635 7f4a414d06e0>))
In guix/scripts/refresh.scm:
   318:20  4 (update-package #<store-connection 256.99 7f4a40a59000> #<package rust-serde <at> 1.0.105 /home/brown/src/guix/gnu/packages/crates-io.scm:22635 7f4a414d06e0> _ #:key-download _ #:warn? _)
In guix/upstream.scm:
   376:34  3 (package-update/url-fetch #<store-connection 256.99 7f4a40a59000> _ #<<upstream-source> package: "rust-serde" version: "1.0.114" urls: ("https://crates.io/api/v1/crates/serde/1.0.114/download…> …)
In unknown file:
           2 (string-contains #f "z" #<undefined> #<undefined> #<undefined> #<undefined>)
In ice-9/boot-9.scm:
  1669:16  1 (raise-exception _ #:continuable? _)
  1669:16  0 (raise-exception _ #:continuable? _)
--8<---------------cut here---------------end--------------->8---

It seems that I can update non-rust stuff though. `guix refresh --update
i3-gaps` works fine.

Cheers,
Sergiu




Information forwarded to bug-guix <at> gnu.org:
bug#42504; Package guix. (Fri, 24 Jul 2020 09:24:01 GMT) Full text and rfc822 format available.

Message #8 received at 42504 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Alexandru-Sergiu Marton <brown121407 <at> posteo.ro>
Cc: 42504 <at> debbugs.gnu.org
Subject: Re: bug#42504: guix refresh --update fails for Rust packages
Date: Fri, 24 Jul 2020 11:23:30 +0200
[Message part 1 (text/plain, inline)]
'"z"' appears in guix/upstream.scm, 

(define* (package-update/url-fetch store package source
                                   #:key key-download)
  "Return the version, tarball, and SOURCE, to update PACKAGE to
SOURCE, an <upstream-source>."
  (match source
    (($ <upstream-source> _ version urls signature-urls)
     (let*-values (((archive-type)
                    (match (and=> (package-source package) origin-uri)
                      ((? string? uri)
                       (let ((type (file-extension (basename uri))))
                         ;; Sometimes we have URLs such as
                         ;; "https://github.com/…/tarball/v0.1", in which case
                         ;; we must not consider "1" as the extension.
                         (and (or (string-contains type "z")
                                  (string=? type "tar"))
                              type)))
                      (_
                       "gz")))
                   ((url signature-url)
                    ;; Try to find a URL that matches ARCHIVE-TYPE.
                    (find2 (lambda (url sig-url)
                             ;; Some URIs lack a file extension, like
                             ;; 'https://crates.io/???/0.1/download'.  In that
                             ;; case, pick the first URL.
                             (or (not archive-type)
                                 (string-suffix? archive-type url)))
                           urls
                           (or signature-urls (circular-list #f)))))
       ;; If none of URLS matches ARCHIVE-TYPE, then URL is #f; in that case,
       ;; pick up the first element of URLS.
       (let ((tarball (download-tarball store
                                        (or url (first urls))
                                        (and (pair? signature-urls)
                                             (or signature-url
                                                 (first signature-urls)))
                                        #:key-download key-download)))
         (values version tarball source))))))

And guix repl says:

scheme@(guix-user)> ,use (guix utils)
scheme@(guix-user)> (file-extension "https://crates.io/api/v1/crates/instant/0.1.2/download")
$1 = #f

But the case #f is not handled in the code above--which is why it doesn't work.

Could you test the following fix?

diff --git a/guix/upstream.scm b/guix/upstream.scm
index 70cbfb45e8..31bd6faea4 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -369,7 +369,7 @@ SOURCE, an <upstream-source>."
      (let*-values (((archive-type)
                     (match (and=> (package-source package) origin-uri)
                       ((? string? uri)
-                       (let ((type (file-extension (basename uri))))
+                       (let ((type (or (file-extension (basename uri)) "")))
                          ;; Sometimes we have URLs such as
                          ;; "https://github.com/…/tarball/v0.1", in which case
                          ;; we must not consider "1" as the extension.
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#42504; Package guix. (Fri, 24 Jul 2020 11:09:02 GMT) Full text and rfc822 format available.

Message #11 received at 42504 <at> debbugs.gnu.org (full text, mbox):

From: Alexandru-Sergiu Marton <brown121407 <at> posteo.ro>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 42504 <at> debbugs.gnu.org
Subject: Re: bug#42504: guix refresh --update fails for Rust packages
Date: Fri, 24 Jul 2020 14:08:45 +0300
Danny Milosavljevic <dannym <at> scratchpost.org> writes:
> And guix repl says:
>
> scheme@(guix-user)> ,use (guix utils)
> scheme@(guix-user)> (file-extension "https://crates.io/api/v1/crates/instant/0.1.2/download")
> $1 = #f
>
> But the case #f is not handled in the code above--which is why it doesn't work.
>
> Could you test the following fix?
>
> diff --git a/guix/upstream.scm b/guix/upstream.scm
> index 70cbfb45e8..31bd6faea4 100644
> --- a/guix/upstream.scm
> +++ b/guix/upstream.scm
> @@ -369,7 +369,7 @@ SOURCE, an <upstream-source>."
>       (let*-values (((archive-type)
>                      (match (and=> (package-source package) origin-uri)
>                        ((? string? uri)
> -                       (let ((type (file-extension (basename uri))))
> +                       (let ((type (or (file-extension (basename uri)) "")))
>                           ;; Sometimes we have URLs such as
>                           ;; "https://github.com/…/tarball/v0.1", in which case
>                           ;; we must not consider "1" as the extension.

This fixes the issue, thanks!

--
Sergiu




Reply sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
You have taken responsibility. (Mon, 27 Jul 2020 11:37:02 GMT) Full text and rfc822 format available.

Notification sent to Alexandru-Sergiu Marton <brown121407 <at> posteo.ro>:
bug acknowledged by developer. (Mon, 27 Jul 2020 11:37:02 GMT) Full text and rfc822 format available.

Message #16 received at 42504-done <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Alexandru-Sergiu Marton <brown121407 <at> posteo.ro>
Cc: 42504-done <at> debbugs.gnu.org
Subject: Re: bug#42504: guix refresh --update fails for Rust packages
Date: Mon, 27 Jul 2020 13:36:30 +0200
[Message part 1 (text/plain, inline)]
Hi,

thanks for testing!

Pushed to guix master as commit bc76f8b1f9a74c0f187022991b633cc1820944c7.
[Message part 2 (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 25 Aug 2020 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 216 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.