From 113c17a0c969e600023698ae3a34994a796d0046 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 18 May 2015 09:47:29 +0200 Subject: 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 . * 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. --- guix/build/profiles.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'guix/build') 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) -- cgit v1.2.3