summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-02-27 23:24:56 +0100
committerLudovic Courtès <ludo@gnu.org>2020-02-27 23:29:30 +0100
commit6b0653e7ec8a9a842fb62e28fe83c9677f40d552 (patch)
treedae67175ba7011888d28a4cfc1581c4193916d6b
parent749b9582061f7d929be83a194040b63b41afec81 (diff)
downloadguix-6b0653e7ec8a9a842fb62e28fe83c9677f40d552.tar.gz
guix package: Don't error out when failing to create ~/.guix-profile.
This is a followup to 7842ddcbc118cbc2799e22651732b7cdc06b93ee, which
broke tests when 'HOME' is unset.

* guix/scripts/package.scm (ensure-default-profile): Silently ignore
'symlink' exceptions.
-rw-r--r--guix/scripts/package.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 1cb0d382bf..d2f4f1ccd3 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -81,12 +81,15 @@
   "Ensure the default profile symlink and directory exist and are writable."
   (ensure-profile-directory)
 
-  ;; Create ~/.guix-profile if it doesn't exist yet.
+  ;; Try to create ~/.guix-profile if it doesn't exist yet.
   (when (and %user-profile-directory
              %current-profile
              (not (false-if-exception
                    (lstat %user-profile-directory))))
-    (symlink %current-profile %user-profile-directory)))
+    (catch 'system-error
+      (lambda ()
+        (symlink %current-profile %user-profile-directory))
+      (const #t))))
 
 (define (delete-generations store profile generations)
   "Delete GENERATIONS from PROFILE.