Skip to content

Commit f4f8655

Browse files
ruscurgregkh
authored andcommitted
kbuild: rust_is_available: fix version check when CC has multiple arguments
[ Upstream commit dee3a6b ] rust_is_available.sh uses cc-version.sh to identify which C compiler is in use, as scripts/Kconfig.include does. cc-version.sh isn't designed to be able to handle multiple arguments in one variable, i.e. "ccache clang". Its invocation in rust_is_available.sh quotes "$CC", which makes $1 == "ccache clang" instead of the intended $1 == ccache & $2 == clang. cc-version.sh could also be changed to handle having "ccache clang" as one argument, but it only has the one consumer upstream, making it simpler to fix the caller here. Signed-off-by: Russell Currey <[email protected]> Fixes: 78521f3 ("scripts: add `rust_is_available.sh`") Link: Rust-for-Linux#873 [ Reworded title prefix and reflow line to 75 columns. ] Reviewed-by: Martin Rodriguez Reboredo <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent e227495 commit f4f8655

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/rust_is_available.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ fi
113113
#
114114
# In the future, we might be able to perform a full version check, see
115115
# https://github.com/rust-lang/rust-bindgen/issues/2138.
116-
cc_name=$($(dirname $0)/cc-version.sh "$CC" | cut -f1 -d' ')
116+
cc_name=$($(dirname $0)/cc-version.sh $CC | cut -f1 -d' ')
117117
if [ "$cc_name" = Clang ]; then
118118
clang_version=$( \
119-
LC_ALL=C "$CC" --version 2>/dev/null \
119+
LC_ALL=C $CC --version 2>/dev/null \
120120
| sed -nE '1s:.*version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p'
121121
)
122122
if [ "$clang_version" != "$bindgen_libclang_version" ]; then

0 commit comments

Comments
 (0)