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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon,  2 Dec 2013 16:34:29 +0100
From:	Franck Bui-Huu <fbuihuu@...il.com>
To:	mmarek@...e.cz
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] Fix detectition of kernel git repository in setlocalversion script [take #2]

setlocalversion script was testing the presence of .git directory in order to find out
if git is used as SCM to track the current kernel project. However in some cases, .git
is not a directory but can be a file: when the kernel is a git submodule part of a git
super project for example.

This patch just fixes this by using 'git rev-parse --show-cdup' to check that the
current directory is the kernel git topdir. This has the advantage to not test and rely
on git internal infrastructure directly.

Signed-off-by: Franck Bui-Huu <fbuihuu@...il.com>
---
 scripts/setlocalversion | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 0b5ccf3..3d8af0e 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -43,7 +43,8 @@ scm_version()
 	fi
 
 	# Check for git and a git repo.
-	if test -d .git && head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
+	if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
+	   head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
 
 		# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
 		# it, because this version is defined in the top level Makefile.
-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ