[oe-commits] [openembedded-core] 02/02: useradd-staticids: don't create username-group if gid is specified

git at git.openembedded.org git at git.openembedded.org
Fri Sep 22 17:05:06 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 8879f57e1546e55446c569d4adf41fcaab2ef88b
Author: André Draszik <adraszik at tycoint.com>
AuthorDate: Fri Sep 22 10:00:10 2017 +0100

    useradd-staticids: don't create username-group if gid is specified
    
    Adding distcc to an image, and having staticids enabled,
    doesn't work as it causes a a superfluous 'distcc' group
    being added using a conflicting  GID, thus failing the
    build:
     | ERROR: distcc-3.2-r0 do_prepare_recipe_sysroot: distcc: groupadd command did not succeed.
    
    Compared to other recipes, the distcc recipe only
    specifies --gid for the primary group, and doesn't specify
    --no-user-group, but when --gid is given, it doesn't make
    sense to create a matching username-group in addition,
    even if --no-user-group was not specified, and 'useradd'
    actually complains if --gid and --user-group are given
    both.
    
    If only --gid is given, the current code in here
    effectively behaves as if --user-group was specified,
    taking the group-id of the username-group from the
    --gid parameter. This causes the error above, as we try
    to add a new group (distcc) with an existing group-id
    (nogroup).
    
    This is contrary to the comment in this file just above,
    contrary to what useradd can do, contrary to behaviour
    without the useradd-staticids bbclass, and non-intuitive.
    
    Change the code such that a username-group is only created
    - if a primary group using --gid was not specified, or
    - if --no-user-group was not specified
    
    To be in line with useradd, if gid is not given, and
    --no-user-group is given, we add the user to the group
    'users', which mimics useradd's behaviour.
    
    Signed-off-by: André Draszik <adraszik at tycoint.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/useradd-staticids.bbclass | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/meta/classes/useradd-staticids.bbclass b/meta/classes/useradd-staticids.bbclass
index ce4ac62..eb8e59e 100644
--- a/meta/classes/useradd-staticids.bbclass
+++ b/meta/classes/useradd-staticids.bbclass
@@ -102,9 +102,13 @@ def update_useradd_static_config(d):
             # So if the implicit username-group creation is on, then the implicit groupname (LOGIN)
             # is used, and we disable the user_group option.
             #
-            user_group = uaargs.user_group is None or uaargs.user_group is True
-            uaargs.groupname = uaargs.LOGIN if user_group else uaargs.gid
-            uaargs.groupid = field[3] or uaargs.gid or uaargs.groupname
+            if uaargs.gid:
+                uaargs.groupname = uaargs.gid
+            elif uaargs.user_group is not False:
+                uaargs.groupname = uaargs.LOGIN
+            else:
+                uaargs.groupname = 'users'
+            uaargs.groupid = field[3] or uaargs.groupname
 
             if uaargs.groupid and uaargs.gid != uaargs.groupid:
                 newgroup = None

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list