• [gentoo-dev] [PATCH] acct-user.eclass: handle ACCT_USER_HOME_OWNER when

    From Mike Gilbert@21:1/5 to All on Tue May 20 18:30:02 2025
    We need to resolve the user and group names to numeric ids before
    calling fowners.

    Closes: https://bugs.gentoo.org/956026
    Closes: https://github.com/gentoo/gentoo/pull/42158
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>
    ---
    eclass/acct-user.eclass | 22 ++++++++++++++--------
    1 file changed, 14 insertions(+), 8 deletions(-)

    diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
    index b3bcff7e550c..12a2110b1a87 100644
    --- a/eclass/acct-user.eclass
    +++ b/eclass/acct-user.eclass
    @@ -1,4 +1,4 @@
    -# Copyright 2019-2024 Gentoo Authors
    +# Copyright 2019-2025 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    # @ECLASS: acct-user.eclass
    @@ -370,14 +370,20 @@ acct-user_pkg_preinst() {

    if [[ ${_ACCT_USER_HOME} != /dev/null ]]; then
    # default ownership to user:group
    - if [[ -z ${_ACCT_USER_HOME_OWNER} ]]; then
    - if [[ -n ${ROOT} ]]; then
    - local euid=$(egetent passwd ${ACCT_USER_NAME} | cut -d: -f3)
    - local egid=$(egetent passwd ${ACCT_USER_NAME} | cut -d: -f4)
    - _ACCT_USER_HOME_OWNER=${euid}:${egid}
    - else
    - _ACCT_USER_HOME_OWNER=${ACCT_USER_NAME}:${groups[0]}
    + local user=${ACCT_USER_NAME}
    + local group=${groups[0]}
    + if [[ -n ${ROOT} ]];