summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-05-12 23:38:13 +0200
committerLudovic Courtès <ludo@gnu.org>2021-05-13 00:19:58 +0200
commit3cde5231aa78aa5e31b27888cd78ee0b250a7a1c (patch)
treeddddd00822c4e038281a26b2b365ad6a9df52e5e
parent0aef94e7bcbd272720f14c5343f74da5201ef90a (diff)
downloadguix-3cde5231aa78aa5e31b27888cd78ee0b250a7a1c.tar.gz
challenge: Be defensive in the size passed to the progress reporter.
Possibly fixes <https://bugs.gnu.org/48045>.
Reported by Bone Baboon <bone.baboon@disroot.org>.

* guix/scripts/challenge.scm (call-with-nar): Rename second value
returned by 'http-fetch' to match reality.  Change second argument to
'progress-reporter/file'.
-rw-r--r--guix/scripts/challenge.scm7
1 files changed, 4 insertions, 3 deletions
diff --git a/guix/scripts/challenge.scm b/guix/scripts/challenge.scm
index 4ec3be99ca..07477f816e 100644
--- a/guix/scripts/challenge.scm
+++ b/guix/scripts/challenge.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2016, 2017, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -253,10 +253,11 @@ taken since we do not import the archives."
 NARINFO."
   (let*-values (((uri compression size)
                  (narinfo-best-uri narinfo))
-                ((port response)
+                ((port actual-size)
                  (http-fetch uri)))
     (define reporter
-      (progress-reporter/file (narinfo-path narinfo) size
+      (progress-reporter/file (narinfo-path narinfo)
+                              (max size (or actual-size 0)) ;defensive
                               #:abbreviation (const (uri-host uri))))
 
     (define result