mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
cache: Catch invalid 'last-expiry-cleanup'.
Fixes <http://issues.guix.gnu.org/55638>. * guix/cache.scm (maybe-remove-expired-cache-entries)[last-expiry-date]: Use 'get-string-all' + 'string->number' instead of 'read'; ignore invalid numbers. * tests/cache.scm ("maybe-remove-expired-cache-entries, empty cache") ("maybe-remove-expired-cache-entries, corrupted cache"): New tests. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2017, 2020 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2022 Simon Tournier <zimon.toutoune@gmail.com>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
@@ -74,6 +75,20 @@
|
||||
(lambda (port)
|
||||
(display 0 port)))))
|
||||
|
||||
(test-equal "maybe-remove-expired-cache-entries, empty cache"
|
||||
'("a" "b" "c")
|
||||
(test-cache-cleanup cache
|
||||
(call-with-output-file (string-append cache "/last-expiry-cleanup")
|
||||
(lambda (port)
|
||||
(display "" port)))))
|
||||
|
||||
(test-equal "maybe-remove-expired-cache-entries, corrupted cache"
|
||||
'("a" "b" "c")
|
||||
(test-cache-cleanup cache
|
||||
(call-with-output-file (string-append cache "/last-expiry-cleanup")
|
||||
(lambda (port)
|
||||
(display "1\"34657890" port)))))
|
||||
|
||||
(test-end "cache")
|
||||
|
||||
;;; Local Variables:
|
||||
|
||||
Reference in New Issue
Block a user