• [gentoo-dev] [PATCH 4/4] acct-group.eclass: use an eclass variable for

    From Michael Orlitzky@21:1/5 to All on Thu May 9 14:00:01 2024
    If (after upcasing and replacing hyphens by underscores) ACCT_GROUP_NAME
    is set to something that isn't valid in a bash variable name, the eclass
    will crash: it uses ACCT_GROUP_NAME to construct the make.conf override variables in pkg_pretend() and src_install().

    This commit relocates the computation of the "override name" subsequent
    to the definition of ACCT_GROUP_NAME="${PN}". In Gentoo, policy prohibits redefinition of that variable; so nothing is changed. But in an overlay,
    this allows the ebuild to define ACCT_GROUP_NAME to something that would
    not be valid in a bash variable at the expense of violating expectations
    about the override variable names.

    Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
    ---
    eclass/acct-group.eclass | 23 +++++++++++++++++++----
    1 file changed, 19 insertions(+), 4 deletions(-)

    diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
    index 305440116ecd..69b262fb49cf 100644
    --- a/eclass/acct-group.eclass
    +++ b/eclass/acct-group.eclass
    @@ -57,6 +57,23 @@ inherit user-info
    # otherwise-valid group names.
    ACCT_GROUP_NAME=${PN}

    +# @ECLASS_VARIABLE: _OVERRIDE_NAME
    +# @INTERNAL
    +# @DESCRIPTION:
    +# A version of the group name suitable for use in a bash variable. This
    +# is used to construct the names of the make.conf override variables and
    +# it will always be uppercase $PN with the hyphens replaced by
    +# underscores. It is defined once, here, so that in an overlay the
    +# ebuild may set ACCT_GROUP_NAME to something other than $PN without
    +# affecting the name of the override variable. This is necessary if the
    +# group name in question would lead to an invalid bash variable
    +# name. Doing so does violate expectations with respect to the override
    +# na