This is a note to let you know that I've just added the patch titled kbuild: rust_is_available: fix confusion when a version appears in the path to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: kbuild-rust_is_available-fix-confusion-when-a-versio.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit d60f253e0adb90585d471d7375e557448e7e992e Author: Miguel Ojeda <ojeda@xxxxxxxxxx> Date: Fri Jun 16 02:16:27 2023 +0200 kbuild: rust_is_available: fix confusion when a version appears in the path [ 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 <mail@xxxxxxxxxxxx> Closes: https://github.com/Rust-for-Linux/linux/issues/942 [1] Reported-by: "Ethan D. Twardy" <ethan.twardy@xxxxxxxxx> Closes: https://lore.kernel.org/rust-for-linux/20230528131802.6390-2-ethan.twardy@xxxxxxxxx/ [2] Reported-by: Tiago Lam <tiagolam@xxxxxxxxx> Closes: https://github.com/Rust-for-Linux/linux/pull/789 [3] Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`") Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@xxxxxxxxx> Reviewed-by: Ethan Twardy <ethan.twardy@xxxxxxxxx> Tested-by: Ethan Twardy <ethan.twardy@xxxxxxxxx> Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230616001631.463536-8-ojeda@xxxxxxxxxx Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh index c965895d80b97..7a925d2b20fc7 100755 --- a/scripts/rust_is_available.sh +++ b/scripts/rust_is_available.sh @@ -112,9 +112,7 @@ fi # of the `libclang` found by the Rust bindings generator is suitable. bindgen_libclang_version=$( \ echo "$bindgen_libclang_output" \ - | grep -F 'clang version ' \ - | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ - | head -n 1 \ + | sed -nE 's:.*clang version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' ) bindgen_libclang_min_version=$($min_tool_version llvm) bindgen_libclang_cversion=$(get_canonical_version $bindgen_libclang_version)