* [PATCH] docs: kconfig: fix shell function syntax in caveats
@ 2026-09-05 12:40 Erkan Erdem
2026-09-05 15:03 ` Julian Braha
0 siblings, 1 reply; 2+ messages in thread
From: Erkan Erdem @ 2026-09-05 12:40 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: Erkan Erdem, Julian Braha, Jonathan Corbet, Shuah Khan,
Randy Dunlap, linux-kbuild, linux-doc, linux-kernel
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
Signed-off-by: Erkan Erdem <hexvalid@gmail.com>
---
The issue was found and this patch and changelog were prepared with an AI
coding assistant after a request to find a small, verifiable Linux fix.
The assistant also prepared and ran the verification described below.
Validation:
- Built the current Kconfig conf tool on macOS with Clang, Bison and Flex,
using -Wall -Wmissing-prototypes -Wstrict-prototypes -Werror.
- Extracted the documented working CC_HAS_ENDIAN_FLAG example into a
minimal Kconfig, with a test gcc-check-flag helper returning y for either
endian flag. Before: syntax errors and no helper invocations for either
CPU endianness. After: both probes execute and CC_HAS_ENDIAN_FLAG=y.
- Built 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(-)
diff --git a/Documentation/kbuild/kconfig-macro-language.rst b/Documentation/kbuild/kconfig-macro-language.rst
index 6163467f..e15af278 100644
--- a/Documentation/kbuild/kconfig-macro-language.rst
+++ b/Documentation/kbuild/kconfig-macro-language.rst
@@ -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
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] docs: kconfig: fix shell function syntax in caveats
2026-09-05 12:40 [PATCH] docs: kconfig: fix shell function syntax in caveats Erkan Erdem
@ 2026-09-05 15:03 ` Julian Braha
0 siblings, 0 replies; 2+ messages in thread
From: Julian Braha @ 2026-09-05 15:03 UTC (permalink / raw)
To: Erkan Erdem, Nathan Chancellor, Nicolas Schier
Cc: Jonathan Corbet, Shuah Khan, Randy Dunlap, linux-kbuild,
linux-doc, linux-kernel
Hi Erkan,
Thanks for the patch!
On 9/5/26 13:40, Erkan Erdem wrote:
> 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
> Signed-off-by: Erkan Erdem <hexvalid@gmail.com>
> ---
>
> The issue was found and this patch and changelog were prepared with an AI
> coding assistant after a request to find a small, verifiable Linux fix.
> The assistant also prepared and ran the verification described below.
>
> Validation:
> - Built the current Kconfig conf tool on macOS with Clang, Bison and Flex,
> using -Wall -Wmissing-prototypes -Wstrict-prototypes -Werror.
> - Extracted the documented working CC_HAS_ENDIAN_FLAG example into a
> minimal Kconfig, with a test gcc-check-flag helper returning y for either
> endian flag. Before: syntax errors and no helper invocations for either
> CPU endianness. After: both probes execute and CC_HAS_ENDIAN_FLAG=y.
> - Built 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(-)
>
> diff --git a/Documentation/kbuild/kconfig-macro-language.rst b/Documentation/kbuild/kconfig-macro-language.rst
> index 6163467f..e15af278 100644
> --- a/Documentation/kbuild/kconfig-macro-language.rst
> +++ b/Documentation/kbuild/kconfig-macro-language.rst
> @@ -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)
Here, the space after the comma is actually included in the argument.
Checking the tree, I found 20 instances of this, but none of them use
whitespace after the comma. It may be harmless in most (all?) cases, but
we probably want to exclude it when documenting ideal usage, anyway.
I think you got it right in your earlier '$(shell,command)' example.
>
> 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
Same thing here.
- Julian Braha
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-05 15:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-05 12:40 [PATCH] docs: kconfig: fix shell function syntax in caveats Erkan Erdem
2026-09-05 15:03 ` Julian Braha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®