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:   Fri, 06 Nov 2020 14:03:59 -0800
From:   Joe Perches <joe@...ches.com>
To:     Dwaipayan Ray <dwaipayanray1@...il.com>
Cc:     linux-kernel-mentees@...ts.linuxfoundation.org,
        linux-kernel@...r.kernel.org, lukas.bulwahn@...il.com,
        yashsri421@...il.com
Subject: Re: [PATCH v4] checkpatch: improve email parsing

On Sat, 2020-11-07 at 03:15 +0530, Dwaipayan Ray wrote:
> checkpatch doesn't report warnings for many common mistakes
> in emails. Some of which are trailing commas and incorrect
> use of email comments.

Assuming it all works, this looks good.  I haven't tested it.

How did you test the $fix bits?

Trivial notes:

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> +				# stable@...r.kernel.org or stable@...nel.org shouldn't
> +				# have an email name. In addition commments should strictly
> +				# begin with a #
> +				if ($email =~ /^.*stable\@(?:vger\.)?kernel\.org/) {

Likely better to test with a case insensitive match so
STABLE@...r.kernel.org and such are still warned.

				if ($email =~ /\bstable\@(?:vger\.)?kernel\.org\b/i) {

> +					if ($sign_off =~ /cc:$/i && (($comment ne "" && $comment !~ /^#.+/) ||
> +					    ($email_name ne ""))) {

|| $sign_off !~ /^cc:/i ?

> +						my $cur_name = $email_name;
> +						my $new_comment = $comment;
> +
> +						$cur_name =~ s/[a-zA-Z\s\-\"]+//g;
> +						$new_comment =~ s/^[\s\#\(\[]+|[\s\)\]]+$//g;
> +						$new_comment = trim("$new_comment $cur_name") if $cur_name ne $new_comment;
> +						$new_comment = " # $new_comment" if length($new_comment) > 0;
> +						my $new_email = "$email_address$new_comment";
> +
> +						if (WARN("BAD_SIGN_OFF",
> +						    "Invalid email format for stable: '$email', prefer '$new_email'\n" . $herecurr) &&

These message lines should be aligned to the next open parenthesis
(7 tabs, 1 space)

> +						    $fix) {
> +							$fixed[$fixlinenr] =~ s/\Q$email\E/$new_email/;
> +						}

As a cc to stable isn't a sign-off, perhaps this should be a different
"BAD_<FOO>" like "BAD_STABLE_ADDRESS_STYLE" or such.

> +					}
> +				} else {

elsif ?

> +					if ($comment ne "" && $comment !~ /^(?:#.+|\(.+\))$/) {
> +						if (WARN("BAD_SIGN_OFF",
> +						    "Unexpected content after email: '$email'\n" . $herecurr) &&

7 tabs, 1 space

> +						    $fix) {
> +							my $new_comment = $comment;
> +							$new_comment =~ s/^(?:\/\*|\.|\,)//g;
> +							$new_comment =~ s/^[\s\{\[]+|[\s\}\]]+$//g;
> +							$new_comment = " ($new_comment)" if length($new_comment) > 0;
> +							$fixed[$fixlinenr] =~ s/\s*\Q$comment\E$/$new_comment/;
> +						}
> +					}
>  				}
>  			}
>  
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ