[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
232/244: status: Guard against a numerical overflow condition.
From: |
guix-commits |
Subject: |
232/244: status: Guard against a numerical overflow condition. |
Date: |
Wed, 12 Apr 2023 08:49:37 -0400 (EDT) |
apteryx pushed a commit to branch staging
in repository guix.
commit 7747da6aed4220e129f173b9f146c15b9e8a1c56
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Mon Apr 10 22:08:09 2023 -0400
status: Guard against a numerical overflow condition.
Fixes <https://issues.guix.gnu.org/62766>.
* guix/status.scm (update-build): Use 0 as progress when an exception occurs
while computing it.
---
guix/status.scm | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/guix/status.scm b/guix/status.scm
index d4d3fca026..fd89ba9dd3 100644
--- a/guix/status.scm
+++ b/guix/status.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017-2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -190,9 +191,17 @@ a completion indication."
((regexp-exec %fraction-line-rx line)
=>
(lambda (match)
- (let ((done (string->number (match:substring match 1)))
- (total (string->number (match:substring match 3))))
- (update (* 100. (/ done total))))))
+ (let* ((done (string->number (match:substring match 1)))
+ (total (string->number (match:substring match 3)))
+ ;; It's possible that both done and total are 0 (see:
+ ;; https://issues.guix.gnu.org/62766). Special case this
+ ;; pathological case as a null progress (0).
+ (progress (catch 'numerical-overflow
+ (lambda ()
+ (/ done total))
+ (lambda _
+ 0))))
+ (update (* 100. progress)))))
((regexp-exec %phase-start-rx line)
=>
(lambda (match)
- 133/244: home: xdg-base-directories: Set correct value for XDG_STATE_HOME., (continued)
- 133/244: home: xdg-base-directories: Set correct value for XDG_STATE_HOME., guix-commits, 2023/04/12
- 130/244: news: Add entry for 'guix shell --container --nesting'., guix-commits, 2023/04/12
- 132/244: gnu: linux-libre 6.1: Update to 6.1.23., guix-commits, 2023/04/12
- 148/244: services: desktop: Remove 'gnome-desktop-service' procedure., guix-commits, 2023/04/12
- 146/244: services: base: Remove 'console-font-service' procedure., guix-commits, 2023/04/12
- 144/244: services: sddm: Remove 'sddm-service' procedure., guix-commits, 2023/04/12
- 149/244: services: desktop: Remove 'mate-desktop-service' procedure., guix-commits, 2023/04/12
- 147/244: services: guix-publish: Remove 'compression-level' field., guix-commits, 2023/04/12
- 152/244: gnu: Add libpanel., guix-commits, 2023/04/12
- 212/244: gnu: open-adventure: Update to 1.15., guix-commits, 2023/04/12
- 232/244: status: Guard against a numerical overflow condition.,
guix-commits <=
- 161/244: gnu: Add llama-cpp., guix-commits, 2023/04/12
- 197/244: gnu: xfce4-clipman-plugin: Update to 1.6.3., guix-commits, 2023/04/12
- 171/244: gnu: ruby-pg: Update to 1.4.6., guix-commits, 2023/04/12
- 162/244: gnu: Add emacs-gptel., guix-commits, 2023/04/12
- 219/244: gnu: s6-dns: Update to 2.3.5.5., guix-commits, 2023/04/12
- 214/244: gnu: Add libxisf., guix-commits, 2023/04/12
- 206/244: gnu: emacs-treemacs-extra: Improve package style., guix-commits, 2023/04/12
- 222/244: gnu: s6-portable-utils: Update to 2.3.0.2., guix-commits, 2023/04/12
- 169/244: gnu: darktable: Update to 4.2.1., guix-commits, 2023/04/12
- 200/244: gnu: thunar-archive-plugin: Update to 0.5.1., guix-commits, 2023/04/12