Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3001801imm; Thu, 24 May 2018 20:55:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp9z18ws1+BZamCg7wIWHv/hOuv71PMKO8wAn5C/dScpnJWfrw4y1I0P9tx4inZjW/7SOL5 X-Received: by 2002:a63:350d:: with SMTP id c13-v6mr646759pga.426.1527220537839; Thu, 24 May 2018 20:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527220537; cv=none; d=google.com; s=arc-20160816; b=XCv7hL/01nI9xrOeVc55e5NNE3n3xNKnCdfqIutzB8856Qqxv6P8NDXHZVrH+Hv+nN 305LDmzWQNAE+/lEu23D9I9C+jaOb3JxkeA5u32m4DzgvjpT7p693jeGnexxFQDX4kuW YN4kC2X2OHU+xNtVFwkGNeDxYzNegJhSgBOjS6S1CIB03RpummizdC9+sB5R/+LpMSYP 38fVeRXqoej0RK8qEL9wOWiUM1V+z1IvKtst26Xe4XdO7UbpcxlJDcXP/QYmfcqOy9rE vAgMYG0vcPGH7YgyQ95Q7GFk4mqUVvDcx+2Ylww9vKQJucG3mSDQLZz8aR2HE3+yjtiL 8w5Q== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=bY+qXbvtlGRI2YsyqMhGlxmb/XWloHyPF/82/31NOaQ=; b=i2zQFHaUcTZMg0LkUcRZRQKmu+aSuVURYkGhM0A5gy8HO4jWF0lFoRuyDny7NbpR1M 9U61gxH1/d5Rai7r1VuZ9xGg8sSahA3kYhVEizKlqgLiVTZ66hcNWWe8qqiSTrltiKEP WBbobvfBJ7azRd8/LtEum/BkLY+H8oc2nJLXsfuu+07hl6d/d9cXRzxvsQ96wXEJePlC ejaF7b2Je+99LRwZzQQqwXo7vR64c92yRCvNnRsffTuoEpHaEcC2OeDlxY15a8qt14L0 mVeXyCaAP9mKOb3j78HcodDPHBRyyemYQLlQ8IRxz4mYIdQEupDargb0uB1GwhTX1Jck MB1A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4-v6si22245125pln.331.2018.05.24.20.55.23; Thu, 24 May 2018 20:55:37 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964826AbeEYDuf (ORCPT + 99 others); Thu, 24 May 2018 23:50:35 -0400 Received: from mga01.intel.com ([192.55.52.88]:6227 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932570AbeEYDuc (ORCPT ); Thu, 24 May 2018 23:50:32 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 May 2018 20:50:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,438,1520924400"; d="scan'208";a="58357659" Received: from jfdmzpr03.jf.intel.com (HELO mchikara-mobl3.gar.corp.intel.com) ([10.7.210.22]) by fmsmga001.fm.intel.com with ESMTP; 24 May 2018 20:50:29 -0700 Subject: Re: Wrong -dirty suffix set by setlocalversion (was: BUG in git diff-index) To: Mike Mason Cc: andy.work@nglowry.com, git@vger.kernel.org, gitster@pobox.com, josh@joshtriplett.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, lists@nerdbynature.de, peff@peff.net, nico-linuxsetlocalversion@schottelius.org References: <89d82c84-7a3b-9c4c-679e-a7a723669592@intel.com> <20180524230334.12452-1-michael.w.mason@intel.com> From: Marc Herbert Message-ID: <0dc31052-4cfd-3b92-0a4a-96c8ecfafff6@intel.com> Date: Thu, 24 May 2018 20:50:28 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180524230334.12452-1-michael.w.mason@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/05/2018 16:03, Mike Mason wrote: > diff --git a/scripts/setlocalversion b/scripts/setlocalversion > index 71f39410691b..9da4c5e83285 100755 > --- a/scripts/setlocalversion > +++ b/scripts/setlocalversion > @@ -73,8 +73,10 @@ 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. Only check mtime and size. > + # Ignore insequential ctime, uid, gid and inode differences. > + if git -c "core.checkstat=minimal" diff-index --name-only HEAD | \ > + grep -qv "^scripts/package"; then > printf '%s' -dirty > fi FWIW: Reported-by: Marc.Herbert@intel.com Reviewed-by: Marc.Herbert@intel.com (assuming a future and decent commit message) Tested-by: Marc.Herbert@intel.com So the real use case is making a copy of a whole tree before building. Typical in automated builds, old example: https://groups.google.com/a/chromium.org/d/msg/chromium-os-dev/zxOa0OLWFkw/N_Sb7EZOBwAJ Here's a more complex but faster and more transparent way to test Mike's fix than copying an entire tree: # Make sure you start from a clean state git describe --dirty # must not -dirty make prepare # Simulate a copy of the tree but with just one file rsync --perms --times README README.mtime_backup rm README rsync --perms --times README.mtime_backup README stat README README.mtime_backup # Demo the BUG fixed by Mike ./scripts/setlocalversion # -dirty BUG! because spurious inode ctime difference git diff-index HEAD git describe --dirty # not -dirty ./scripts/setlocalversion # not -dirty any more cause describe refreshed index # Make sure mtime still causes -dirty with AND without Mike's fix touch README ./scripts/setlocalversion # -dirty