Skip to contentSkip to conversation

docs: kconfig: fix shell function syntax in caveats

PATCH In review Erkan Erdem 5 participants 6 messages Sep 7 – Sep 17

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 docs: kconfig: fix shell function syntax in caveats

Kconfig separates a function name from its arguments with a comma, but the caveats section uses Make-style whitespace in its shell calls. These expressions expand as undefined variables rather than invoking the shell function, so the supposedly working CC_HAS_ENDIAN_FLAG example fails to parse.

Add the missing commas to the shell calls in this section. Keep the Make examples unchanged.

Fixes 316d55d55f49 ("Documentation: kconfig: document a new Kconfig macro language")
Assisted-by LLM

---

Changes in v2, addressing Julian Braha's review:
- Remove whitespace after the comma in the three remaining shell calls.

v1: https://lore.kernel.org/all/[email protected]/

The issue, patch and changelog were prepared with an AI coding assistant. The assistant also prepared the v2 revision and ran the checks below.

Validation:
- Re-ran the documented working CC_HAS_ENDIAN_FLAG example using the Kconfig conf tool built with Clang on macOS. With a test helper returning y for either endian flag, the original example fails to parse; v2 executes both probes and sets CC_HAS_ENDIAN_FLAG=y for both endiannesses.
- Rebuilt the changed page alone with Sphinx, treating warnings as errors.
- The complete kernel documentation set and kernel were not built.

 Documentation/kbuild/kconfig-macro-language.rst | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/kbuild/kconfig-macro-language.rst +4 -4
index 6163467f6..c427bece3 100644
@@ -225,7 +225,7 @@ not work::
             $(MY_TYPE) "foo"
             default y
 
-Obviously from the design, $(shell command) is expanded in the textual
+Obviously from the design, $(shell,command) is expanded in the textual
 substitution phase. You cannot pass symbols to the 'shell' function.
 
 The following does not work as expected::
@@ -236,12 +236,12 @@ The following does not work as expected::
             default "-mlittle-endian" if CPU_LITTLE_ENDIAN
 
     config CC_HAS_ENDIAN_FLAG
-            def_bool $(shell $(srctree)/scripts/gcc-check-flag ENDIAN_FLAG)
+            def_bool $(shell,$(srctree)/scripts/gcc-check-flag ENDIAN_FLAG)
 
 Instead, you can do like follows so that any function call is statically
 expanded::
 
     config CC_HAS_ENDIAN_FLAG
             bool
-            default $(shell $(srctree)/scripts/gcc-check-flag -mbig-endian) if CPU_BIG_ENDIAN
-            default $(shell $(srctree)/scripts/gcc-check-flag -mlittle-endian) if CPU_LITTLE_ENDIAN
+            default $(shell,$(srctree)/scripts/gcc-check-flag -mbig-endian) if CPU_BIG_ENDIAN
+            default $(shell,$(srctree)/scripts/gcc-check-flag -mlittle-endian) if CPU_LITTLE_ENDIAN

base-commit: 4d7d9486c04d917265f64c55bd23b2cc4fe7749c

Signature · 1 line
2.50.1 (Apple Git-155)
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Erkan Erdem

Kconfig separates a function name from its arguments with a comma, but the caveats section uses Make-style whitespace in its shell calls. These expressions expand as undefined variables rather than invoking the shell function, so the supposedly working CC_HAS_ENDIAN_FLAG example fails to parse.

Quoted 7 lines

Add the missing commas to the shell calls in this section. Keep the Make examples unchanged.

Fixes 316d55d55f49 ("Documentation: kconfig: document a new Kconfig macro language")
Assisted-by LLM

---

Reviewed-by on v2 1/1
#2 lore raw
In reply to Erkan Erdem
Quoted 30 lines · Erkan Erdem

Kconfig separates a function name from its arguments with a comma, but the caveats section uses Make-style whitespace in its shell calls. These expressions expand as undefined variables rather than invoking the shell function, so the supposedly working CC_HAS_ENDIAN_FLAG example fails to parse.

Add the missing commas to the shell calls in this section. Keep the Make examples unchanged.

Fixes 316d55d55f49 ("Documentation: kconfig: document a new Kconfig macro language")
Assisted-by LLM

---

Changes in v2, addressing Julian Braha's review:
- Remove whitespace after the comma in the three remaining shell calls.

v1: https://lore.kernel.org/all/[email protected]/

The issue, patch and changelog were prepared with an AI coding assistant. The assistant also prepared the v2 revision and ran the checks below.

Validation:
- Re-ran the documented working CC_HAS_ENDIAN_FLAG example using the Kconfig conf tool built with Clang on macOS. With a test helper returning y for either endian flag, the original example fails to parse; v2 executes both probes and sets CC_HAS_ENDIAN_FLAG=y for both endiannesses.
- Rebuilt the changed page alone with Sphinx, treating warnings as errors.
- The complete kernel documentation set and kernel were not built.

Quoted 3 lines
 Documentation/kbuild/kconfig-macro-language.rst | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Thanks! I'll queue it for kbuild-fixes, but it might be defered to v7.4 if no other build relevant fix will pop-up.

Signature · 1 line
Nicolas
#3 lore raw
Quoted 31 lines · Nicolas Schier
Quoted 30 lines · Erkan Erdem

Kconfig separates a function name from its arguments with a comma, but the caveats section uses Make-style whitespace in its shell calls. These expressions expand as undefined variables rather than invoking the shell function, so the supposedly working CC_HAS_ENDIAN_FLAG example fails to parse.

Add the missing commas to the shell calls in this section. Keep the Make examples unchanged.

Fixes 316d55d55f49 ("Documentation: kconfig: document a new Kconfig macro language")
Assisted-by LLM

---

Changes in v2, addressing Julian Braha's review:
- Remove whitespace after the comma in the three remaining shell calls.

v1: https://lore.kernel.org/all/[email protected]/

The issue, patch and changelog were prepared with an AI coding assistant. The assistant also prepared the v2 revision and ran the checks below.

Validation:
- Re-ran the documented working CC_HAS_ENDIAN_FLAG example using the Kconfig conf tool built with Clang on macOS. With a test helper returning y for either endian flag, the original example fails to parse; v2 executes both probes and sets CC_HAS_ENDIAN_FLAG=y for both endiannesses.
- Rebuilt the changed page alone with Sphinx, treating warnings as errors.
- The complete kernel documentation set and kernel were not built.

Quoted 6 lines
Quoted 3 lines
 Documentation/kbuild/kconfig-macro-language.rst | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Thanks! I'll queue it for kbuild-fixes, but it might be defered to v7.4 if no other build relevant fix will pop-up.

I am not opposed to this going via -fixes but given that it is just documentation examples and there do not appear to be any problematic instances in tree, I feel like this could very reasonably go through -next. 316d55d55f49 is from 4.18, so the examples have been wrong for a long time. With that, I would probably not classify it as urgent.

Signature · 2 lines
Cheers,
Nathan
maintainer
#4 lore raw
Quoted 36 lines · Nathan Chancellor
Quoted 35 lines · Nicolas Schier
Quoted 33 lines · Erkan Erdem

Kconfig separates a function name from its arguments with a comma, but the caveats section uses Make-style whitespace in its shell calls. These expressions expand as undefined variables rather than invoking the shell function, so the supposedly working CC_HAS_ENDIAN_FLAG example fails to parse.

Add the missing commas to the shell calls in this section. Keep the Make examples unchanged.

Fixes 316d55d55f49 ("Documentation: kconfig: document a new Kconfig macro language")
Assisted-by LLM

---

Changes in v2, addressing Julian Braha's review:
- Remove whitespace after the comma in the three remaining shell calls.

v1: https://lore.kernel.org/all/[email protected]/

The issue, patch and changelog were prepared with an AI coding assistant. The assistant also prepared the v2 revision and ran the checks below.

Validation:
- Re-ran the documented working CC_HAS_ENDIAN_FLAG example using the Kconfig conf tool built with Clang on macOS. With a test helper returning y for either endian flag, the original example fails to parse; v2 executes both probes and sets CC_HAS_ENDIAN_FLAG=y for both endiannesses.
- Rebuilt the changed page alone with Sphinx, treating warnings as errors.
- The complete kernel documentation set and kernel were not built.

 Documentation/kbuild/kconfig-macro-language.rst | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Quoted 8 lines
Quoted 2 lines

Thanks! I'll queue it for kbuild-fixes, but it might be defered to v7.4 if no other build relevant fix will pop-up.

I am not opposed to this going via -fixes but given that it is just documentation examples and there do not appear to be any problematic instances in tree, I feel like this could very reasonably go through -next. 316d55d55f49 is from 4.18, so the examples have been wrong for a long time. With that, I would probably not classify it as urgent.

Ack. I remove the patch from kbuild-fixes-unstable again, thanks.

Signature · 1 line
Nicolas
#5 lore raw
In reply to Erkan Erdem
Quoted 1 line · Erkan Erdem

docs: kconfig: fix shell function syntax in caveats

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-next-unstable

Thanks!

[1/1] docs: kconfig: fix shell function syntax in caveats

      https://git.kernel.org/kbuild/c/ff87968e4e564

Please look out for regression or issue reports or other follow up comments, as they may result in the patch/series getting dropped or reverted. Patches applied to an "unstable" branch are accepted pending wider testing in -next and any post-commit review; they will generally be moved to the main branch in a week if no issues are found.

Best regards,

Signature · 2 lines
Cheers,
Nathan