aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-06-19 10:17:37 +0200
committerLudovic Courtès <ludo@gnu.org>2015-06-19 10:23:29 +0200
commit69792b285c98dc031d0464a08f84827e3f49c7f2 (patch)
tree1927bdb8894495b042f5d8fa9bc5e6f3e840fe9f
parent020f3e41568d4f76544e3e1c10e1d8dd4effc424 (diff)
downloadguix-69792b285c98dc031d0464a08f84827e3f49c7f2.tar
guix-69792b285c98dc031d0464a08f84827e3f49c7f2.tar.gz
store: Memoize 'add-to-store' based on the result of 'lstat', not 'stat'.
* guix/store.scm (add-to-store): Change 'stat' call to 'lstat'. Clarify docstring.
-rw-r--r--guix/store.scm11
1 files changed, 6 insertions, 5 deletions
diff --git a/guix/store.scm b/guix/store.scm
index 933708defc..7b13334952 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -610,11 +610,12 @@ path."
store-path)))
(lambda (server basename recursive? hash-algo file-name)
"Add the contents of FILE-NAME under BASENAME to the store. When
-RECURSIVE? is true and FILE-NAME designates a directory, the contents of
-FILE-NAME are added recursively; if FILE-NAME designates a flat file and
-RECURSIVE? is true, its contents are added, and its permission bits are
-kept. HASH-ALGO must be a string such as \"sha256\"."
- (let* ((st (stat file-name #f))
+RECURSIVE? is false, FILE-NAME must designate a regular file--not a directory
+nor a symlink. When RECURSIVE? is true and FILE-NAME designates a directory,
+the contents of FILE-NAME are added recursively; if FILE-NAME designates a
+flat file and RECURSIVE? is true, its contents are added, and its permission
+bits are kept. HASH-ALGO must be a string such as \"sha256\"."
+ (let* ((st (false-if-exception (lstat file-name)))
(args `(,st ,basename ,recursive? ,hash-algo))
(cache (nix-server-add-to-store-cache server)))
(or (and st (hash-ref cache args))