commit:     06a95e6951105806c745c70db6c3e74a3ae42f09
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Aug 14 11:37:38 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 28 02:30:18 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=06a95e69

ebuild.sh: tidy up the processing of QA_INTERCEPTORS slightly

Presently, the "ebuild.sh" unit iterates over the words comprising the
value of the 'QA_INTERCEPTORS' variable while composing and declaring an
intercepting function for each. This commit applies several minor
improvements, which are described herewith.

Refrain from specifying the -f option to the type builtin. It is not
required because type -P will never match against function names.

Specify the "--" operand to the type builtin, signifying end-of-options.

Quote the expansion of the 'BIN' variable to quell an SC2086 warning.

Check the return value of the type builtin to quell an SC2181 warning.

Finally, suppress an SC2068 warning for the unquoted expansion of the
'QA_INTERCEPTORS' variable, for it is safe to perform word splitting for
its potential values.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/ebuild.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 95fdbb9c98..05dae724cd 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -503,9 +503,9 @@ fi
 
 # Level the QA interceptors if we're in depend
 if [[ -n ${QA_INTERCEPTORS} ]] ; then
+       # shellcheck disable=SC2086
        for BIN in ${QA_INTERCEPTORS}; do
-               BIN_PATH=$(type -Pf ${BIN})
-               if [[ "$?" != "0" ]]; then
+               if ! BIN_PATH=$(type -P -- "${BIN}"); then
                        BODY="echo \"*** missing command: ${BIN}\" >&2; return 
127"
                else
                        BODY="${BIN_PATH} \"\$@\"; return \$?"

Reply via email to