diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-04-18 19:26:34 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-04-18 19:26:34 +0200 |
commit | dd1d09f7e4c522d2185eda9c806ea525e10172be (patch) | |
tree | 3161fc83fd4a25247d6bb991859967f1ff3b3bff /guix/utils.scm | |
parent | cd76fbde6f70a6c0087f9330c266d51e334a0679 (diff) | |
download | gnu-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/utils.scm')
-rw-r--r-- | guix/utils.scm | 3 |
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) |