aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-04-18 19:26:34 +0200
committerLudovic Courtès <ludo@gnu.org>2016-04-18 19:26:34 +0200
commitdd1d09f7e4c522d2185eda9c806ea525e10172be (patch)
tree3161fc83fd4a25247d6bb991859967f1ff3b3bff /guix
parentcd76fbde6f70a6c0087f9330c266d51e334a0679 (diff)
downloadgnu-guix-dd1d09f7e4c522d2185eda9c806ea525e10172be.tar
gnu-guix-dd1d09f7e4c522d2185eda9c806ea525e10172be.tar.gz
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.
Diffstat (limited to 'guix')
-rw-r--r--guix/utils.scm3
1 files changed, 2 insertions, 1 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index a0e9439dd3..6c01edde21 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)