diff mbox series

[1/4] dt-bindings: fix error in 'make clean' after 'make dt_binding_check'

Message ID 20200625170434.635114-2-masahiroy@kernel.org
State Accepted, archived
Headers show
Series dt-bindings: fix 'make clean' and improve dt-schema check rules | expand

Checks

Context Check Description
robh/checkpatch warning total: 0 errors, 2 warnings, 8 lines checked

Commit Message

Masahiro Yamada June 25, 2020, 5:04 p.m. UTC
We are having more and more schema files.

Commit 8b6b80218b01 ("dt-bindings: Fix command line length limit
calling dt-mk-schema") fixed the 'Argument list too long' error of
the schema checks, but the same error happens while cleaning too.

'make clean' after 'make dt_binding_check' fails as follows:

  $ make dt_binding_check
    [ snip ]
  $ make clean
  make[2]: execvp: /bin/sh: Argument list too long
  make[2]: *** [scripts/Makefile.clean:52: __clean] Error 127
  make[1]: *** [scripts/Makefile.clean:66: Documentation/devicetree/bindings] Error 2
  make: *** [Makefile:1763: _clean_Documentation] Error 2

'make dt_binding_check' generates so many .example.dts, .dt.yaml files,
which are passed to the 'rm' command when you run 'make clean'.

I added a small hack to use the 'find' command to clean up most of the
build artifacts before they are processed by scripts/Makefile.clean

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 Documentation/devicetree/bindings/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Rob Herring June 29, 2020, 9:24 p.m. UTC | #1
On Fri, 26 Jun 2020 02:04:31 +0900, Masahiro Yamada wrote:
> We are having more and more schema files.
> 
> Commit 8b6b80218b01 ("dt-bindings: Fix command line length limit
> calling dt-mk-schema") fixed the 'Argument list too long' error of
> the schema checks, but the same error happens while cleaning too.
> 
> 'make clean' after 'make dt_binding_check' fails as follows:
> 
>   $ make dt_binding_check
>     [ snip ]
>   $ make clean
>   make[2]: execvp: /bin/sh: Argument list too long
>   make[2]: *** [scripts/Makefile.clean:52: __clean] Error 127
>   make[1]: *** [scripts/Makefile.clean:66: Documentation/devicetree/bindings] Error 2
>   make: *** [Makefile:1763: _clean_Documentation] Error 2
> 
> 'make dt_binding_check' generates so many .example.dts, .dt.yaml files,
> which are passed to the 'rm' command when you run 'make clean'.
> 
> I added a small hack to use the 'find' command to clean up most of the
> build artifacts before they are processed by scripts/Makefile.clean
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  Documentation/devicetree/bindings/Makefile | 5 +++++
>  1 file changed, 5 insertions(+)
> 

Applied, thanks!
Eugeniu Rosca June 16, 2023, 7:45 p.m. UTC | #2
Dear Yamada-san,
Dear Kbuild experts,

On Fri, Jun 26, 2020 at 02:04:31AM +0900, Masahiro Yamada wrote:
> We are having more and more schema files.
> 
> Commit 8b6b80218b01 ("dt-bindings: Fix command line length limit
> calling dt-mk-schema") fixed the 'Argument list too long' error of
> the schema checks, but the same error happens while cleaning too.
> 
> 'make clean' after 'make dt_binding_check' fails as follows:
> 
>   $ make dt_binding_check
>     [ snip ]
>   $ make clean
>   make[2]: execvp: /bin/sh: Argument list too long
>   make[2]: *** [scripts/Makefile.clean:52: __clean] Error 127
>   make[1]: *** [scripts/Makefile.clean:66: Documentation/devicetree/bindings] Error 2
>   make: *** [Makefile:1763: _clean_Documentation] Error 2
> 
> 'make dt_binding_check' generates so many .example.dts, .dt.yaml files,
> which are passed to the 'rm' command when you run 'make clean'.
> 
> I added a small hack to use the 'find' command to clean up most of the
> build artifacts before they are processed by scripts/Makefile.clean
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  Documentation/devicetree/bindings/Makefile | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile
> index a63898954068..f20d234aec46 100644
> --- a/Documentation/devicetree/bindings/Makefile
> +++ b/Documentation/devicetree/bindings/Makefile
> @@ -53,3 +53,8 @@ $(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) check_dtschema_version FORCE
>  	$(call if_changed,mk_schema)
>  
>  extra-y += processed-schema.yaml
> +
> +# Hack: avoid 'Argument list too long' error for 'make clean'. Remove most of
> +# build artifacts here before they are processed by scripts/Makefile.clean
> +clean-files = $(shell find $(obj) \( -name '*.example.dts' -o \
> +			-name '*.example.dt.yaml' \) -delete 2>/dev/null)

JFYI, we are running into the "Argument list too long" simply by trying to
clean an out-of-tree module (with lots of artifacts though), as below.
Seems to be happening on vanilla (v6.4-rc6-199-gb73056e9f82ebd) too.
Just in case there are any known hacks (or similar reports), please let us know.

$ make -C /data/linux-src M=my_module clean

make: Entering directory '/data/linux-src'
make -f ./scripts/Makefile.clean obj=my_module
set -e;  echo '  CLEAN   my_module';  rm -rf [~1k filenames / 200k char]
make[1]: /bin/sh: Argument list too long
make[1]: *** [scripts/Makefile.clean:45: __clean] Error 127
Masahiro Yamada June 17, 2023, 6:09 p.m. UTC | #3
On Sat, Jun 17, 2023 at 4:45 AM Eugeniu Rosca <erosca@de.adit-jv.com> wrote:
>
> Dear Yamada-san,
> Dear Kbuild experts,
>
> On Fri, Jun 26, 2020 at 02:04:31AM +0900, Masahiro Yamada wrote:
> > We are having more and more schema files.
> >
> > Commit 8b6b80218b01 ("dt-bindings: Fix command line length limit
> > calling dt-mk-schema") fixed the 'Argument list too long' error of
> > the schema checks, but the same error happens while cleaning too.
> >
> > 'make clean' after 'make dt_binding_check' fails as follows:
> >
> >   $ make dt_binding_check
> >     [ snip ]
> >   $ make clean
> >   make[2]: execvp: /bin/sh: Argument list too long
> >   make[2]: *** [scripts/Makefile.clean:52: __clean] Error 127
> >   make[1]: *** [scripts/Makefile.clean:66: Documentation/devicetree/bindings] Error 2
> >   make: *** [Makefile:1763: _clean_Documentation] Error 2
> >
> > 'make dt_binding_check' generates so many .example.dts, .dt.yaml files,
> > which are passed to the 'rm' command when you run 'make clean'.
> >
> > I added a small hack to use the 'find' command to clean up most of the
> > build artifacts before they are processed by scripts/Makefile.clean
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> >  Documentation/devicetree/bindings/Makefile | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile
> > index a63898954068..f20d234aec46 100644
> > --- a/Documentation/devicetree/bindings/Makefile
> > +++ b/Documentation/devicetree/bindings/Makefile
> > @@ -53,3 +53,8 @@ $(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) check_dtschema_version FORCE
> >       $(call if_changed,mk_schema)
> >
> >  extra-y += processed-schema.yaml
> > +
> > +# Hack: avoid 'Argument list too long' error for 'make clean'. Remove most of
> > +# build artifacts here before they are processed by scripts/Makefile.clean
> > +clean-files = $(shell find $(obj) \( -name '*.example.dts' -o \
> > +                     -name '*.example.dt.yaml' \) -delete 2>/dev/null)
>
> JFYI, we are running into the "Argument list too long" simply by trying to
> clean an out-of-tree module (with lots of artifacts though), as below.
> Seems to be happening on vanilla (v6.4-rc6-199-gb73056e9f82ebd) too.
> Just in case there are any known hacks (or similar reports), please let us know.
>
> $ make -C /data/linux-src M=my_module clean
>
> make: Entering directory '/data/linux-src'
> make -f ./scripts/Makefile.clean obj=my_module
> set -e;  echo '  CLEAN   my_module';  rm -rf [~1k filenames / 200k char]
> make[1]: /bin/sh: Argument list too long
> make[1]: *** [scripts/Makefile.clean:45: __clean] Error 127


I sumitted a patch
https://patchwork.kernel.org/project/linux-kbuild/patch/20230617153025.1653851-1-masahiroy@kernel.org/

I do not know whether it will solve your problem or not.

Your module Makefile has ~1k files to remove.

It may still exceed ARG_MAX limit.




> --
> Best regards,
> Eugeniu Rosca
Eugeniu Rosca June 19, 2023, 9:27 a.m. UTC | #4
Hello Yamada-san,

On Sun, Jun 18, 2023 at 03:09:56AM +0900, Masahiro Yamada wrote:

[snip]

> I sumitted a patch
> https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.kernel.org_project_linux-2Dkbuild_patch_20230617153025.1653851-2D1-2Dmasahiroy-40kernel.org_&d=DwIFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=SAhjP5GOmrADp1v_EE5jWoSuMlYCIt9gKduw-DCBPLs&m=_gWZwnUVw05obX2g0v2G-rIQlozQoBMXSi-pktMqVpo&s=L4Kw5qaiY1cU27bKrjQce8uJhLXdeiQ96IyX7l6Ki3o&e=

Thank you very much. Provided my comments in the new thread.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile
index a63898954068..f20d234aec46 100644
--- a/Documentation/devicetree/bindings/Makefile
+++ b/Documentation/devicetree/bindings/Makefile
@@ -53,3 +53,8 @@  $(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) check_dtschema_version FORCE
 	$(call if_changed,mk_schema)
 
 extra-y += processed-schema.yaml
+
+# Hack: avoid 'Argument list too long' error for 'make clean'. Remove most of
+# build artifacts here before they are processed by scripts/Makefile.clean
+clean-files = $(shell find $(obj) \( -name '*.example.dts' -o \
+			-name '*.example.dt.yaml' \) -delete 2>/dev/null)