lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LRH.2.02.2107121502380.8445@file01.intranet.prod.int.rdu2.redhat.com>
Date:   Mon, 12 Jul 2021 15:06:48 -0400 (EDT)
From:   Mikulas Patocka <mpatocka@...hat.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
cc:     Masahiro Yamada <masahiroy@...nel.org>,
        Nico Schottelius <nico-linuxsetlocalversion@...ottelius.org>,
        linux-kernel@...r.kernel.org
Subject:  [PATCH v2] scripts/setlocalversion: fix a bug when LOCALVERSION is
 empty



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 <mpatocka@...hat.com>
> > 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 <mpatocka@...hat.com>

The patch 042da426f8ebde012be9429ff705232af7ad7469
("scripts/setlocalversion: simplify the short version part") reduces
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 <mpatocka@...hat.com>
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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ