linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: Remove example file on dt-extract-example error
@ 2022-05-10 22:13 Rob Herring
  2022-05-11  0:27 ` Masahiro Yamada
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2022-05-10 22:13 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Masahiro Yamada, devicetree, linux-kernel

As 'dt-extract-example' writes the example dts files to stdout, a file
is always created even on an error such as Ctrl-C. The resulting empty
file(s) then cause unexpected errors on subsequent builds. Fix this by
removing the output file on any error.

Signed-off-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile
index c9953f86b19d..c9fadff3dd74 100644
--- a/Documentation/devicetree/bindings/Makefile
+++ b/Documentation/devicetree/bindings/Makefile
@@ -20,7 +20,7 @@ check_dtschema_version:
 	{ echo "ERROR: dtschema minimum version is v$(DT_SCHEMA_MIN_VERSION)" >&2; false; }
 
 quiet_cmd_extract_ex = DTEX    $@
-      cmd_extract_ex = $(DT_EXTRACT_EX) $< > $@
+      cmd_extract_ex = $(DT_EXTRACT_EX) $< > $@ || rm $@
 
 $(obj)/%.example.dts: $(src)/%.yaml check_dtschema_version FORCE
 	$(call if_changed,extract_ex)
-- 
2.34.1


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

* Re: [PATCH] dt-bindings: Remove example file on dt-extract-example error
  2022-05-10 22:13 [PATCH] dt-bindings: Remove example file on dt-extract-example error Rob Herring
@ 2022-05-11  0:27 ` Masahiro Yamada
  2022-05-17  1:12   ` Rob Herring
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2022-05-11  0:27 UTC (permalink / raw)
  To: Rob Herring; +Cc: Krzysztof Kozlowski, DTML, Linux Kernel Mailing List

On Wed, May 11, 2022 at 7:13 AM Rob Herring <robh@kernel.org> wrote:
>
> As 'dt-extract-example' writes the example dts files to stdout, a file
> is always created even on an error such as Ctrl-C. The resulting empty
> file(s) then cause unexpected errors on subsequent builds. Fix this by
> removing the output file on any error.
>


Did you really set it?


The target deletion on interrupt is automatic
since the following commit:



commit 9c2af1c7377a8a6ef86e5cabf80978f3dbbb25c0
Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Date:   Fri Jul 20 16:46:33 2018 +0900

    kbuild: add .DELETE_ON_ERROR special target









> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  Documentation/devicetree/bindings/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile
> index c9953f86b19d..c9fadff3dd74 100644
> --- a/Documentation/devicetree/bindings/Makefile
> +++ b/Documentation/devicetree/bindings/Makefile
> @@ -20,7 +20,7 @@ check_dtschema_version:
>         { echo "ERROR: dtschema minimum version is v$(DT_SCHEMA_MIN_VERSION)" >&2; false; }
>
>  quiet_cmd_extract_ex = DTEX    $@
> -      cmd_extract_ex = $(DT_EXTRACT_EX) $< > $@
> +      cmd_extract_ex = $(DT_EXTRACT_EX) $< > $@ || rm $@
>
>  $(obj)/%.example.dts: $(src)/%.yaml check_dtschema_version FORCE
>         $(call if_changed,extract_ex)
> --
> 2.34.1
>


-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH] dt-bindings: Remove example file on dt-extract-example error
  2022-05-11  0:27 ` Masahiro Yamada
@ 2022-05-17  1:12   ` Rob Herring
  2022-05-17  3:02     ` Masahiro Yamada
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2022-05-17  1:12 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Krzysztof Kozlowski, DTML, Linux Kernel Mailing List

On Wed, May 11, 2022 at 09:27:00AM +0900, Masahiro Yamada wrote:
> On Wed, May 11, 2022 at 7:13 AM Rob Herring <robh@kernel.org> wrote:
> >
> > As 'dt-extract-example' writes the example dts files to stdout, a file
> > is always created even on an error such as Ctrl-C. The resulting empty
> > file(s) then cause unexpected errors on subsequent builds. Fix this by
> > removing the output file on any error.
> >
> 
> 
> Did you really set it?

Set what?

I'm sure I've gotten empty files which then throw errors on the next 
run.

> The target deletion on interrupt is automatic
> since the following commit:
> 
> 
> 
> commit 9c2af1c7377a8a6ef86e5cabf80978f3dbbb25c0
> Author: Masahiro Yamada <yamada.masahiro@socionext.com>
> Date:   Fri Jul 20 16:46:33 2018 +0900
> 
>     kbuild: add .DELETE_ON_ERROR special target

You're saying I shouldn't need this change? For some reason I do...

Rob

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

* Re: [PATCH] dt-bindings: Remove example file on dt-extract-example error
  2022-05-17  1:12   ` Rob Herring
@ 2022-05-17  3:02     ` Masahiro Yamada
  2022-05-17 13:38       ` Rob Herring
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2022-05-17  3:02 UTC (permalink / raw)
  To: Rob Herring; +Cc: Krzysztof Kozlowski, DTML, Linux Kernel Mailing List

On Tue, May 17, 2022 at 10:12 AM Rob Herring <robh@kernel.org> wrote:
>
> On Wed, May 11, 2022 at 09:27:00AM +0900, Masahiro Yamada wrote:
> > On Wed, May 11, 2022 at 7:13 AM Rob Herring <robh@kernel.org> wrote:
> > >
> > > As 'dt-extract-example' writes the example dts files to stdout, a file
> > > is always created even on an error such as Ctrl-C. The resulting empty
> > > file(s) then cause unexpected errors on subsequent builds. Fix this by
> > > removing the output file on any error.
> > >
> >
> >
> > Did you really set it?
>
> Set what?

Sorry for the typo.   I meant "Did you really see it?"


>
> I'm sure I've gotten empty files which then throw errors on the next
> run.


Hmm, OK.

When you observed this issue, were you using
a pipe to another program?

For example,

  $  make  dt_binding_check  2>&1  |  tee  dt_binding_check.log





> > The target deletion on interrupt is automatic
> > since the following commit:
> >
> >
> >
> > commit 9c2af1c7377a8a6ef86e5cabf80978f3dbbb25c0
> > Author: Masahiro Yamada <yamada.masahiro@socionext.com>
> > Date:   Fri Jul 20 16:46:33 2018 +0900
> >
> >     kbuild: add .DELETE_ON_ERROR special target
>
> You're saying I shouldn't need this change? For some reason I do...
>
> Rob


If .DELETE_ON_ERROR works as the manual [1] explains,

[1] https://www.gnu.org/software/make/manual/make.html#Special-Targets

the deletion of the target is automatic.


Basically, it worked like that, except when Make is piped to another program.

I asked this in GNU Make ML before.

When Make is piped to another program, which is terminated by Ctrl-C,
Make is also killed by SIGPIPE before cleaning up the incomplete targets.



-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH] dt-bindings: Remove example file on dt-extract-example error
  2022-05-17  3:02     ` Masahiro Yamada
@ 2022-05-17 13:38       ` Rob Herring
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2022-05-17 13:38 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Krzysztof Kozlowski, DTML, Linux Kernel Mailing List

On Mon, May 16, 2022 at 10:03 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Tue, May 17, 2022 at 10:12 AM Rob Herring <robh@kernel.org> wrote:
> >
> > On Wed, May 11, 2022 at 09:27:00AM +0900, Masahiro Yamada wrote:
> > > On Wed, May 11, 2022 at 7:13 AM Rob Herring <robh@kernel.org> wrote:
> > > >
> > > > As 'dt-extract-example' writes the example dts files to stdout, a file
> > > > is always created even on an error such as Ctrl-C. The resulting empty
> > > > file(s) then cause unexpected errors on subsequent builds. Fix this by
> > > > removing the output file on any error.
> > > >
> > >
> > >
> > > Did you really set it?
> >
> > Set what?
>
> Sorry for the typo.   I meant "Did you really see it?"
>
>
> >
> > I'm sure I've gotten empty files which then throw errors on the next
> > run.
>
>
> Hmm, OK.
>
> When you observed this issue, were you using
> a pipe to another program?
>
> For example,
>
>   $  make  dt_binding_check  2>&1  |  tee  dt_binding_check.log
>

Indeed, I am. I only do that all the time in my build script...

>
> > > The target deletion on interrupt is automatic
> > > since the following commit:
> > >
> > >
> > >
> > > commit 9c2af1c7377a8a6ef86e5cabf80978f3dbbb25c0
> > > Author: Masahiro Yamada <yamada.masahiro@socionext.com>
> > > Date:   Fri Jul 20 16:46:33 2018 +0900
> > >
> > >     kbuild: add .DELETE_ON_ERROR special target
> >
> > You're saying I shouldn't need this change? For some reason I do...
> >
> > Rob
>
>
> If .DELETE_ON_ERROR works as the manual [1] explains,
>
> [1] https://www.gnu.org/software/make/manual/make.html#Special-Targets
>
> the deletion of the target is automatic.
>
>
> Basically, it worked like that, except when Make is piped to another program.
>
> I asked this in GNU Make ML before.
>
> When Make is piped to another program, which is terminated by Ctrl-C,
> Make is also killed by SIGPIPE before cleaning up the incomplete targets.

Humm, that seems to make the feature less useful to rely on.

Rob

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

end of thread, other threads:[~2022-05-17 13:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 22:13 [PATCH] dt-bindings: Remove example file on dt-extract-example error Rob Herring
2022-05-11  0:27 ` Masahiro Yamada
2022-05-17  1:12   ` Rob Herring
2022-05-17  3:02     ` Masahiro Yamada
2022-05-17 13:38       ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).