summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndrii Nakryiko <andriin@fb.com>2020-07-30 19:42:44 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-21 09:48:12 +0200
commit431a1b512ee33f7b765e2cd6737ae802b292ea58 (patch)
tree7eb74749219959bc7b13e971a90097dcd4f3f498 /tools
parent96f448206b4b6679b93a25dc30feb0ce1f996278 (diff)
downloadlinux-stable-431a1b512ee33f7b765e2cd6737ae802b292ea58.tar.gz
linux-stable-431a1b512ee33f7b765e2cd6737ae802b292ea58.tar.bz2
linux-stable-431a1b512ee33f7b765e2cd6737ae802b292ea58.zip
tools, build: Propagate build failures from tools/build/Makefile.build
[ Upstream commit a278f3d8191228212c553a5d4303fa603214b717 ] 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. 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. Fixes: 275e2d95591e ("tools build: Move dependency copy into function") Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Jiri Olsa <jolsa@redhat.com> Link: https://lore.kernel.org/bpf/20200731024244.872574-1-andriin@fb.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/build/Build.include3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/build/Build.include b/tools/build/Build.include
index d9048f145f97..63bb9752612a 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