From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMsBR-0004Do-V3 for guix-patches@gnu.org; Wed, 14 Nov 2018 05:14:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMsBO-0000LM-Pw for guix-patches@gnu.org; Wed, 14 Nov 2018 05:14:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:46717) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gMsBO-0000KC-Ms for guix-patches@gnu.org; Wed, 14 Nov 2018 05:14:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gMsBO-0003Sg-Gz for guix-patches@gnu.org; Wed, 14 Nov 2018 05:14:02 -0500 Subject: [bug#33376] [PATCH 1/2] progress: Fix crash because of division by zero. References: <87o9asezpw.fsf@lassieur.org> In-Reply-To: <87o9asezpw.fsf@lassieur.org> Resent-Message-ID: From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Date: Wed, 14 Nov 2018 11:13:11 +0100 Message-Id: <20181114101312.23617-1-clement@lassieur.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 33376@debbugs.gnu.org * guix/progress.scm (display-download-progress): Handle the case where SIZE is null. --- guix/progress.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guix/progress.scm b/guix/progress.scm index 9da667a02..7a25f11bd 100644 --- a/guix/progress.scm +++ b/guix/progress.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2017 Sou Bunnbu ;;; Copyright © 2015 Steve Sprang ;;; Copyright © 2017, 2018 Ludovic Courtès +;;; Copyright © 2018 Clément Lassieur ;;; ;;; This file is part of GNU Guix. ;;; @@ -197,7 +198,7 @@ throughput." (define elapsed (duration->seconds (time-difference (current-time time-monotonic) start-time))) - (if (number? size) + (if (and (number? size) (not (zero? size))) (let* ((% (* 100.0 (/ transferred size))) (throughput (/ transferred elapsed)) (left (format #f " ~a ~a" file -- 2.19.1