Message ID | 20200825085824.GA3150@zpidnp36 |
---|---|
State | Accepted |
Headers | show |
Series | [bug#43034] environment: Set USER and LOGNAME in container | expand |
Context | Check | Description |
---|---|---|
cbaines/applying patch | fail | View Laminar job |
Hi Lars, Lars-Dominik Braun <ldb@leibniz-psychology.org> skribis: > From 516fecf81c980a020906533cd5135c6a7603a0a1 Mon Sep 17 00:00:00 2001 > From: Lars-Dominik Braun <ldb@leibniz-psychology.org> > Date: Tue, 25 Aug 2020 10:52:21 +0200 > Subject: [PATCH] environment: Set USER and LOGNAME in container > > * guix/scripts/environment.scm (launch-environment/container): Set > username environment variables. Applied! > ;; The same variables as in Nix's 'build.cc'. > '("TMPDIR" "TEMPDIR" "TMP" "TEMP")) > > + ;; Some programs expect USER and/or LOGNAME to be set. > + (setenv "LOGNAME" logname) > + (setenv "USER" logname) I was hesitant because so far we were more or less following the set of variables exported by the daemon (see nix/libstore/build.cc), but there were already exceptions (HOME, GUIX_ENVIRONMENT, PS1), and I think making ‘guix environment -C’ more convenient is what matters. Thanks, Ludo’.
From 516fecf81c980a020906533cd5135c6a7603a0a1 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun <ldb@leibniz-psychology.org> Date: Tue, 25 Aug 2020 10:52:21 +0200 Subject: [PATCH] environment: Set USER and LOGNAME in container * guix/scripts/environment.scm (launch-environment/container): Set username environment variables. --- guix/scripts/environment.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index b8979cac19..1fb3505307 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -477,6 +477,7 @@ WHILE-LIST." (group-entry (gid 65534) ;the overflow GID (name "overflow")))) (home-dir (password-entry-directory passwd)) + (logname (password-entry-name passwd)) (environ (filter (match-lambda ((variable . value) (find (cut regexp-exec <> variable) @@ -528,6 +529,10 @@ WHILE-LIST." ;; The same variables as in Nix's 'build.cc'. '("TMPDIR" "TEMPDIR" "TMP" "TEMP")) + ;; Some programs expect USER and/or LOGNAME to be set. + (setenv "LOGNAME" logname) + (setenv "USER" logname) + ;; Create a dummy home directory. (mkdir-p home-dir) (setenv "HOME" home-dir) -- 2.26.2