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-next>] [day] [month] [year] [list]
Date:   Mon, 13 Sep 2021 16:33:24 -0700
From:   Peter Collingbourne <pcc@...gle.com>
To:     Andy Whitcroft <apw@...onical.com>, Joe Perches <joe@...ches.com>,
        Dwaipayan Ray <dwaipayanray1@...il.com>,
        Lukas Bulwahn <lukas.bulwahn@...il.com>
Cc:     Peter Collingbourne <pcc@...gle.com>, linux-kernel@...r.kernel.org
Subject: [PATCH] checkpatch.pl: use correct gitroot when running from
 non-top-level dir

My workflow usually requires running checkpatch.pl from a subdirectory
of the kernel source tree. This works for the most part, but the script
will be unable to find the .git directory and will therefore refuse to
run any git commands (so, e.g. commit ID verification will fail). Fix
it by prepending $root to $gitroot when a root is set.

This also requires fixing one root directory assumption in a git
invocation.

Signed-off-by: Peter Collingbourne <pcc@...gle.com>
Link: https://linux-review.googlesource.com/id/I33dc5f38e2bfcd95c8ea59933bba5305cce50404
---
 scripts/checkpatch.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c27d2312cfc3..171c5993efb4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -434,6 +434,8 @@ if ($tree) {
 		print "Must be run from the top-level dir. of a kernel tree\n";
 		exit(2);
 	}
+
+	$gitroot = "$root/$gitroot";
 }
 
 my $emitted_corrupt = 0;
@@ -1131,7 +1133,7 @@ sub seed_camelcase_includes {
 	}
 
 	if (-e "$gitroot") {
-		$files = `${git_command} ls-files "include/*.h"`;
+		$files = `${git_command} ls-files "$root/include/*.h"`;
 		@include_files = split('\n', $files);
 	}
 
-- 
2.33.0.309.g3052b89438-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ