Skip to content

Commit a278f3d

Browse files
anakryikoborkmann
authored andcommitted
tools, build: Propagate build failures from tools/build/Makefile.build
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: 275e2d9 ("tools build: Move dependency copy into function") Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Jiri Olsa <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent b5cc46c commit a278f3d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/build/Build.include

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ dep-cmd = $(if $(wildcard $(fixdep)),
7474
# dependencies in the cmd file
7575
if_changed_dep = $(if $(strip $(any-prereq) $(arg-check)), \
7676
@set -e; \
77-
$(echo-cmd) $(cmd_$(1)) && $(dep-cmd))
77+
$(echo-cmd) $(cmd_$(1)); \
78+
$(dep-cmd))
7879

7980
# if_changed - execute command if any prerequisite is newer than
8081
# target, or command line has changed

0 commit comments

Comments
 (0)