civodul pushed a commit to branch master
in repository guix.

commit c20ba18304ee63f01895f092bb51bc2a9ce3303b
Author: Ludovic Courtès <[email protected]>
Date:   Tue Dec 10 17:21:31 2019 +0100

    profiles: Use 'getpwuid' when $USER and $LOGNAME are undefined.
    
    Reported by YOANN P <[email protected]>.
    
    * guix/profiles.scm (%profile-directory): Fall back to 'getpwuid' when
    "USER" and "LOGNAME" are undefined.
---
 guix/profiles.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index f5e5cc3..6166051 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")))
 

Reply via email to