aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-12-10 17:21:31 +0100
committerLudovic Courtès <ludo@gnu.org>2019-12-10 20:56:06 +0100
commitc20ba18304ee63f01895f092bb51bc2a9ce3303b (patch)
treec95cc874f8baf010637918fab3c19005474bd1d4
parentdc995fcd5a62496721757f4ecb7f9b9d65399b5c (diff)
downloadpatches-c20ba18304ee63f01895f092bb51bc2a9ce3303b.tar
patches-c20ba18304ee63f01895f092bb51bc2a9ce3303b.tar.gz
profiles: Use 'getpwuid' when $USER and $LOGNAME are undefined.
Reported by YOANN P <yoann_mac_donald@hotmail.com>. * guix/profiles.scm (%profile-directory): Fall back to 'getpwuid' when "USER" and "LOGNAME" are undefined.
-rw-r--r--guix/profiles.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index f5e5cc33d6..616605151e 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1727,7 +1727,9 @@ because the NUMBER is zero.)"
(define %profile-directory
(string-append %state-directory "/profiles/"
(or (and=> (or (getenv "USER")
- (getenv "LOGNAME"))
+ (getenv "LOGNAME")
+ (false-if-exception
+ (passwd:name (getpwuid (getuid)))))
(cut string-append "per-user/" <>))
"default")))