From: Michael Orlitzky <mjo@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH v2 4/4] eclass/acct-group.eclass: use $PN to construct make.conf override vars
Date: Thu, 9 May 2024 16:41:59 -0400 [thread overview]
Message-ID: <20240509204159.18123-5-mjo@gentoo.org> (raw)
In-Reply-To: <20240509204159.18123-1-mjo@gentoo.org>
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@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."
--
2.43.2
next prev parent reply other threads:[~2024-05-09 20:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-09 20:41 [gentoo-dev] [PATCH v2 0/4] acct-{user,group}.eclass: make user/group names writable Michael Orlitzky
2024-05-09 20:41 ` [gentoo-dev] [PATCH v2 1/4] acct-user.eclass: make ACCT_USER_NAME writable Michael Orlitzky
2024-05-09 20:41 ` [gentoo-dev] [PATCH v2 2/4] acct-group.eclass: make ACCT_GROUP_NAME writable Michael Orlitzky
2024-05-09 20:41 ` [gentoo-dev] [PATCH v2 3/4] eclass/acct-user.eclass: use $PN to construct make.conf override vars Michael Orlitzky
2024-05-09 20:41 ` Michael Orlitzky [this message]
2024-05-13 13:26 ` [gentoo-dev] [PATCH v2 0/4] acct-{user,group}.eclass: make user/group names writable Michael Orlitzky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240509204159.18123-5-mjo@gentoo.org \
--to=mjo@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox