From: Jiri Olsa <jolsa@redhat.com>
To: Andrii Nakryiko <andriin@fb.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, ast@fb.com,
daniel@iogearbox.net, andrii.nakryiko@gmail.com,
kernel-team@fb.com, Jiri Olsa <jolsa@kernel.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH bpf-next] tools build: propagate build failures from tools/build/Makefile.build
Date: Sun, 2 Aug 2020 18:11:06 +0200 [thread overview]
Message-ID: <20200802161106.GA127459@krava> (raw)
In-Reply-To: <20200731024244.872574-1-andriin@fb.com>
On Thu, Jul 30, 2020 at 07:42:44PM -0700, Andrii Nakryiko wrote:
> The '&&' command seems to have a bad effect when $(cmd_$(1)) exits with
> non-zero effect: the command failure is masked (despite `set -e`) and all but
> the first command of $(dep-cmd) is executed (successfully, as they are mostly
> printfs), thus overall returning 0 in the end.
nice, thanks for digging into this,
any idea why is the failure masked?
Acked-by: Jiri Olsa <jolsa@redhat.com>
jirka
>
> This means in practice that despite compilation errors, tools's build Makefile
> will return success. We see this very reliably with libbpf's Makefile, which
> doesn't get compilation error propagated properly. This in turns causes issues
> with selftests build, as well as bpftool and other projects that rely on
> building libbpf.
>
> The fix is simple: don't use &&. Given `set -e`, we don't need to chain
> commands with &&. The shell will exit on first failure, giving desired
> behavior and propagating error properly.
>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Fixes: 275e2d95591e ("tools build: Move dependency copy into function")
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> ---
>
> I'm sending this against bpf-next tree, given libbpf is affected enough for me
> to debug this fun problem that no one seemed to notice (or care, at least) in
> almost 5 years. If there is a better kernel tree, please let me know.
>
> tools/build/Build.include | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/build/Build.include b/tools/build/Build.include
> index 9ec01f4454f9..585486e40995 100644
> --- a/tools/build/Build.include
> +++ b/tools/build/Build.include
> @@ -74,7 +74,8 @@ dep-cmd = $(if $(wildcard $(fixdep)),
> # dependencies in the cmd file
> if_changed_dep = $(if $(strip $(any-prereq) $(arg-check)), \
> @set -e; \
> - $(echo-cmd) $(cmd_$(1)) && $(dep-cmd))
> + $(echo-cmd) $(cmd_$(1)); \
> + $(dep-cmd))
>
> # if_changed - execute command if any prerequisite is newer than
> # target, or command line has changed
> --
> 2.24.1
>
next prev parent reply other threads:[~2020-08-02 16:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-31 2:42 [PATCH bpf-next] tools build: propagate build failures from tools/build/Makefile.build Andrii Nakryiko
2020-08-02 3:33 ` Alexei Starovoitov
2020-08-02 16:11 ` Jiri Olsa [this message]
2020-08-02 18:22 ` Andrii Nakryiko
2020-08-02 21:51 ` Jiri Olsa
2020-08-03 14:18 ` Daniel Borkmann
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=20200802161106.GA127459@krava \
--to=jolsa@redhat.com \
--cc=acme@redhat.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andriin@fb.com \
--cc=ast@fb.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jolsa@kernel.org \
--cc=kernel-team@fb.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).