Skip to content

Commit 39cec77

Browse files
ojedasmb49
authored andcommitted
kbuild: rust_is_available: fix confusion when a version appears in the path
BugLink: https://bugs.launchpad.net/bugs/2042884 [ Upstream commit 9eb7e20e0c5cd069457845f965b3e8a7d736ecb7 ] `bindgen`'s output for `libclang`'s version check contains paths, which in turn may contain strings that look like version numbers [1][2]: .../6.1.0-dev/.../rust_is_available_bindgen_libclang.h:2:9: warning: clang version 11.1.0 [-W#pragma-messages], err: false which the script will pick up as the version instead of the latter. It is also the case that versions may appear after the actual version (e.g. distribution's version text), which was the reason behind `head` [3]: .../rust-is-available-bindgen-libclang.h:2:9: warning: clang version 13.0.0 (Fedora 13.0.0-3.fc35) [-W#pragma-messages], err: false Thus instead ask for a match after the `clang version` string. Reported-by: Jordan Isaacs <[email protected]> Closes: Rust-for-Linux/linux#942 [1] Reported-by: "Ethan D. Twardy" <[email protected]> Closes: https://lore.kernel.org/rust-for-linux/[email protected]/ [2] Reported-by: Tiago Lam <[email protected]> Closes: Rust-for-Linux/linux#789 [3] Fixes: 78521f3 ("scripts: add `rust_is_available.sh`") Reviewed-by: Martin Rodriguez Reboredo <[email protected]> Reviewed-by: Ethan Twardy <[email protected]> Tested-by: Ethan Twardy <[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]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Stefan Bader <[email protected]>
1 parent 6d630ea commit 39cec77

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/rust_is_available.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ fi
112112
# of the `libclang` found by the Rust bindings generator is suitable.
113113
bindgen_libclang_version=$( \
114114
echo "$bindgen_libclang_output" \
115-
| sed -ne 's/.*clang version \([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p'
115+
| sed -nE 's:.*clang version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p'
116116
)
117117
bindgen_libclang_min_version=$($min_tool_version llvm)
118118
bindgen_libclang_cversion=$(get_canonical_version $bindgen_libclang_version)

0 commit comments

Comments
 (0)