summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-05-18 09:47:29 +0200
committerLudovic Courtès <ludo@gnu.org>2015-05-18 09:47:29 +0200
commit113c17a0c969e600023698ae3a34994a796d0046 (patch)
tree6a1102219aa229f3b4ac08d59806b21aa8acbb23 /guix
parent01dbc7e01a576bf388914dfe99fa473e87728462 (diff)
downloadgnu-guix-113c17a0c969e600023698ae3a34994a796d0046.tar
gnu-guix-113c17a0c969e600023698ae3a34994a796d0046.tar.gz
profiles: Gracefully deal with packages containing an etc/ symlink.
This fixes a bug whereby 'guix package -i gcc-toolchain' would fail in 'build-profile'. This is because in 'gcc-toolchain', etc/ is a symlink, and so the 'scandir' call in 'unsymlink' would return #f instead of returning a list. Reported by Andreas Enge <andreas.enge@inria.fr>. * guix/build/profiles.scm (ensure-writable-directory)[unsymlink]: Append "/" to TARGET before calling 'scandir'. * tests/profiles.scm ("etc/profile when etc/ is a symlink"): New test.
Diffstat (limited to 'guix')
-rw-r--r--guix/build/profiles.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/guix/build/profiles.scm b/guix/build/profiles.scm
index 525d59b979..2becc6b9af 100644
--- a/guix/build/profiles.scm
+++ b/guix/build/profiles.scm
@@ -94,7 +94,9 @@ symlink (to a read-only directory in the store), then delete the symlink and
instead make DIRECTORY a \"real\" directory containing symlinks."
(define (unsymlink link)
(let* ((target (readlink link))
- (files (scandir target
+ ;; TARGET might itself be a symlink, so append "/" to make sure
+ ;; 'scandir' enters it.
+ (files (scandir (string-append target "/")
(negate (cut member <> '("." ".."))))))
(delete-file link)
(mkdir link)