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, 10 May 2021 10:39:05 -0700
From:   Joe Perches <joe@...ches.com>
To:     Dwaipayan Ray <dwaipayanray1@...il.com>
Cc:     linux-kernel@...r.kernel.org, lukas.bulwahn@...il.com
Subject: Re: [PATCH] checkpatch: auto detect codespell dictionary path

On Mon, 2021-05-10 at 22:41 +0530, Dwaipayan Ray wrote:
> The codespell dictionary was moved from
> `/usr/share/codespell/dictionary.txt` to data/dictionary.txt
> under the codespell_lib installation directory.
> 
> Checkpatch still uses a default absolute path for it which will
> no longer work on new codespell installations unless the path
> is specified through --codespellfile.
> 
> Detect the codespell dictionary path dynamically during
> runtime if the default path or the user provided dictionary
> path does not exist.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -889,6 +889,13 @@ if (open(my $spelling, '<', $spelling_file)) {
>  }
>  
> 
>  if ($codespell) {
> +	if (! -e "$codespellfile" && which("python3") ne "") {
> +		my $output = `python3 -c "import codespell_lib; print(codespell_lib.__file__, end='');" 2>/dev/null`;

It doesn't seem to me that using python3 is a great way to invoke python.
Maybe test the external command return $? when codespell isn't installed.

> +		my $dictionary_path = dirname($output) . "/data/dictionary.txt";

Unlikely, but this could still end up with a existing file of /data/dictionary.txt
that is not a codespell file.

> +		if (-e "$dictionary_path") {
> +			$codespellfile = $dictionary_path;
> +		}
> +	}
>  	if (open(my $spelling, '<', $codespellfile)) {
>  		while (<$spelling>) {
>  			my $line = $_;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ