commit:     bd3da28e258a68566d1abe18aa6713594adcd0ff
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu May  9 20:17:12 2024 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Mon May 13 13:13:27 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd3da28e

eclass/acct-group.eclass: use $PN to construct make.conf override vars

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 constructs the
variable names using PN instead of ACCT_GROUP_NAME. In ::gentoo, the two
are equivalent, but in an overlay this allows weirder group names at the
expense of slightly mismatched variable names.

Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 eclass/acct-group.eclass | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
index 6dd6dc06a07e..2c2c88cfc7e1 100644
--- a/eclass/acct-group.eclass
+++ b/eclass/acct-group.eclass
@@ -96,8 +96,9 @@ acct-group_pkg_pretend() {
        [[ ${ACCT_GROUP_ID} -ge -1 ]] || die "Ebuild error: 
ACCT_GROUP_ID=${ACCT_GROUP_ID} invalid!"
        local group_id=${ACCT_GROUP_ID}
 
-       # check for the override
-       local override_name=${ACCT_GROUP_NAME^^}
+       # check for the override, use PN in case this is an overlay and
+       # ACCT_GROUP_NAME is not PN and not valid in a bash variable name
+       local override_name=${PN^^}
        local override_var=ACCT_GROUP_${override_name//-/_}_ID
        if [[ -n ${!override_var} ]]; then
                group_id=${!override_var}
@@ -132,8 +133,9 @@ acct-group_pkg_pretend() {
 acct-group_src_install() {
        debug-print-function ${FUNCNAME} "${@}"
 
-       # check for the override
-       local override_name=${ACCT_GROUP_NAME^^}
+       # check for the override, use PN in case this is an overlay and
+       # ACCT_GROUP_NAME is not PN and not valid in a bash variable name
+       local override_name=${PN^^}
        local override_var=ACCT_GROUP_${override_name//-/_}_ID
        if [[ -n ${!override_var} ]]; then
                ewarn "${override_var}=${!override_var} override in effect, 
support will not be provided."

Reply via email to