From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8FABC433E3 for ; Mon, 17 Aug 2020 19:21:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AFF292065D for ; Mon, 17 Aug 2020 19:21:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597692072; bh=a2Kv20AJygXJoaR4OPP/5jAv940SoiUnSAZ3rXPGb8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=JWWcASfBS3KRdXmgUaz+6pitZr8BSHH884QH7L/fCNETbtiWIUXX6QQwETG6PWuQI U0YVIxO8UiY3l9hm4/jcPb38wdDk/DHuAZtOJcRbjiwnO0olU2ajumjoYNgFLBuLxA ZjVCVrupsk9I5qJpMhs3+HbShEa3TE/dUoNfxcX0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392238AbgHQTUp (ORCPT ); Mon, 17 Aug 2020 15:20:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:44116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730502AbgHQPgl (ORCPT ); Mon, 17 Aug 2020 11:36:41 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D55A2221E2; Mon, 17 Aug 2020 15:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597678600; bh=a2Kv20AJygXJoaR4OPP/5jAv940SoiUnSAZ3rXPGb8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j44j4hdeLsDdEzvJSIm3HblhXwk4BLyxxEzqs2PHDipr1ty29T5CHKdiw2zvddgEj aiUHNb6YbfS1K51MFtTC2kKx8YeUiGatkGhrwfuAlTBVJ6OOJpTB4VMDEsOeij9ldg 13NHYIHReYrQmMgZybBPJuuKl2e0iY/jym1YLDgY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Daniel Borkmann , Jiri Olsa , Sasha Levin Subject: [PATCH 5.8 350/464] tools, build: Propagate build failures from tools/build/Makefile.build Date: Mon, 17 Aug 2020 17:15:03 +0200 Message-Id: <20200817143850.536157499@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Andrii Nakryiko [ 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 Signed-off-by: Daniel Borkmann Acked-by: Jiri Olsa Link: https://lore.kernel.org/bpf/20200731024244.872574-1-andriin@fb.com Signed-off-by: Sasha Levin --- 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 9ec01f4454f9f..585486e40995b 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.25.1