guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/08: store: 'store-path-hash-part' really returns false for invalid fi


From: guix-commits
Subject: 01/08: store: 'store-path-hash-part' really returns false for invalid file names.
Date: Thu, 4 Feb 2021 03:44:13 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 814ee99da89a0bcc6cf53d61763d345ed95e067c
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Feb 3 14:43:29 2021 +0100

    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.
---
 guix/store.scm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/guix/store.scm b/guix/store.scm
index e0b15ab..81bb9eb 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]