bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Jakub Sitnicki <jakub@cloudflare.com>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"kernel-team@cloudflare.com" <kernel-team@cloudflare.com>,
	Andrii Nakryiko <andriin@fb.com>
Subject: Re: [PATCH bpf-next v2] scripts/bpf: Print an error when known types list needs updating
Date: Mon, 21 Oct 2019 00:34:55 +0000	[thread overview]
Message-ID: <0b94f736-17f1-6358-f661-33b6fb348532@fb.com> (raw)
In-Reply-To: <20191020112344.19395-1-jakub@cloudflare.com>



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:
> 

  reply	other threads:[~2019-10-21  0:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2019-10-21  0:51 ` Andrii Nakryiko
2019-10-21  1:22   ` Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b94f736-17f1-6358-f661-33b6fb348532@fb.com \
    --to=yhs@fb.com \
    --cc=andriin@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=jakub@cloudflare.com \
    --cc=kernel-team@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).