* [PATCH bpf-next v2] scripts/bpf: Print an error when known types list needs updating
@ 2019-10-20 11:23 Jakub Sitnicki
2019-10-21 0:34 ` Yonghong Song
2019-10-21 0:51 ` Andrii Nakryiko
0 siblings, 2 replies; 4+ messages in thread
From: Jakub Sitnicki @ 2019-10-20 11:23 UTC (permalink / raw)
To: bpf; +Cc: netdev, kernel-team, Andrii Nakryiko
Don't generate a broken bpf_helper_defs.h header if the helper script needs
updating because it doesn't recognize a newly added type. Instead print an
error that explains why the build is failing, clean up the partially
generated header and stop.
v1->v2:
- Switched from temporary file to .DELETE_ON_ERROR.
Fixes: 456a513bb5d4 ("scripts/bpf: Emit an #error directive known types list needs updating")
Suggested-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
---
scripts/bpf_helpers_doc.py | 4 ++--
tools/lib/bpf/Makefile | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/scripts/bpf_helpers_doc.py b/scripts/bpf_helpers_doc.py
index 08300bc024da..7548569e8076 100755
--- a/scripts/bpf_helpers_doc.py
+++ b/scripts/bpf_helpers_doc.py
@@ -488,8 +488,8 @@ class PrinterHelpers(Printer):
return t
if t in self.mapped_types:
return self.mapped_types[t]
- print("")
- print("#error \"Unrecognized type '%s', please add it to known types!\"" % t)
+ print("Unrecognized type '%s', please add it to known types!" % t,
+ file=sys.stderr)
sys.exit(1)
seen_helpers = set()
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 75b538577c17..54ff80faa8df 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -286,3 +286,6 @@ tags:
# Declare the contents of the .PHONY variable as phony. We keep that
# information in a variable so we can use it in if_changed and friends.
.PHONY: $(PHONY)
+
+# Delete partially updated (corrupted) files on error
+.DELETE_ON_ERROR:
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next v2] scripts/bpf: Print an error when known types list needs updating
2019-10-20 11:23 [PATCH bpf-next v2] scripts/bpf: Print an error when known types list needs updating Jakub Sitnicki
@ 2019-10-21 0:34 ` Yonghong Song
2019-10-21 0:51 ` Andrii Nakryiko
1 sibling, 0 replies; 4+ messages in thread
From: Yonghong Song @ 2019-10-21 0:34 UTC (permalink / raw)
To: Jakub Sitnicki, bpf; +Cc: netdev, kernel-team, Andrii Nakryiko
On 10/20/19 4:23 AM, Jakub Sitnicki wrote:
> Don't generate a broken bpf_helper_defs.h header if the helper script needs
> updating because it doesn't recognize a newly added type. Instead print an
> error that explains why the build is failing, clean up the partially
> generated header and stop.
>
> v1->v2:
> - Switched from temporary file to .DELETE_ON_ERROR.
>
> Fixes: 456a513bb5d4 ("scripts/bpf: Emit an #error directive known types list needs updating")
> Suggested-by: Andrii Nakryiko <andriin@fb.com>
> Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Acked-by: Yonghong Song <yhs@fb.com>
> ---
> scripts/bpf_helpers_doc.py | 4 ++--
> tools/lib/bpf/Makefile | 3 +++
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/bpf_helpers_doc.py b/scripts/bpf_helpers_doc.py
> index 08300bc024da..7548569e8076 100755
> --- a/scripts/bpf_helpers_doc.py
> +++ b/scripts/bpf_helpers_doc.py
> @@ -488,8 +488,8 @@ class PrinterHelpers(Printer):
> return t
> if t in self.mapped_types:
> return self.mapped_types[t]
> - print("")
> - print("#error \"Unrecognized type '%s', please add it to known types!\"" % t)
> + print("Unrecognized type '%s', please add it to known types!" % t,
> + file=sys.stderr)
> sys.exit(1)
>
> seen_helpers = set()
> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index 75b538577c17..54ff80faa8df 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile
> @@ -286,3 +286,6 @@ tags:
> # Declare the contents of the .PHONY variable as phony. We keep that
> # information in a variable so we can use it in if_changed and friends.
> .PHONY: $(PHONY)
> +
> +# Delete partially updated (corrupted) files on error
> +.DELETE_ON_ERROR:
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next v2] scripts/bpf: Print an error when known types list needs updating
2019-10-20 11:23 [PATCH bpf-next v2] scripts/bpf: Print an error when known types list needs updating Jakub Sitnicki
2019-10-21 0:34 ` Yonghong Song
@ 2019-10-21 0:51 ` Andrii Nakryiko
2019-10-21 1:22 ` Alexei Starovoitov
1 sibling, 1 reply; 4+ messages in thread
From: Andrii Nakryiko @ 2019-10-21 0:51 UTC (permalink / raw)
To: Jakub Sitnicki; +Cc: bpf, Networking, kernel-team, Andrii Nakryiko
On Sun, Oct 20, 2019 at 4:24 AM Jakub Sitnicki <jakub@cloudflare.com> wrote:
>
> Don't generate a broken bpf_helper_defs.h header if the helper script needs
> updating because it doesn't recognize a newly added type. Instead print an
> error that explains why the build is failing, clean up the partially
> generated header and stop.
>
> v1->v2:
> - Switched from temporary file to .DELETE_ON_ERROR.
>
> Fixes: 456a513bb5d4 ("scripts/bpf: Emit an #error directive known types list needs updating")
> Suggested-by: Andrii Nakryiko <andriin@fb.com>
> Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
> ---
LGTM, thanks!
Acked-by: Andrii Nakryiko <andriin@fb.com>
> scripts/bpf_helpers_doc.py | 4 ++--
> tools/lib/bpf/Makefile | 3 +++
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
[...]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next v2] scripts/bpf: Print an error when known types list needs updating
2019-10-21 0:51 ` Andrii Nakryiko
@ 2019-10-21 1:22 ` Alexei Starovoitov
0 siblings, 0 replies; 4+ messages in thread
From: Alexei Starovoitov @ 2019-10-21 1:22 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: Jakub Sitnicki, bpf, Networking, kernel-team, Andrii Nakryiko
On Sun, Oct 20, 2019 at 5:52 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Sun, Oct 20, 2019 at 4:24 AM Jakub Sitnicki <jakub@cloudflare.com> wrote:
> >
> > Don't generate a broken bpf_helper_defs.h header if the helper script needs
> > updating because it doesn't recognize a newly added type. Instead print an
> > error that explains why the build is failing, clean up the partially
> > generated header and stop.
> >
> > v1->v2:
> > - Switched from temporary file to .DELETE_ON_ERROR.
> >
> > Fixes: 456a513bb5d4 ("scripts/bpf: Emit an #error directive known types list needs updating")
> > Suggested-by: Andrii Nakryiko <andriin@fb.com>
> > Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Applied.Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-21 1:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-20 11:23 [PATCH bpf-next v2] scripts/bpf: Print an error when known types list needs updating Jakub Sitnicki
2019-10-21 0:34 ` Yonghong Song
2019-10-21 0:51 ` Andrii Nakryiko
2019-10-21 1:22 ` Alexei Starovoitov
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.