From patchwork Mon Jun 4 14:07:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 925030 X-Patchwork-Delegate: yamada.m@jp.panasonic.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lucaceresoli.net Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40zxbz0k93z9ryk for ; Tue, 5 Jun 2018 00:08:15 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B8047C21F87; Mon, 4 Jun 2018 14:08:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5E522C21F01; Mon, 4 Jun 2018 14:08:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B8C47C21F01; Mon, 4 Jun 2018 14:08:05 +0000 (UTC) Received: from srv-hp10-72.netsons.net (srv-hp10-72.netsons.net [94.141.22.72]) by lists.denx.de (Postfix) with ESMTPS id 6CC02C21E89 for ; Mon, 4 Jun 2018 14:08:05 +0000 (UTC) Received: from [109.168.11.45] (port=39970 helo=pc-ceresoli.dev.aim) by srv-hp10.netsons.net with esmtpa (Exim 4.89_1) (envelope-from ) id 1fPq9T-003zYv-Br; Mon, 04 Jun 2018 16:08:03 +0200 From: Luca Ceresoli To: u-boot@lists.denx.de Date: Mon, 4 Jun 2018 16:07:53 +0200 Message-Id: <1528121273-22041-1-git-send-email-luca@lucaceresoli.net> X-Mailer: git-send-email 2.7.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - srv-hp10.netsons.net X-AntiAbuse: Original Domain - lists.denx.de X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lucaceresoli.net X-Get-Message-Sender-Via: srv-hp10.netsons.net: authenticated_id: luca+lucaceresoli.net/only user confirmed/virtual account not confirmed X-Authenticated-Sender: srv-hp10.netsons.net: luca@lucaceresoli.net X-Source: X-Source-Args: X-Source-Dir: Cc: Luca Ceresoli Subject: [U-Boot] [PATCH] if_changed: fix error handling X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The commands in if_changed and if_changed_dep are concatenated with a ';', thus any error in any command except the last one will be silently ignored. This is particularly relevant for the actual payload, cmd_$(1), whose errors should not be unnoticed. Fix by replacing the ';' with '&&'. Signed-off-by: Luca Ceresoli --- Note: I'm not aware of any situation in which this bug has any visible effect. I noticed the problem while working on a different topic, but later I did that job in a different way, not involving if_changed usages. But this is a bug anyway, so let's fix it. --- scripts/Kbuild.include | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 2c7918ad3721..f722f75611df 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -255,16 +255,16 @@ any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) # Execute command if command has changed or prerequisite(s) are updated. # if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ - @set -e; \ - $(echo-cmd) $(cmd_$(1)); \ + @set -e; \ + $(echo-cmd) $(cmd_$(1)) && \ printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd) # Execute the command and also postprocess generated .d dependencies file. if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ - @set -e; \ - $(echo-cmd) $(cmd_$(1)); \ - scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\ - rm -f $(depfile); \ + @set -e; \ + $(echo-cmd) $(cmd_$(1)) && \ + scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp && \ + rm -f $(depfile) && \ mv -f $(dot-target).tmp $(dot-target).cmd) # Usage: $(call if_changed_rule,foo)