locate: Ignore unreadable manifests.

Fixes <https://issues.guix.gnu.org/64187>.

* guix/scripts/locate.scm (profiles->manifest-entries): Wrap
'profile-manifest' in 'false-if-exception'.

Reported-by: Ricardo Wurmus <rekado@elephly.net>
This commit is contained in:
Ludovic Courtès 2023-07-08 22:16:40 +02:00
parent 67e22584fa
commit e1c2c2f042
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5

View File

@ -418,19 +418,24 @@ for each package to insert."
(()
entries)
((profile . rest)
(let* ((manifest (profile-manifest profile))
(entries visited
(fold2 (lambda (entry lst visited)
(let ((item (manifest-entry-item entry)))
(if (set-contains? visited item)
(values lst visited)
(values (cons entry lst)
(set-insert item
visited)))))
entries
visited
(manifest-transitive-entries manifest))))
(loop visited rest entries))))))
(match (false-if-exception (profile-manifest profile))
(#f
;; PROFILE's manifest is unreadable for some reason such as an
;; unsupported version.
(loop visited rest entries))
(manifest
(let ((entries visited
(fold2 (lambda (entry lst visited)
(let ((item (manifest-entry-item entry)))
(if (set-contains? visited item)
(values lst visited)
(values (cons entry lst)
(set-insert item
visited)))))
entries
visited
(manifest-transitive-entries manifest))))
(loop visited rest entries))))))))
(define (insert-manifest-entry db entry)
"Insert a manifest ENTRY into DB."