From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A584F158089 for ; Wed, 8 Nov 2023 06:52:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 43B992BC024; Wed, 8 Nov 2023 06:52:45 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id F2D1C2BC018 for ; Wed, 8 Nov 2023 06:52:44 +0000 (UTC) References: <20231023204145.27236-2-ulm@gentoo.org> User-agent: mu4e 1.10.7; emacs 30.0.50 From: Sam James To: gentoo-dev@lists.gentoo.org Cc: Ulrich =?utf-8?Q?M=C3=BCller?= , Mike Gilbert Subject: Re: [gentoo-dev] [PATCH v2] acct-user.eclass: Warn when the user is removed from a group Date: Wed, 08 Nov 2023 06:52:34 +0000 Organization: Gentoo In-reply-to: <20231023204145.27236-2-ulm@gentoo.org> Message-ID: <87zfzolosn.fsf@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 78619853-010c-4293-9759-c9b393390ab1 X-Archives-Hash: ef7d124153dec27e6a6129c55c573547 Ulrich M=C3=BCller writes: > Acked-by: Mike Gilbert > Signed-off-by: Ulrich M=C3=BCller > --- > v2: Add explanation and documentation reference to warning message lgtm > > eclass/acct-user.eclass | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass > index f658aa0eabc3..c9d335c4e558 100644 > --- a/eclass/acct-user.eclass > +++ b/eclass/acct-user.eclass > @@ -431,6 +431,20 @@ acct-user_pkg_postinst() { > opts+=3D( --prefix "${ROOT}" ) > fi >=20=20 > + local g old_groups del_groups=3D"" > + old_groups=3D$(egetgroups "${ACCT_USER_NAME}") > + for g in ${old_groups//,/ }; do > + has "${g}" "${groups[@]}" || del_groups+=3D"${del_groups:+, }${g}" > + done > + if [[ -n ${del_groups} ]]; then > + ewarn "Removing user ${ACCT_USER_NAME} from group(s): ${del_groups}" > + ewarn "To retain the user's group membership in the local system" > + ewarn "config, override with ACCT_USER_${ACCT_USER_NAME^^}_GROUPS" > + ewarn "or ACCT_USER_${ACCT_USER_NAME^^}_GROUPS_ADD in make.conf." > + ewarn "Documentation reference:" > + ewarn "https://wiki.gentoo.org/wiki/Practical_guide_to_the_GLEP_81_mig= ration#Override_user_groups" > + fi > + > elog "Updating user ${ACCT_USER_NAME}" > # usermod outputs a warning if unlocking the account would result in an > # empty password. Hide stderr in a text file and display it if usermod = fails.