summaryrefslogtreecommitdiff
path: root/guix/scripts/substitute.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-05-23 14:55:44 +0200
committerLudovic Courtès <ludo@gnu.org>2016-05-23 15:02:26 +0200
commitbc73a84398fa54b0a11a80c749bf78eb0a58dbe6 (patch)
tree3e7b6670989ceb4f31464bad632c0332121d96a0 /guix/scripts/substitute.scm
parent12b6f6527e49c8c4191929a72b1692dbd9eb2440 (diff)
parent624d4e2e6ba402c374a340869306eec65a808a20 (diff)
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/scripts/substitute.scm')
-rwxr-xr-xguix/scripts/substitute.scm12
1 files changed, 9 insertions, 3 deletions
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index d46d610347..5cdc55f2b2 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -440,9 +440,15 @@ the cache STR originates form."
(define (narinfo-cache-file cache-url path)
"Return the name of the local file that contains an entry for PATH. The
entry is stored in a sub-directory specific to CACHE-URL."
- (string-append %narinfo-cache-directory "/"
- (bytevector->base32-string (sha256 (string->utf8 cache-url)))
- "/" (store-path-hash-part path)))
+ ;; The daemon does not sanitize its input, so PATH could be something like
+ ;; "/gnu/store/foo". Gracefully handle that.
+ (match (store-path-hash-part path)
+ (#f
+ (leave (_ "'~a' does not name a store item~%") path))
+ ((? string? hash-part)
+ (string-append %narinfo-cache-directory "/"
+ (bytevector->base32-string (sha256 (string->utf8 cache-url)))
+ "/" hash-part))))
(define (cached-narinfo cache-url path)
"Check locally if we have valid info about PATH coming from CACHE-URL.