Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3240718pxv; Mon, 12 Jul 2021 12:37:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJ9Gv7pvInHt3OcCmNCjFQr80AT4CSmGRoheREoc+T9sEHRy93mTOtMfISUc9wydfM9dbm X-Received: by 2002:aa7:c38d:: with SMTP id k13mr581762edq.178.1626118666122; Mon, 12 Jul 2021 12:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626118666; cv=none; d=google.com; s=arc-20160816; b=eeKbm+gImw1VRAtUcgakE3UNV7iutxarGRdP1PU07mXsCv0zHt9PRPpjc1rbKO0ZLO szSEPw1LoOL5smeg00kjUMokBJkDVjnLJFD3RHumONN2T8kzrDMLvHqrMgtli0iWxMJX 6seHETyTk7cjHDmf9MSiXTUsAXvYm7z+A81B0byg3pNTEREVnIO4Rmeov7afyojmkxXC dOLx2fucMDDM/UbOiI6tHDpmCtZEfYXm07EFhYHHZGr/HSpRAeoU8lpRi+4o32DrGRQ2 e14F/2UHVUJ+fbsT7PINLmbsiKpgRZOTA9+z/4fFxhRJDemeShVwsz9LUH4Ow/6IKS8t EYfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=FYGuIE/rrp9jK2ACLZgAl5e1eJ8So3VTkOVAntZSwxk=; b=UYIJtBqUSQOldtnjaleQccS74RcsOB7vtUmMX1GsE5HYiwUEgxEWjWnly2TB6F+uuU jfyBaOYjWX7O+5HMekmuCpKoc16dsUldk3CAXlZZvQ6NDDwCn8DK5KThVtSn7IF5Kg7S 7Li5M/DcWEB/wWqVx2QzvduIyXVMkf7vrDgcljC798uUogvL22hJ3WgyjOHBl2KwNxbN xgqbp8aipwC/e3LP/kSqPMKWhlTOVJhR1wZpG4K9Y1NTvlE/ZfPAB/nnzCtcOX0ZK8Op N/dcED0lmh2LkdgnQz+P0ItOLsu3Us20//KkBFNn7wJbbc12razhw6TZC0+kpm65Cxpm zSGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Ktw3/Gqv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r9si8997567edq.454.2021.07.12.12.37.22; Mon, 12 Jul 2021 12:37:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@redhat.com header.s=mimecast20190719 header.b="Ktw3/Gqv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234868AbhGLTik (ORCPT + 99 others); Mon, 12 Jul 2021 15:38:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58523 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232921AbhGLTij (ORCPT ); Mon, 12 Jul 2021 15:38:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626118550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FYGuIE/rrp9jK2ACLZgAl5e1eJ8So3VTkOVAntZSwxk=; b=Ktw3/Gqv6jAisByOUUyKYn4Ug3z1zK0b2YH+f8tlBh1Twon4i/v4yGS0n/ZaRWswNZK13L Tu2VyYmUeI/RIb6i67BFMwhxy09jceAAvmu1zDmhCgiQjyCcKfjAlEnq0/JkA9mQ/dMRMQ A6QTPyIfaBk73GxworM/fa3jIHeEY7Y= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-117-bkOKAhilNPmbrtrj8oGOiQ-1; Mon, 12 Jul 2021 15:35:48 -0400 X-MC-Unique: bkOKAhilNPmbrtrj8oGOiQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7DA3C100C609; Mon, 12 Jul 2021 19:35:47 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58E0D369A; Mon, 12 Jul 2021 19:35:47 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id 16CJZk5o012422; Mon, 12 Jul 2021 15:35:46 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id 16CJZkt7012418; Mon, 12 Jul 2021 15:35:46 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Mon, 12 Jul 2021 15:35:46 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Greg Kroah-Hartman cc: Masahiro Yamada , Nico Schottelius , linux-kernel@vger.kernel.org Subject: [PATCH v3] scripts/setlocalversion: fix a bug when LOCALVERSION is empty In-Reply-To: Message-ID: References: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 12 Jul 2021, Greg Kroah-Hartman wrote: > On Mon, Jul 12, 2021 at 03:06:48PM -0400, Mikulas Patocka wrote: > > > > > > On Mon, 12 Jul 2021, Greg Kroah-Hartman wrote: > > > > > On Mon, Jul 12, 2021 at 10:00:59AM -0400, Mikulas Patocka wrote: > > > > The patch 042da426f8ebde012be9429ff705232af7ad7469 > > > > ("scripts/setlocalversion: simplify the short version part") reduces the > > > > indentation. Unfortunatelly, it also changes behavior in a subtle way - if > > > > the user has empty "LOCALVERSION" variable, the plus sign is appended to > > > > the kernel version. It wasn't appended before. > > > > > > > > This patch reverts to the old behavior - we append the plus sign only if > > > > the LOCALVERSION variable is not set. > > > > > > > > Signed-off-by: Mikulas Patocka > > > > Fixes: 042da426f8eb ("scripts/setlocalversion: simplify the short version part") > > > > > > > > --- > > > > scripts/setlocalversion | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > Index: linux-2.6/scripts/setlocalversion > > > > =================================================================== > > > > --- linux-2.6.orig/scripts/setlocalversion 2021-07-12 15:29:07.000000000 +0200 > > > > +++ linux-2.6/scripts/setlocalversion 2021-07-12 15:50:29.000000000 +0200 > > > > @@ -131,7 +131,7 @@ res="${res}${CONFIG_LOCALVERSION}${LOCAL > > > > if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then > > > > # full scm version string > > > > res="$res$(scm_version)" > > > > -elif [ -z "${LOCALVERSION}" ]; then > > > > +elif [ "${LOCALVERSION+set}" != "set" ]; then > > > > > > That's really subtle, can you add a comment here that this handles an > > > empty file? > > > > > > thanks, > > > > > > greg k-h > > > > OK. > > > > > > From: Mikulas Patocka > > > > I can't take a patch like this :( > > > The patch 042da426f8ebde012be9429ff705232af7ad7469 > > ("scripts/setlocalversion: simplify the short version part") reduces > > Properly quote commits, the documentation says you do not need to use > the full sha1. From: Mikulas Patocka The commit 042da426f8eb ("scripts/setlocalversion: simplify the short version part") reduces indentation. Unfortunately, it also changes behavior in a subtle way - if the user has empty "LOCALVERSION" variable, the plus sign is appended to the kernel version. It wasn't appended before. This patch reverts to the old behavior - we append the plus sign only if the LOCALVERSION variable is not set. Signed-off-by: Mikulas Patocka Fixes: 042da426f8eb ("scripts/setlocalversion: simplify the short version part") --- scripts/setlocalversion | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) Index: linux-2.6/scripts/setlocalversion =================================================================== --- linux-2.6.orig/scripts/setlocalversion 2021-07-12 15:29:07.000000000 +0200 +++ linux-2.6/scripts/setlocalversion 2021-07-12 21:00:59.000000000 +0200 @@ -131,11 +131,14 @@ res="${res}${CONFIG_LOCALVERSION}${LOCAL if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then # full scm version string res="$res$(scm_version)" -elif [ -z "${LOCALVERSION}" ]; then - # append a plus sign if the repository is not in a clean - # annotated or signed tagged state (as git describe only - # looks at signed or annotated tags - git tag -a/-s) and - # LOCALVERSION= is not specified +elif [ "${LOCALVERSION+set}" != "set" ]; then + # If the variable LOCALVERSION is not set, append a plus + # sign if the repository is not in a clean annotated or + # signed tagged state (as git describe only looks at signed + # or annotated tags - git tag -a/-s). + # + # If the variable LOCALVERSION is set (including being set + # to an empty string), we don't want to append a plus sign. scm=$(scm_version --short) res="$res${scm:++}" fi