--- Begin Message ---
Subject: |
[PATCH] cache: Catch valid integer for 'last-expiry-cleanup'. |
Date: |
Fri, 27 May 2022 10:25:19 +0200 |
Fixes <http://issues.guix.gnu.org/55638>.
* guix/cache.scm (maybe-remove-expired-cache-entries)[last-expiry-date]: Check
if the date is a valid integer.
---
guix/cache.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/guix/cache.scm b/guix/cache.scm
index 51009809bd..4a74c42afe 100644
--- a/guix/cache.scm
+++ b/guix/cache.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2020, 2021 Ludovic Courtès
<ludo@gnu.org>
+;;; Copyright © 2022 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -93,7 +94,9 @@ (define expiry-file
(define last-expiry-date
(catch 'system-error
(lambda ()
- (call-with-input-file expiry-file read))
+ (match (call-with-input-file expiry-file read)
+ ((? integer? date) date)
+ (_ 0)))
(const 0)))
(when (obsolete? last-expiry-date now cleanup-period)
base-commit: 38bf6c7d0cb588e8d4546db7d2e0bae2ec25183d
--
2.36.0
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#55673: [PATCH] cache: Catch valid integer for 'last-expiry-cleanup'. |
Date: |
Sat, 04 Jun 2022 12:11:42 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) |
Hi,
zimoun <zimon.toutoune@gmail.com> skribis:
> Fixes <http://issues.guix.gnu.org/55638>.
>
> * guix/cache.scm (maybe-remove-expired-cache-entries)[last-expiry-date]: Check
> if the value is a valid integer.
> * tests/cache.scm: Test it.
I simplified it a bit and pushed as
104b4e25ab7da5697f2f6f1ddfdd4955f05afece, thanks!
Ludo’.
--- End Message ---