From patchwork Thu Mar 15 10:08:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 886179 X-Patchwork-Delegate: trini@ti.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 4024zW4k28z9sVb for ; Thu, 15 Mar 2018 21:47:18 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id D0A22C21E26; Thu, 15 Mar 2018 10:47: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 20D7CC21C4A; Thu, 15 Mar 2018 10:47:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 18C22C21BE5; Thu, 15 Mar 2018 10:09:16 +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 F38F4C21C29 for ; Thu, 15 Mar 2018 10:09:14 +0000 (UTC) Received: from [109.168.11.45] (port=54436 helo=pc-ceresoli.dev.aim) by srv-hp10.netsons.net with esmtpa (Exim 4.89_1) (envelope-from ) id 1ewPot-003x0a-CQ; Thu, 15 Mar 2018 11:09:11 +0100 From: Luca Ceresoli To: u-boot@lists.denx.de Date: Thu, 15 Mar 2018 11:08:56 +0100 Message-Id: <1521108536-32693-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: X-Mailman-Approved-At: Thu, 15 Mar 2018 10:47:04 +0000 Cc: Luca Ceresoli Subject: [U-Boot] [PATCH] scripts/check-config.sh: fix "command not found" 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" scripts/check-config.sh exits successfully and silently without doing any checks when the 'comm' command is not found. The problem triggers from the command around line 39: comm -23 ${suspects} ${ok} >${new_adhoc} This statement fails when 'comm' is not in $PATH, creating an empty ${new_adhoc} file. But the script continues and the following line, which is supposed to detect an error: if [ -s ${new_adhoc} ]; then will always be false since the file is empty, and the script will exit successfully as if everything were OK. The case where 'comm' in not in $PATH is not theoretical. It used to happen on yocto until a recent fix [0], and still happens on the current stable branch (rocko). Fix by setting the errexit flag to exit with error when a statement fails, so that at least the problem is noticed. For additional safety also set the nounset flag to detect expansion errors. [0] http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=fe0b4cb5b48580d4a3f3c0eb82bfa6f1b13801e4 Signed-off-by: Luca Ceresoli Reviewed-by: Simon Glass --- scripts/check-config.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/check-config.sh b/scripts/check-config.sh index 267758498b3d..4848ca6e25a5 100755 --- a/scripts/check-config.sh +++ b/scripts/check-config.sh @@ -14,6 +14,9 @@ # For example: # scripts/check-config.sh b/chromebook_link/u-boot.cfg kconfig_whitelist.txt . +set -e +set -u + path="$1" whitelist="$2" srctree="$3"