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: <fe60cadc38d430f38ff8cb3d1ca9c1f44260b59d.camel@perches.com>
Date:   Mon, 22 Jun 2020 15:11:23 -0700
From:   Joe Perches <joe@...ches.com>
To:     Jacob Keller <jacob.e.keller@...el.com>,
        linux-kernel@...r.kernel.org
Cc:     Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] checkpatch: use $root/.git when seeding camel case

On Mon, 2020-06-22 at 14:58 -0700, Jacob Keller wrote:
> When seeding the camel case file, checkpatch.pl uses the $root directory
> in order to find the acceptable list of allowed camel case words.
> 
> However, if the current directory is a git repository, checkpatch.pl
> attempts to seed using the local git directory.
> 
> This is problematic if checkpatch.pl is passed a --root and is being run
> from within another git repository. Rather than seeding from the
> provided root tree, checkpatch.pl will seed using the local files. If
> the current git repository isn't a kernel tree, this can lead to
> unexpected warnings about camel case issues.
> 
> Always honor the $root parameter when seeding camelcase files by using
> "$root/.git" and changing directory to the $root before invoking git.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -919,8 +919,8 @@ sub seed_camelcase_includes {
>  
>  	$camelcase_seeded = 1;
>  
> -	if (-e ".git") {
> -		my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
> +	if (-e "$root/.git") {
> +		my $git_last_include_commit = `cd $root && ${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
>  		chomp $git_last_include_commit;
>  		$camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
>  	} else {
> @@ -947,9 +947,10 @@ sub seed_camelcase_includes {
>  		return;
>  	}
>  
> -	if (-e ".git") {
> -		$files = `${git_command} ls-files "include/*.h"`;
> +	if (-e "$root/.git") {
> +		$files = `cd $root && ${git_command} ls-files "include/*.h"`;
>  		@include_files = split('\n', $files);
> +		@include_files = map("$root/$_", @include_files);
>  	}
>  
>  	foreach my $file (@include_files) {

checkpatch has 4 uses of ${git_command}

Maybe git_command should be changed instead.

I wonder how this interacts with the GIT_DIR environment variable.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ