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 93854158064 for ; Thu, 9 May 2024 20:43:05 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2122FE2A8A; Thu, 9 May 2024 20:42:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 841A1E2A77 for ; Thu, 9 May 2024 20:42:08 +0000 (UTC) From: Michael Orlitzky 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 Message-ID: <20240509204159.18123-5-mjo@gentoo.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240509204159.18123-1-mjo@gentoo.org> References: <20240509204159.18123-1-mjo@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-Transfer-Encoding: 8bit X-Archives-Salt: 1f19ff92-5026-4032-b061-dfba159697ee X-Archives-Hash: c0e4f599910b38b24682974bf2c444bf 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 --- 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