commit: c73fd9d8a31c396b8669bd9d63fdf4edf63d562d
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed May 28 01:39:26 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 30 07:30:34 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c73fd9d8
ebuild.sh: avoid arbitrarily disabling extglob
There are several instances in which a dynamic function declaration
could theoretically be interpreted as an extglob, depending on the exact
name of the function. Presently, the defence against this is to forcibly
disable extglob - an option that is best left untouched except where
being wilfully enabled as soon as bash starts. Instead, place a space
between the name of the function and the following pair of parentheses.
I must add that bash never enables the extglob option unless it is
directly instructed to do so.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/ebuild.sh | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 63fd0117d8..63ca68c8c4 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -88,7 +88,7 @@ else
# are considered to be severe QA violations.
funcs+=" best_version has_version portageq"
for x in ${funcs} ; do
- eval "${x}() { die \"\${FUNCNAME}() calls are not allowed in
global scope\"; }"
+ eval "${x} () { die \"\${FUNCNAME}() calls are not allowed in
global scope\"; }"
done
unset funcs x
@@ -489,9 +489,6 @@ __try_source() {
export SANDBOX_ON="1"
export S=${WORKDIR}/${P}
-# Turn off extended glob matching so that g++ doesn't get incorrectly matched.
-shopt -u extglob
-
if [[ ${EBUILD_PHASE} == depend ]] ; then
QA_INTERCEPTORS="awk bash cc egrep equery fgrep g++
gawk gcc grep javac java-config nawk perl
@@ -512,7 +509,7 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
BODY="${BIN_PATH} \"\$@\"; return \$?"
fi
if [[ ${EBUILD_PHASE} == depend ]] ; then
- FUNC_SRC="${BIN}() {
+ FUNC_SRC="${BIN} () {
if [[ \${ECLASS_DEPTH} -gt 0 ]]; then
eqawarn \"QA Notice: '${BIN}' called in
global scope: eclass \${ECLASS}\"
else
@@ -521,7 +518,7 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
${BODY}
}"
elif [[ ${BIN} == @(autoconf|automake|aclocal|libtoolize) ]];
then
- FUNC_SRC="${BIN}() {
+ FUNC_SRC="${BIN} () {
case \${FUNCNAME[1]} in
eautoreconf |\\
eaclocal |\\
@@ -541,7 +538,7 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
${BODY}
}"
else
- FUNC_SRC="${BIN}() {
+ FUNC_SRC="${BIN} () {
eqawarn \"QA Notice: '${BIN}' called by
\${FUNCNAME[1]}: \${CATEGORY}/\${PF}\"
${BODY}
}"