From 75726135ce017f37ae57181e011ceea95c56dd3a Mon Sep 17 00:00:00 2001
From: Ludovic Courtès <ludo@gnu.org>
Date: Thu, 24 Sep 2015 21:54:37 +0200
Subject: download: Don't abbreviate things that are not store items.

Fixes a regression introduced in a8be7b9a.

* guix/build/download.scm (store-path-abbreviation): Return STORE-PATH
  if it's not an actual store path.  Fixes an out-of-range exception
  when running tests/substitute.scm and tests/store.scm.
---
 guix/build/download.scm | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/guix/build/download.scm b/guix/build/download.scm
index be4a5810af..4b7c53d2c6 100644
--- a/guix/build/download.scm
+++ b/guix/build/download.scm
@@ -111,12 +111,15 @@ column."
     (string-append left padding right)))
 
 (define* (store-path-abbreviation store-path #:optional (prefix-length 6))
-  "Return an abbreviation of STORE-PATH for display, showing PREFIX-LENGTH
-characters of the hash."
-  (let ((base (basename store-path)))
-    (string-append (string-take base prefix-length)
-                   "…"
-                   (string-drop base 32))))
+  "If STORE-PATH is the file name of a store entry, return an abbreviation of
+STORE-PATH for display, showing PREFIX-LENGTH characters of the hash.
+Otherwise return STORE-PATH."
+  (if (string-prefix? (%store-directory) store-path)
+      (let ((base (basename store-path)))
+        (string-append (string-take base prefix-length)
+                       "…"
+                       (string-drop base 32)))
+      store-path))
 
 (define* (progress-proc file size
                         #:optional (log-port (current-output-port))
-- 
cgit v1.2.3