Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1841882imu; Sat, 10 Nov 2018 02:44:07 -0800 (PST) X-Google-Smtp-Source: AJdET5dYnTB5uYCQih1UdEPzHCX4CtyN1UYTikMfbUA8rGE4BuLzOetbNN4JrNMJd/HikIpjFQP3 X-Received: by 2002:aa7:8254:: with SMTP id e20-v6mr12626923pfn.164.1541846647680; Sat, 10 Nov 2018 02:44:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541846647; cv=none; d=google.com; s=arc-20160816; b=Gi8I51HhcbdL1CUtP1h7nwyA4kLnpyetLi/iafkLY912/JC0erJAcc9Tt71WPnjmQq qninFUgYwOnpnRrs9ni99yCmQLjD4GKMotcsyotG5BH4xvutlg6Dh1cPMJQcLZ6Z4bO4 F/uY9MhMG0wvjlHdjH2DOhrKQ3ejEBVq/eVUkZaXY0KV3yH//FjP8J9IN7MFVXbE1ce/ 11yi0YYDus5ornmDdzAksss+X7cKJNe0VeqzVZPORjag5hpN0ILxlcKWMzluV0/kl662 Nq44IgbtG+eiPPvn/Rk2neHPaR3ySRjowQ5vsdFCIeRoCdLq8133v9bOMwpoPc/VQ/Rj yR4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=QucNLm5tnGr9SAqD/7avypXmnks+BNgE2VkyM+WLZg0=; b=dGf/MEiR3MnXROXzPKCicScjJqmRnKq0cNQyVOrrkT6EWt3r4PYRDyTlztb/4+Cghf 8BczjmMgpZGhUSGbdh769OCI3WZ1hzJNLRqs18HUi2uLGMIXZYmmSbT+1zvtmCPtGtCZ 2Lck8P1w41XPGSvUw3ekJ9xebUMIgDxpTbykqWTWN65mAqM5H7jxeT1O7YHGeI+koqcF TehAG5hpkYrSmbrVRk8xIcaTEfTRlUjVivrVah4ZVxevg4fgSKs0o4J9VsmvTlhAOFti /o65yaRjFYKnKgeHRx8ZsTXAf/Y3Ec9cWJlqMt9n0Ad0tcwEzsuPTap8V0vheitvvOeV kmlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11-v6si8982994pgs.179.2018.11.10.02.43.18; Sat, 10 Nov 2018 02:44:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728996AbeKJU0s (ORCPT + 99 others); Sat, 10 Nov 2018 15:26:48 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:45172 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728876AbeKJU0s (ORCPT ); Sat, 10 Nov 2018 15:26:48 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 42sYVt5rkPz1r4wX; Sat, 10 Nov 2018 11:42:14 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 42sYVt56j7z1qqkq; Sat, 10 Nov 2018 11:42:14 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id njDz1bTsGypG; Sat, 10 Nov 2018 11:42:13 +0100 (CET) X-Auth-Info: 7IJp+EcA0vL3jJGz3YCxZhpq/EA8oTFRJLz8s9TKttmudLeuwuCEnM40SkZDeeWl Received: from linux.local (ppp-188-174-147-181.dynamic.mnet-online.de [188.174.147.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sat, 10 Nov 2018 11:42:13 +0100 (CET) Received: by linux.local (Postfix, from userid 501) id 2ADCD1E586D; Sat, 10 Nov 2018 11:42:12 +0100 (CET) From: Andreas Schwab To: Genki Sky Cc: Brian Norris , Masahiro Yamada , Douglas Anderson , Guenter Roeck , Christian Kujau , Linux Kernel Mailing List Subject: Re: [PATCH] scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks References: <20181107022156.GA254567@google.com> <20181107184435.GA168339@google.com> <20181107.204358.257636196@genki.is> <20181107205514.GB12273@roeck-us.net> <20181107.210731.330601031@genki.is> <20181109183436.GA45531@google.com> <20181110.085826.230851261@genki.is> X-Yow: I FORGOT to do the DISHES!! Date: Sat, 10 Nov 2018 11:42:11 +0100 In-Reply-To: <20181110.085826.230851261@genki.is> (Genki Sky's message of "Sat, 10 Nov 2018 00:58:26 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Nov 10 2018, Genki Sky wrote: > On Fri, 9 Nov 2018 10:34:37 -0800, Brian Norris wrote: >> diff --git a/scripts/setlocalversion b/scripts/setlocalversion >> index 71f39410691b..eab1f90de50d 100755 >> --- a/scripts/setlocalversion >> +++ b/scripts/setlocalversion >> @@ -73,8 +73,19 @@ scm_version() >> printf -- '-svn%s' "`git svn find-rev $head`" >> fi >> >> - # Check for uncommitted changes >> - if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then >> + # Check for uncommitted changes. >> + # First, with git-status, but --no-optional-locks is only >> + # supported in git >= 2.14, so fall back to git-diff-index if >> + # it fails. Note that git-diff-index does not refresh the >> + # index, so it may give misleading results. See >> + # git-update-index(1), git-diff-index(1), and git-status(1). >> + local git_status >> + git_status="$(git --no-optional-locks status -uno --porcelain 2>/dev/null)" >> + if [ $? -eq 0 ]; then >> + if echo "$git_status" | grep -qv '^.. scripts/package'; then > > Shouldn't this be: > > if printf '%s' "$git_status" | grep -qv '^.. scripts/package'; then > > I.e., use printf not echo? Because of echo introducing a newline. The input to grep should be a text file, thus should end with a newline. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."