Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rust: fix the default format for CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT

Another oddity in these config entries is their default value can fall
back to 'n', which is a value for bool or tristate symbols.

The '|| echo n' is an incorrect workaround to avoid the syntax error.
This is not a big deal, as the entry is hidden by 'depends on RUST' in
situations where '$(RUSTC) --version' or '$(BINDGEN) --version' fails.
Anyway, it looks odd.

The default of a string type symbol should be a double-quoted string
literal. Turn it into an empty string when the version command fails.

Fixes: 2f7ab1267dc9 ("Kbuild: add Rust support")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20240727140302.1806011-2-masahiroy@kernel.org
[ Rebased on top of v6.11-rc1. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Masahiro Yamada and committed by
Miguel Ojeda
aacf93e8 5ce86c6c

+2 -2
+2 -2
init/Kconfig
··· 1919 1919 config RUSTC_VERSION_TEXT 1920 1920 string 1921 1921 depends on RUST 1922 - default $(shell,$(RUSTC) --version 2>/dev/null || echo n) 1922 + default "$(shell,$(RUSTC) --version 2>/dev/null)" 1923 1923 1924 1924 config BINDGEN_VERSION_TEXT 1925 1925 string ··· 1927 1927 # The dummy parameter `workaround-for-0.69.0` is required to support 0.69.0 1928 1928 # (https://github.com/rust-lang/rust-bindgen/pull/2678). It can be removed when 1929 1929 # the minimum version is upgraded past that (0.69.1 already fixed the issue). 1930 - default $(shell,$(BINDGEN) --version workaround-for-0.69.0 2>/dev/null || echo n) 1930 + default "$(shell,$(BINDGEN) --version workaround-for-0.69.0 2>/dev/null)" 1931 1931 1932 1932 # 1933 1933 # Place an empty function call at each tracepoint site. Can be