[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#77680] [PATCH 3/4] substitutes: Ignore corrupt cached narinfos.
From: |
Christopher Baines |
Subject: |
[bug#77680] [PATCH 3/4] substitutes: Ignore corrupt cached narinfos. |
Date: |
Thu, 10 Apr 2025 11:31:27 +0100 |
User-agent: |
mu4e 1.12.9; emacs 29.4 |
Ludovic Courtès <ludo@gnu.org> writes:
> * guix/substitutes.scm (cached-narinfo): Wrap ‘read’ call in
> ‘false-if-exception’. Add catch-all ‘match’ clause.
>
> Change-Id: I2d776f64b6521f778b4ab3f956b35cdef2ddb383
> ---
> guix/substitutes.scm | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/guix/substitutes.scm b/guix/substitutes.scm
> index 86b9f5472a..45c165e03e 100644
> --- a/guix/substitutes.scm
> +++ b/guix/substitutes.scm
> @@ -300,7 +300,7 @@ (define (cached-narinfo cache-url path)
> (lambda ()
> (call-with-input-file cache-file
> (lambda (p)
> - (match (read p)
> + (match (false-if-exception (read p))
> (('narinfo ('version 2)
> ('cache-uri cache-uri)
> ('date date) ('ttl ttl) ('value #f))
> @@ -315,7 +315,8 @@ (define (cached-narinfo cache-url path)
> (if (obsolete? date now ttl)
> (values #f #f)
> (values #t (string->narinfo value cache-uri))))
> - (('narinfo ('version v) _ ...)
> + (_
> + ;; Corrupt or incompatible cached entry.
> (values #f #f))))))
> (lambda _
> (values #f #f))))
I believe the particular failure case we're introducing here is that the
cache file is empty, so maybe we could match that specific case here and
handle it silently.
I'm a bit wary of handling any and all cache issues silently since that
could make it harder to spot that the caching is entirely broken.
signature.asc
Description: PGP signature
- [bug#77680] [PATCH 0/4] Avoid 'fdatasync' calls for cache files, Ludovic Courtès, 2025/04/09
- [bug#77680] [PATCH 2/4] utils: Add #:sync? parameter to ‘with-atomic-file-output’., Ludovic Courtès, 2025/04/09
- [bug#77680] [PATCH 1/4] cache: Remove unused import., Ludovic Courtès, 2025/04/09
- [bug#77680] [PATCH 3/4] substitutes: Ignore corrupt cached narinfos., Ludovic Courtès, 2025/04/09
- [bug#77680] [PATCH 3/4] substitutes: Ignore corrupt cached narinfos.,
Christopher Baines <=
- [bug#77680] [PATCH 4/4] guix: Avoid ‘fdatasync’ call for caches and regular files., Ludovic Courtès, 2025/04/09
- [bug#77680] [PATCH v2 0/4] Avoid 'fdatasync' calls for cache files, Ludovic Courtès, 2025/04/11
- [bug#77680] [PATCH v2 2/4] utils: Add #:sync? parameter to ‘with-atomic-file-output’., Ludovic Courtès, 2025/04/11
- [bug#77680] [PATCH v2 3/4] substitutes: Ignore corrupt cached narinfos., Ludovic Courtès, 2025/04/11
- [bug#77680] [PATCH v2 1/4] cache: Remove unused import., Ludovic Courtès, 2025/04/11
- [bug#77680] [PATCH v2 4/4] guix: Avoid ‘fdatasync’ call for caches and regular files., Ludovic Courtès, 2025/04/11
- bug#77680: [PATCH v2 0/4] Avoid 'fdatasync' calls for cache files, Ludovic Courtès, 2025/04/14