mirror of
https://codeberg.org/guix/guix.git
synced 2026-01-25 12:05:19 -06:00
environment: Do not attempt to map GID 0 when invoked as root.
* guix/scripts/environment.scm (launch-environment/container): Set ‘gid’ to 1000 when ‘getgid’ returns zero. Fixes: guix/guix#4234 Reported-by: Maxim Cournoyer <maxim@guixotic.coop> Change-Id: I781f2939dfd3cda23373d2fa03e288995bce9eb9
This commit is contained in:
parent
0c60cfcd37
commit
7b9c30de1f
1 changed files with 7 additions and 1 deletions
|
|
@ -828,7 +828,13 @@ WHILE-LIST."
|
|||
(let* ((cwd (getcwd))
|
||||
(home (getenv "HOME"))
|
||||
(uid (if user 1000 (getuid)))
|
||||
(gid (if user 1000 (getgid)))
|
||||
(gid (if user
|
||||
1000
|
||||
;; When running as root, always map a non-zero GID
|
||||
;; or writing to 'gid_map' would fail with EPERM.
|
||||
(match (getgid)
|
||||
(0 1000)
|
||||
(gid gid))))
|
||||
|
||||
;; On a foreign distro, the name service switch might be
|
||||
;; dysfunctional and 'getpwuid' throws. Don't let that hamper
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue