summaryrefslogtreecommitdiff
path: root/guix/gexp.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-06-19 10:18:44 +0200
committerLudovic Courtès <ludo@gnu.org>2015-06-19 10:23:29 +0200
commit7833db1f30d78aea3b7cb042723c2bd7d00e64ad (patch)
tree6df17f0cbb8e8ffe693e92777ff78ae891a35014 /guix/gexp.scm
parent69792b285c98dc031d0464a08f84827e3f49c7f2 (diff)
downloadgnu-guix-7833db1f30d78aea3b7cb042723c2bd7d00e64ad.tar
gnu-guix-7833db1f30d78aea3b7cb042723c2bd7d00e64ad.tar.gz
gexp: 'local-file' canonicalizes its file argument.
Reported by Alex Kost <alezost@gmail.com> at <http://lists.gnu.org/archive/html/guix-devel/2015-06/msg00235.html>. * guix/gexp.scm (local-file): Add call to 'canonicalize-path'. * tests/gexp.scm ("one local file, symlink"): New test.
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r--guix/gexp.scm6
1 files changed, 5 insertions, 1 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm
index b3c4166d1a..0b5c43e2b8 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -167,7 +167,11 @@ designates a flat file and RECURSIVE? is true, its contents are added, and its
permission bits are kept.
This is the declarative counterpart of the 'interned-file' monadic procedure."
- (%local-file file name recursive?))
+ ;; Canonicalize FILE so that if it's a symlink, it is resolved. Failing to
+ ;; do that, when RECURSIVE? is #t, we could end up creating a dangling
+ ;; symlink in the store, and when RECURSIVE? is #f 'add-to-store' would just
+ ;; throw an error, both of which are inconvenient.
+ (%local-file (canonicalize-path file) name recursive?))
(define-gexp-compiler (local-file-compiler (file local-file?) system target)
;; "Compile" FILE by adding it to the store.