commit: 85d8343bf0dcc5e9aeab3a54b1b83db4dd3ec89f
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jul 20 05:29:36 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jul 22 22:30:52 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=85d8343b
isolated-functions.sh: don't validate the first parameter in __elog_base()
Presently, the __elog_base() helper function validates the first
positional parameter, which is expected to be any of "INFO", "WARN",
"ERROR", "LOG" or "QA". To do so is futile because there are only six
instances in which the function is invoked, all of which hard-code one
of these expected values. Drop the validation code.
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, 3 insertions(+), 11 deletions(-)
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 23348b918c..ed66dcbe48 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -230,7 +230,9 @@ __vecho() {
# Internal logging function, don't use this in ebuilds
__elog_base() {
- local messagetype
+ local messagetype=$1
+ shift
+
if [[ ${EBUILD_PHASE} == depend && -z ${__PORTAGE_ELOG_BANNER_OUTPUT}
]]; then
# in depend phase, we want to output a banner indicating which
# package emitted the message
@@ -239,16 +241,6 @@ __elog_base() {
__PORTAGE_ELOG_BANNER_OUTPUT=1
fi
[[ -z "${1}" || -z "${T}" || ! -d "${T}/logging" ]] && return 1
- case "${1}" in
- INFO|WARN|ERROR|LOG|QA)
- messagetype="${1}"
- shift
- ;;
- *)
- __vecho -e "
${PORTAGE_COLOR_BAD}*${PORTAGE_COLOR_NORMAL} Invalid use of internal function
__elog_base(), next message will not be logged"
- return 1
- ;;
- esac
echo -e "$@" | while read -r ; do
echo "${messagetype} ${REPLY}"
done >> "${T}/logging/${EBUILD_PHASE:-other}"