guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: utils: 'cache-directory' gracefully deals with unset 'HOME'.


From: Ludovic Courtès
Subject: 01/02: utils: 'cache-directory' gracefully deals with unset 'HOME'.
Date: Mon, 18 Apr 2016 17:38:06 +0000

civodul pushed a commit to branch master
in repository guix.

commit dd1d09f7e4c522d2185eda9c806ea525e10172be
Author: Ludovic Courtès <address@hidden>
Date:   Mon Apr 18 19:26:34 2016 +0200

    utils: 'cache-directory' gracefully deals with unset 'HOME'.
    
    Fixes <http://bugs.gnu.org/23165>.
    
    * guix/utils.scm (cache-directory): Use 'getpwuid' when 'HOME' is unset.
---
 guix/utils.scm |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/guix/utils.scm b/guix/utils.scm
index a0e9439..6c01edd 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -808,7 +808,8 @@ elements after E."
 (define (cache-directory)
   "Return the cache directory for Guix, by default ~/.cache/guix."
   (or (getenv "XDG_CONFIG_HOME")
-      (and=> (getenv "HOME")
+      (and=> (or (getenv "HOME")
+                 (passwd:dir (getpwuid (getuid))))
              (cut string-append <> "/.cache/guix"))))
 
 (define (readlink* file)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]