On Sun, Jan 3, 2021 at 8:35 PM Thomas Deutschmann <whi...@gentoo.org> wrote: > > Modifying an existing user is a bad default and makes Gentoo > special because it is common for system administrators to make > modifications to user (i.e. putting an user into another service's > group to allow that user to access service in question) and it > would be unexpected to see these changes reverted during normal > world upgrade (which could break services). > > This commit will make Gentoo behave like any other Linux distribution > by respecting any user modifications by default. However, we will retain > the functionality to reset system user and groups and users interested > in this feature can opt-in by setting > ACCT_USER_ALLOW_EXISTING_USER_TO_BE_MODIFIED to a non-zero value in > their make.conf.
So the main problem I see with doing this is that it becomes impossible to reliably make changes to a user in later ebuild revisions. Developers may want/need to deploy changes to user attributes. Changing group memberships seems like the best example, but I could foresee a want/need to change DESCRIPTION, HOME, or SHELL as well. Because of this, I think the new behavior should be opt-in, and people who use it should be aware that they will need to pay attention if any account changes are rolled out in new ebuild versions. > diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass > index 22b0038fbff7..d60b1e53b4bb 100644 > --- a/eclass/acct-user.eclass > +++ b/eclass/acct-user.eclass > @@ -309,6 +321,20 @@ acct-user_pkg_pretend() { > fi > } > > +# @FUNCTION: acct-user_pkg_setup > +# @DESCRIPTION: > +# Initialize internal environment variable(s). > +acct-user_pkg_setup() { > + debug-print-function ${FUNCNAME} "${@}" > + > + # check if user already exists > + ACCT_USER_ALREADY_EXISTS= > + if [[ -n $(egetent passwd "${ACCT_USER_NAME}") ]]; then > + ACCT_USER_ALREADY_EXISTS=yes > + fi > + readonly ACCT_USER_ALREADY_EXISTS > +} I don't think this pkg_setup function is necessary; you could do this in pkg_preinst instead, before enewuser gets called.