[PATCH] kbuild: fix spurious error from find when generating asm-headers

H. Nikolaus Schaller posted 1 patch 1 week, 4 days ago
scripts/Makefile.asm-headers | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] kbuild: fix spurious error from find when generating asm-headers
Posted by H. Nikolaus Schaller 1 week, 4 days ago
The *.h pattern should be quoted or we may see errors like

  find: paths must precede expression: elf.h
  Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

if the working directory contains some *.h files.

This was found in a cross-compilation environment.

Fixes: 2d69b891e6461 ("kbuild: Support generated asm-headers in subdirectories")
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 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 b38931314ad7c..9db8ab0145a44 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.55.0
Re: [PATCH] kbuild: fix spurious error from find when generating asm-headers
Posted by Randy Dunlap 1 week, 4 days ago
Hi,

On 9/13/26 1:07 PM, H. Nikolaus Schaller wrote:
> The *.h pattern should be quoted or we may see errors like
> 
>   find: paths must precede expression: elf.h
>   Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
> 
> if the working directory contains some *.h files.
> 
> This was found in a cross-compilation environment.
> 
> Fixes: 2d69b891e6461 ("kbuild: Support generated asm-headers in subdirectories")
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
>  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 b38931314ad7c..9db8ab0145a44 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>"

Same as this other patch from 13 hours earlier:

https://lore.kernel.org/linux-kbuild/f54cae8e7da612ad558154706ce2e99f98d136c4.1789282037.git.tanggeliang@kylinos.cn/T/#u

-- 
~Randy
Re: [PATCH] kbuild: fix spurious error from find when generating asm-headers
Posted by H. Nikolaus Schaller 1 week, 4 days ago
Indeed!

> Am 14.09.2026 um 00:39 schrieb Randy Dunlap <rdunlap@infradead.org>:
> 
> Hi,
> 
> On 9/13/26 1:07 PM, H. Nikolaus Schaller wrote:
>> The *.h pattern should be quoted or we may see errors like
>> 
>>  find: paths must precede expression: elf.h
>>  Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
>> 
>> if the working directory contains some *.h files.
>> 
>> This was found in a cross-compilation environment.
>> 
>> Fixes: 2d69b891e6461 ("kbuild: Support generated asm-headers in subdirectories")
>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
>> ---
>> 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 b38931314ad7c..9db8ab0145a44 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>"
> 
> Same as this other patch from 13 hours earlier:
> 
> https://lore.kernel.org/linux-kbuild/f54cae8e7da612ad558154706ce2e99f98d136c4.1789282037.git.tanggeliang@kylinos.cn/T/#u


Anyways, thanks for having it fixed.

BR,
Nikolaus