mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] docs: kconfig: fix shell function syntax in caveats
@ 2026-09-07 10:37 Erkan Erdem
  2026-09-07 20:52 ` Julian Braha
  2026-09-15 10:59 ` Nicolas Schier
  0 siblings, 2 replies; 4+ messages in thread
From: Erkan Erdem @ 2026-09-07 10:37 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: Erkan Erdem, Julian Braha, linux-kbuild, linux-kernel,
	Jonathan Corbet, Shuah Khan, Randy Dunlap, linux-doc,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Kees Cook,
	Masahiro Yamada, llvm

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>
---

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/20260905124045.42713-1-hexvalid@gmail.com/

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(-)

diff --git a/Documentation/kbuild/kconfig-macro-language.rst b/Documentation/kbuild/kconfig-macro-language.rst
index 6163467f6..c427bece3 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] 4+ messages in thread

* Re: [PATCH v2] docs: kconfig: fix shell function syntax in caveats
  2026-09-07 10:37 [PATCH v2] docs: kconfig: fix shell function syntax in caveats Erkan Erdem
@ 2026-09-07 20:52 ` Julian Braha
  2026-09-15 10:59 ` Nicolas Schier
  1 sibling, 0 replies; 4+ messages in thread
From: Julian Braha @ 2026-09-07 20:52 UTC (permalink / raw)
  To: Erkan Erdem, Nathan Chancellor, Nicolas Schier
  Cc: linux-kbuild, linux-kernel, Jonathan Corbet, Shuah Khan,
	Randy Dunlap, linux-doc, Nick Desaulniers, Bill Wendling,
	Justin Stitt, Kees Cook, Masahiro Yamada, llvm

On 9/7/26 11:37, 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>
> ---
Reviewed-by: Julian Braha <julianbraha@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] docs: kconfig: fix shell function syntax in caveats
  2026-09-07 10:37 [PATCH v2] docs: kconfig: fix shell function syntax in caveats Erkan Erdem
  2026-09-07 20:52 ` Julian Braha
@ 2026-09-15 10:59 ` Nicolas Schier
  2026-09-15 22:02   ` Nathan Chancellor
  1 sibling, 1 reply; 4+ messages in thread
From: Nicolas Schier @ 2026-09-15 10:59 UTC (permalink / raw)
  To: Erkan Erdem
  Cc: Nathan Chancellor, Julian Braha, linux-kbuild, linux-kernel,
	Jonathan Corbet, Shuah Khan, Randy Dunlap, linux-doc,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Kees Cook,
	Masahiro Yamada, llvm

On Mon, Sep 07, 2026 at 01:37:37PM +0300, 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>
> ---
> 
> 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/20260905124045.42713-1-hexvalid@gmail.com/
> 
> 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(-)
> 

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.

Reviewed-by: Nicolas Schier <n.schier@fritz.com>

-- 
Nicolas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] docs: kconfig: fix shell function syntax in caveats
  2026-09-15 10:59 ` Nicolas Schier
@ 2026-09-15 22:02   ` Nathan Chancellor
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2026-09-15 22:02 UTC (permalink / raw)
  To: Nicolas Schier
  Cc: Erkan Erdem, Julian Braha, linux-kbuild, linux-kernel,
	Jonathan Corbet, Shuah Khan, Randy Dunlap, linux-doc,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Kees Cook,
	Masahiro Yamada, llvm

On Tue, Sep 15, 2026 at 12:59:40PM +0200, Nicolas Schier wrote:
> On Mon, Sep 07, 2026 at 01:37:37PM +0300, 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>
> > ---
> > 
> > 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/20260905124045.42713-1-hexvalid@gmail.com/
> > 
> > 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(-)
> > 
> 
> 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.

-- 
Cheers,
Nathan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-15 22:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-07 10:37 [PATCH v2] docs: kconfig: fix shell function syntax in caveats Erkan Erdem
2026-09-07 20:52 ` Julian Braha
2026-09-15 10:59 ` Nicolas Schier
2026-09-15 22:02   ` Nathan Chancellor

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®