diff options
authorStephan Bergmann <>2020-05-18 11:54:08 +0200
committerStephan Bergmann <>2020-05-18 15:03:14 +0200
commitcce42f7de6bdc406f40a0a16ad15285adc4a4c62 (patch)
parentda552b29a4c894e02262c3ea26f231cf1a9a0858 (diff)
Apply dirname to the first word of CXX case it contains addtional arguments like -fsized-deallocation besides the compiler's pathname, which would have caused failures like basename: extra operand '-fsized-deallocation' Try 'basename --help' for more information. dirname: missing operand Try 'dirname --help' for more information. dirname: missing operand Try 'dirname --help' for more information. (printf reuses the format operand to satisfy all argument operands, so that \n | head hack is needed to get just the first one, assuming that CXX did not contain any carefully crafted escape sequences inside that first argument that would expand to a newline when printing. Also, this does not cater for leading var=value or (even more far-fetched) redirection words in CXX, but the original code did not, either.) Change-Id: Iae4d1a0ae3b67cc5e8c7a8a36258230f8ab8fd70 Reviewed-on: Tested-by: Jenkins Reviewed-by: Stephan Bergmann <>
1 files changed, 1 insertions, 1 deletions
diff --git a/ b/
index 1d531f32edec..6e5e18021a3c 100644
--- a/
+++ b/
@@ -7205,7 +7205,7 @@ if test "$COM_IS_CLANG" = "TRUE"; then
dnl The prefix where Clang resides, override to where Clang resides if
dnl using a source build:
if test -z "$CLANGDIR"; then
- CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
+ CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | head -n 1)))))
# Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
if test -z "$COMPILER_PLUGINS_CXX"; then