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.
This commit is contained in:
Ludovic Courtès 2019-12-10 17:21:31 +01:00
parent dc995fcd5a
commit c20ba18304
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -1727,7 +1727,9 @@ (define %user-profile-directory
(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")))