store: 'store-path-hash-part' really returns false for invalid file names.

The "store-path-hash-part #f", due to a SRFI-64 bug, was marked as
successful even though 'store-path-hash-part' was throwing an exception.

* guix/store.scm (store-path-hash-part): Really return #f.
This commit is contained in:
Ludovic Courtès 2021-02-03 14:43:29 +01:00
parent 8e7e414aa9
commit 814ee99da8
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 6 additions and 4 deletions

View File

@ -2173,10 +2173,12 @@ valid inputs."
(define (store-path-hash-part path)
"Return the hash part of PATH as a base32 string, or #f if PATH is not a
syntactically valid store path."
(let* ((base (store-path-base path))
(hash (string-take base 32)))
(and (string-every %nix-base32-charset hash)
hash)))
(match (store-path-base path)
(#f #f)
(base
(let ((hash (string-take base 32)))
(and (string-every %nix-base32-charset hash)
hash)))))
(define (derivation-log-file drv)
"Return the build log file for DRV, a derivation file name, or #f if it