commit: 277a5b46dc0cfa7c0e6aaa680d9cc5f7b989ee41
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jul 20 06:16:39 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jul 22 22:30:55 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=277a5b46
isolated-functions.sh: rectify six unquoted parameter expansions
Rectify six instances in which unquoted parameter expansions are
performed (SC2086). Three of these concern the die() function, two
concern the eend() function, and one concerns the __set_colors()
function.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/isolated-functions.sh | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 9270a344d4..fbb4c6ced4 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -141,7 +141,7 @@ die() {
local main_index
(( main_index = ${#BASH_SOURCE[@]} - 1 ))
if [[ ${BASH_SOURCE[main_index]##*/} == @(ebuild|misc-functions).sh ]];
then
- __dump_trace 2 ${filespacing} ${linespacing}
+ __dump_trace 2 "${filespacing}" "${linespacing}"
eerror " $(printf "%${filespacing}s" "${BASH_SOURCE[1]##*/}"), line
$(printf "%${linespacing}s" "${BASH_LINENO[0]}"): Called die"
eerror "The specific snippet of code:"
# This scans the file that called die and prints out the logic that
@@ -341,7 +341,7 @@ __eend() {
printf "%$(( COLS - LAST_E_LEN - 7 ))s%b\n" '' "${msg}" >&2
fi
- return ${retval}
+ return "${retval}"
}
eend() {
@@ -353,10 +353,10 @@ eend() {
eqawarn "QA Notice: eend called without preceding ebegin in
${FUNCNAME[1]}"
fi
- __eend ${retval} eerror "$*"
+ __eend "${retval}" eerror "$*"
LAST_E_CMD="eend"
- return ${retval}
+ return "${retval}"
}
__unset_colors() {
@@ -391,8 +391,10 @@ __set_colors() {
# Now, ${ENDCOL} will move us to the end of the
# column; regardless of character width
ENDCOL=$'\e[A\e['$(( COLS - 8 ))'C'
- if [[ -n "${PORTAGE_COLORMAP}" ]]; then
- eval ${PORTAGE_COLORMAP}
+ if [[ ${PORTAGE_COLORMAP} ]]; then
+ # The PORTAGE_COLORMAP environment variable is defined by the
+ # doebuild.py unit and is intended to be evaluated as code.
+ eval "${PORTAGE_COLORMAP}"
else
PORTAGE_COLOR_BAD=$'\e[31;01m'
PORTAGE_COLOR_BRACKET=$'\e[34;01m'