From: Daan De Meyer Date: Thu, 21 Mar 2024 12:35:01 +0000 (+0100) Subject: Only set extra_groups for mkdir() if we were invoked as root X-Git-Tag: v23~68^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2543%2Fhead;p=thirdparty%2Fmkosi.git Only set extra_groups for mkdir() if we were invoked as root The extra groups of the user are not mapped into the user namespace we create and as such can't be set when invoking a subprocess if we weren't invoked as root. --- diff --git a/mkosi/user.py b/mkosi/user.py index 34a9a8a7a..4437fd5e7 100644 --- a/mkosi/user.py +++ b/mkosi/user.py @@ -76,7 +76,7 @@ class INVOKING_USER: ["mkdir", "--parents", path], user=cls.uid if cond else os.getuid(), group=cls.gid if cond else os.getgid(), - extra_groups=cls.extra_groups() if cond else None, + extra_groups=cls.extra_groups() if cls.invoked_as_root and cond else None, ) return path