summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-02-03 14:43:29 +0100
committerLudovic Courtès <ludo@gnu.org>2021-02-04 09:23:38 +0100
commit814ee99da89a0bcc6cf53d61763d345ed95e067c (patch)
treef7f9d406b1fe90c758f4429c3d92078b9c88c464
parent8e7e414aa998fe8c0de8a491c91aab8b8d9c58f4 (diff)
downloadguix-814ee99da89a0bcc6cf53d61763d345ed95e067c.tar.gz
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.
-rw-r--r--guix/store.scm10
1 files changed, 6 insertions, 4 deletions
diff --git a/guix/store.scm b/guix/store.scm
index e0b15abce3..81bb9eb847 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -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