All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: quote glob pattern in find command for asm-headers
@ 2026-09-13  6:49 Geliang Tang
  2026-09-14  7:08 ` Nicolas Schier
  0 siblings, 1 reply; 2+ messages in thread
From: Geliang Tang @ 2026-09-13  6:49 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Thomas Weißschuh,
	Thomas Gleixner
  Cc: Geliang Tang, linux-kbuild

From: Geliang Tang <tanggeliang@kylinos.cn>

The find command in Makefile.asm-headers uses an unquoted *.h glob
pattern inside $(shell ...):

  old-headers := $(shell test -d $(obj) && find $(obj) -name *.h)

Since $(shell ...) runs in the build output directory, the shell
expands *.h against the current directory before passing arguments
to find. When the output directory contains .h files (e.g. stale
BPF skeleton headers), this produces:

  find: paths must precede expression: `xxx.skel.h'
  find: possible unquoted pattern after predicate `-name'?

Quote the glob pattern as '*.h' so that it is passed literally to
find, which will then expand it internally against $(obj).

Fixes: 2d69b891e646 ("kbuild: Support generated asm-headers in subdirectories")
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 scripts/Makefile.asm-headers | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.asm-headers b/scripts/Makefile.asm-headers
index b38931314ad7..9db8ab0145a4 100644
--- a/scripts/Makefile.asm-headers
+++ b/scripts/Makefile.asm-headers
@@ -48,7 +48,7 @@ syscall-y   := $(addprefix $(obj)/, $(syscall-y))
 generated-y := $(addprefix $(obj)/, $(generated-y))
 
 # Remove stale wrappers when the corresponding files are removed from generic-y
-old-headers := $(shell test -d $(obj) && find $(obj) -name *.h)
+old-headers := $(shell test -d $(obj) && find $(obj) -name '*.h')
 unwanted    := $(filter-out $(generic-y) $(generated-y) $(syscall-y),$(old-headers))
 
 filechk_wrap = echo "\#include <asm-generic/$*.h>"
-- 
2.53.0


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

* Re: [PATCH] kbuild: quote glob pattern in find command for asm-headers
  2026-09-13  6:49 [PATCH] kbuild: quote glob pattern in find command for asm-headers Geliang Tang
@ 2026-09-14  7:08 ` Nicolas Schier
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Schier @ 2026-09-14  7:08 UTC (permalink / raw)
  To: Geliang Tang
  Cc: Nathan Chancellor, Thomas Weißschuh, Thomas Gleixner,
	Geliang Tang, linux-kbuild

On Sun, Sep 13, 2026 at 02:49:14PM +0800, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> The find command in Makefile.asm-headers uses an unquoted *.h glob
> pattern inside $(shell ...):
> 
>   old-headers := $(shell test -d $(obj) && find $(obj) -name *.h)
> 
> Since $(shell ...) runs in the build output directory, the shell
> expands *.h against the current directory before passing arguments
> to find. When the output directory contains .h files (e.g. stale
> BPF skeleton headers), this produces:
> 
>   find: paths must precede expression: `xxx.skel.h'
>   find: possible unquoted pattern after predicate `-name'?
> 
> Quote the glob pattern as '*.h' so that it is passed literally to
> find, which will then expand it internally against $(obj).
> 
> Fixes: 2d69b891e646 ("kbuild: Support generated asm-headers in subdirectories")
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  scripts/Makefile.asm-headers | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/Makefile.asm-headers b/scripts/Makefile.asm-headers
> index b38931314ad7..9db8ab0145a4 100644
> --- a/scripts/Makefile.asm-headers
> +++ b/scripts/Makefile.asm-headers
> @@ -48,7 +48,7 @@ syscall-y   := $(addprefix $(obj)/, $(syscall-y))
>  generated-y := $(addprefix $(obj)/, $(generated-y))
>  
>  # Remove stale wrappers when the corresponding files are removed from generic-y
> -old-headers := $(shell test -d $(obj) && find $(obj) -name *.h)
> +old-headers := $(shell test -d $(obj) && find $(obj) -name '*.h')
>  unwanted    := $(filter-out $(generic-y) $(generated-y) $(syscall-y),$(old-headers))
>  
>  filechk_wrap = echo "\#include <asm-generic/$*.h>"
> -- 
> 2.53.0
> 

Thanks.  This is fixed by [1], released in v7.3-rc3 a few hours after
your mail.

Kind regards,
Nicolas

[1]: https://git.kernel.org/kbuild/c/06bb43d8c79762fa3452f292cd080e54bef5d431

-- 
Nicolas

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

end of thread, other threads:[~2026-09-14  7:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-13  6:49 [PATCH] kbuild: quote glob pattern in find command for asm-headers Geliang Tang
2026-09-14  7:08 ` Nicolas Schier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.