Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 512220 - user.eclass: enewuser: user-groups should not be auto-created
Summary: user.eclass: enewuser: user-groups should not be auto-created
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-03 01:37 UTC by Jonathan Vasquez (RETIRED)
Modified: 2019-06-20 08:17 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Vasquez (RETIRED) gentoo-dev 2014-06-03 01:37:24 UTC
Hello all,

I noticed that the current user.eclass's implementation of euseradd depends on the value of 'USERGROUPS_ENAB' in /etc/login.defs.

Speaking to several developers in #gentoo-dev, it seems that an ebuild writer is suppose to call both 'enewuser' and 'enewgroup' in order to add an user or a group, rather than depending on enewuser to automatically add a group.

Reading 'man useradd', the -r flag means that a system account will be created and a home directory will not be created unless -m is also use. It also says that it will ignore login.defs specifically when speaking about creating a home directory. However, it doesn't say anything about ignoring login.defs for group creation when an user is added (Which makes the above effect take place).

In order so solve this, the 'enewuser' function should be modified so that it doesn't depend on login.defs, but rather to make sure that a group is not added and only a user. Line 250 would need to change from:

 useradd -r "${opts[@]}" "${euser}" || die

to

 useradd -N -r "${opts[@]}" "${euser}" || die

with -N meaning:

-N, --no-user-group  do not create a group with the same name as the user

Doing this will make the eclass function as it was originally intended (To only create an user, and not a group - and to assume that if the ebuild writer wants to create a group, then they will call enewgroup manually).

However, if we do this, we need to know that any ebuilds that didn't "properly implement" (as defined by the above assumptions) user/group adding, will break.

- fearedbliss
Comment 1 SpanKY gentoo-dev 2014-06-04 16:06:37 UTC
enewuser isn't relying on that behavior.  it just shouldn't happen at all.
Comment 2 Larry the Git Cow gentoo-dev 2019-06-20 08:17:11 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3afc0d7b8b5e90c50d66c5a845b96c33e521e6e8

commit 3afc0d7b8b5e90c50d66c5a845b96c33e521e6e8
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2019-05-29 17:42:07 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2019-06-20 08:16:37 +0000

    user.eclass: Do not create user-group automatically
    
    Closes: https://bugs.gentoo.org/512220
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 eclass/user.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)