From patchwork Tue Sep 1 15:11:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 248938 Delivered-To: patch@linaro.org Received: by 2002:a17:906:6447:0:0:0:0 with SMTP id l7csp3723741ejn; Tue, 1 Sep 2020 09:14:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFUU7eky/0Bb3IKFyjlD+RUOpu37pz+PyWdmMnHK0IVHUWaOJ/9H8tGIq1D/rCTponRwhu X-Received: by 2002:aa7:c383:: with SMTP id k3mr2325913edq.164.1598976892963; Tue, 01 Sep 2020 09:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598976892; cv=none; d=google.com; s=arc-20160816; b=hzyMEnsHwUq6fSQNQRHs2po2xwBag7q+ZyeJCuETgxFqIZydL1++6ACbXIZo42kW/2 zp/LW/y8yrgYNoJqKFkCWQ06SILKHL6VzyP1Nq842stXXXaKmIX57E7xKNevJA7Op6ZL aHVnHEcLKAk3Qv37qgTRwavCEapuSWE0b4RUGiBGAVS9IzbKNTw8M6Jaxp7DDe6CfMtb Wj/Otr1/OpRcasIN0vFvp949CHCgEr3OrR1tCN4Z3NnnDb5YVvKSBL/MZpYBOxDQCNkQ Pu1l8kr9wufZkUErOM1+aJdTXyQboYNZ1GzWT/ryOyfZgwV90CoigE3BOgMg0uopO01D /RKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wH5DCd5ls8LwXUWaR8YSNPjrM/MTiLdicVh2OCcOYFs=; b=mIV4qyZyTItmzWmSRovowgyy2Ol8W5pgDO/J9cSYVBAorajBClKFCZbIgZPlXs5WIG vv+jUkqdxYpI/PH+W+m3BmB+mV2/kiXWEEOZYE6XitfraKJQ3L+oQgeZVMxiZqTxPdlJ cH37BQ9KIgNnT3gMkJRIz2N8k+l7yd4Nx84a3VC2A+kX2Bijl2+YTwRxSHYKnlYKXIG2 GV84qk1UVphRk371ct+1YTgSf0qoSmVaseiBrp/20PL0gcnimPQHuOEChbo7H0UC9yqi 9AIWF+ypLRLVp1uApkV0LdVG0NZfBMgAgIc9xel9TbnizwxaiHvahG4aS2NOq4L+u6bT EO/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AQh+n6on; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a20si1026442edj.133.2020.09.01.09.14.52; Tue, 01 Sep 2020 09:14:52 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AQh+n6on; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731915AbgIAQOc (ORCPT + 15 others); Tue, 1 Sep 2020 12:14:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:40796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731199AbgIAPfS (ORCPT ); Tue, 1 Sep 2020 11:35:18 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 919B720866; Tue, 1 Sep 2020 15:35:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598974511; bh=qWkM3Om2LckEUxIo++nIEQvs9JMWHngR19nimbA97dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AQh+n6onWRvec9e0ddkHMZNcVaY1cMPuOdD7fdMt2jJulqqS+3/FfhtOQ2xrcDzvU HMAqg3MDPQEV03KXxNHoB4FGJl6jYtlsXog5rww9tazh3itI8Deu+Y1v4KFyNlMO1c mlGRm/g5evZAUL4xh2LW65mac0V00euKx0aKIHP8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Matthias Maennich Subject: [PATCH 5.4 205/214] kheaders: remove unneeded cat command piped to head / tail Date: Tue, 1 Sep 2020 17:11:25 +0200 Message-Id: <20200901151002.753802071@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150952.963606936@linuxfoundation.org> References: <20200901150952.963606936@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masahiro Yamada commit 9a066357184485784f782719093ff804d05b85db upstream. The 'head' and 'tail' commands can take a file path directly. So, you do not need to run 'cat'. cat kernel/kheaders.md5 | head -1 ... is equivalent to: head -1 kernel/kheaders.md5 and the latter saves forking one process. While I was here, I replaced 'head -1' with 'head -n 1'. I also replaced '==' with '=' since we do not have a good reason to use the bashism. Signed-off-by: Masahiro Yamada Signed-off-by: Matthias Maennich Signed-off-by: Greg Kroah-Hartman --- kernel/gen_kheaders.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/kernel/gen_kheaders.sh +++ b/kernel/gen_kheaders.sh @@ -41,10 +41,10 @@ obj_files_md5="$(find $dir_list -name "* this_file_md5="$(ls -l $sfile | md5sum | cut -d ' ' -f1)" if [ -f $tarfile ]; then tarfile_md5="$(md5sum $tarfile | cut -d ' ' -f1)"; fi if [ -f kernel/kheaders.md5 ] && - [ "$(cat kernel/kheaders.md5|head -1)" == "$src_files_md5" ] && - [ "$(cat kernel/kheaders.md5|head -2|tail -1)" == "$obj_files_md5" ] && - [ "$(cat kernel/kheaders.md5|head -3|tail -1)" == "$this_file_md5" ] && - [ "$(cat kernel/kheaders.md5|tail -1)" == "$tarfile_md5" ]; then + [ "$(head -n 1 kernel/kheaders.md5)" = "$src_files_md5" ] && + [ "$(head -n 2 kernel/kheaders.md5 | tail -n 1)" = "$obj_files_md5" ] && + [ "$(head -n 3 kernel/kheaders.md5 | tail -n 1)" = "$this_file_md5" ] && + [ "$(tail -n 1 kernel/kheaders.md5)" = "$tarfile_md5" ]; then exit fi