commit:     cab160d3c614472e20f145e65a2d7f72bdf615b7
Author:     Tim Harder <radhermit <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 27 06:58:01 2019 +0000
Commit:     Tim Harder <radhermit <AT> gentoo <DOT> org>
CommitDate: Fri Sep 27 09:10:53 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cab160d3

flag-o-matic.eclass: test-flag-PROG(): verify selected compiler exists

Before trying to use it. Fixes stricter phase running done by pkgcore
which explicitly dies when encountering unknown commands.

Closes: https://bugs.gentoo.org/695706

Signed-off-by: Tim Harder <radhermit <AT> gentoo.org>

 eclass/flag-o-matic.eclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 3b32bd9d631..89b259cc222 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -435,8 +435,12 @@ test-flag-PROG() {
 
        [[ -z ${comp} || -z $1 ]] && return 1
 
+       # verify selected compiler exists before using it
+       comp=$(tc-get${comp})
+       type -p ${comp} >/dev/null || return 1
+
        local cmdline=(
-               $(tc-get${comp})
+               ${comp}
                # Clang will warn about unknown gcc flags but exit 0.
                # Need -Werror to force it to exit non-zero.
                -Werror

Reply via email to