linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH RFC] checkpatch: add new warnings to author signoff checks.
@ 2020-10-05  6:48 Dwaipayan Ray
  2020-10-05  7:18 ` Joe Perches
  2020-10-05  7:30 ` Lukas Bulwahn
  0 siblings, 2 replies; 9+ messages in thread
From: Dwaipayan Ray @ 2020-10-05  6:48 UTC (permalink / raw)
  To: joe; +Cc: dwaipayanray1, linux-kernel-mentees, linux-kernel

The author signed-off-by checks are currently very vague.
Cases like same name or same address are not handled separately.

For example, running checkpatch on commit be6577af0cef
("parisc: Add atomic64_set_release() define to avoid CPU soft lockups"),
gives:

WARNING: Missing Signed-off-by: line by nominal patch author
'John David Anglin <dave.anglin@bell.net>'

The signoff line was:
"Signed-off-by: Dave Anglin <dave.anglin@bell.net>"

Clearly the author has signed off but with a slightly different version
of his name. A more appropriate warning would have been to point out
at the name mismatch instead.

Introduced three new types of warnings:

1) Address matches, but names are different.
   "James Watson <james@gmail.com>", "James <james@gmail.com>"

2) Name matches, but addresses are different.
   "James Watson <james@watson.com>", "James Watson <james@gmail.com>"

3) Name matches, but addresses without mail extensions are same.
   "James Watson <james@gmail.com>", "James Watson <james+a@gmail.com>"

For the 3rd class, a --strict check message is generated, and for the
other two, warnings are generated.

Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
---
 scripts/checkpatch.pl | 57 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 53 insertions(+), 4 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 31624bbb342e..80feb15f93cb 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2347,6 +2347,7 @@ sub process {
 	my $signoff = 0;
 	my $author = '';
 	my $authorsignoff = 0;
+	my $authorsignoff_ctx = '';
 	my $is_patch = 0;
 	my $is_binding_patch = -1;
 	my $in_header_lines = $file ? 0 : 1;
@@ -2674,9 +2675,34 @@ sub process {
 		if ($line =~ /^\s*signed-off-by:\s*(.*)/i) {
 			$signoff++;
 			$in_commit_log = 0;
-			if ($author ne '') {
+			if ($author ne ''  && $authorsignoff != 1) {
 				if (same_email_addresses($1, $author)) {
 					$authorsignoff = 1;
+				} else {
+					my $ctx = $1;
+					my ($email_name, $email_comment, $email_address, $comment1) = parse_email($ctx);
+					my ($author_name, $author_comment, $author_address, $comment2) = parse_email($author);
+
+					if($email_address eq $author_address) {
+						$authorsignoff_ctx = $ctx;
+						$authorsignoff = 2;
+					} elsif ($email_name eq $author_name) {
+						$authorsignoff_ctx = $ctx;
+						$authorsignoff = 3;
+
+						my $address1 = $email_address;
+						my $address2 = $author_address;
+
+						if ($address1 =~ /(\S+)\+\S+(\@.*)/) {
+							$address1 = $1.$2;
+						}
+						if ($address2 =~ /(\S+)\+\S+(\@.*)/) {
+							$address2 = $1.$2;
+						}
+						if($address1 eq $address2) {
+							$authorsignoff = 4;
+						}
+					}
 				}
 			}
 		}
@@ -6891,9 +6917,32 @@ sub process {
 		if ($signoff == 0) {
 			ERROR("MISSING_SIGN_OFF",
 			      "Missing Signed-off-by: line(s)\n");
-		} elsif (!$authorsignoff) {
-			WARN("NO_AUTHOR_SIGN_OFF",
-			     "Missing Signed-off-by: line by nominal patch author '$author'\n");
+		} elsif ($authorsignoff != 1) {
+			# authorsignoff values:
+			# 0 -> missing sign off
+			# 1 -> sign off present
+			# 2 -> address matches, name different
+			# 3 -> name matches, address different
+			# 4 -> name matches, address matches without extension
+
+			my $ctx_msg = "'Signed-off-by: $authorsignoff_ctx' should be:\n'Signed-off-by: $author'";
+
+			if($authorsignoff == 0) {
+				WARN("NO_AUTHOR_SIGN_OFF",
+					"Missing Signed-off-by: line by nominal patch author '$author'\n");
+			}
+			elsif($authorsignoff == 2) {
+				WARN("NO_AUTHOR_SIGN_OFF",
+					"Author name mismatch:\n$ctx_msg\n");
+			}
+			elsif($authorsignoff == 3) {
+				WARN("NO_AUTHOR_SIGN_OFF",
+					"Author address mismatch:\n$ctx_msg\n");
+			}
+			elsif($authorsignoff == 4) {
+				CHK("NO_AUTHOR_SIGN_OFF",
+					"Author mail extension mismatch:\n$ctx_msg\n");
+			}
 		}
 	}
 
-- 
2.27.0

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH RFC] checkpatch: add new warnings to author signoff checks.
  2020-10-05  6:48 [Linux-kernel-mentees] [PATCH RFC] checkpatch: add new warnings to author signoff checks Dwaipayan Ray
@ 2020-10-05  7:18 ` Joe Perches
  2020-10-05  7:40   ` Dwaipayan Ray
  2020-10-05  7:30 ` Lukas Bulwahn
  1 sibling, 1 reply; 9+ messages in thread
From: Joe Perches @ 2020-10-05  7:18 UTC (permalink / raw)
  To: Dwaipayan Ray; +Cc: linux-kernel-mentees, linux-kernel

On Mon, 2020-10-05 at 12:18 +0530, Dwaipayan Ray wrote:
> The author signed-off-by checks are currently very vague.
> Cases like same name or same address are not handled separately.
> 
> For example, running checkpatch on commit be6577af0cef
> ("parisc: Add atomic64_set_release() define to avoid CPU soft lockups"),
> gives:
> 
> WARNING: Missing Signed-off-by: line by nominal patch author
> 'John David Anglin <dave.anglin@bell.net>'
> 
> The signoff line was:
> "Signed-off-by: Dave Anglin <dave.anglin@bell.net>"
> 
> Clearly the author has signed off but with a slightly different version
> of his name. A more appropriate warning would have been to point out
> at the name mismatch instead.
> 
> Introduced three new types of warnings:
> 
> 1) Address matches, but names are different.
>    "James Watson <james@gmail.com>", "James <james@gmail.com>"
> 
> 2) Name matches, but addresses are different.
>    "James Watson <james@watson.com>", "James Watson <james@gmail.com>"
> 
> 3) Name matches, but addresses without mail extensions are same.
>    "James Watson <james@gmail.com>", "James Watson <james+a@gmail.com>"
> 
> For the 3rd class, a --strict check message is generated, and for the
> other two, warnings are generated.

I don't have any issue with the concept, but please
be consistent with spacing after if tests.

Always use a single space after if

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl

> @@ -2347,6 +2347,7 @@ sub process {
>  	my $signoff = 0;
>  	my $author = '';
>  	my $authorsignoff = 0;
> +	my $authorsignoff_ctx = '';

ctx isn't a descriptive name.

Maybe $author_sob

> @@ -2674,9 +2675,34 @@ sub process {
>  		if ($line =~ /^\s*signed-off-by:\s*(.*)/i) {
>  			$signoff++;
>  			$in_commit_log = 0;
> -			if ($author ne '') {
> +			if ($author ne ''  && $authorsignoff != 1) {

Has space after if

>  				if (same_email_addresses($1, $author)) {
>  					$authorsignoff = 1;
> +				} else {
> +					my $ctx = $1;
> +					my ($email_name, $email_comment, $email_address, $comment1) = parse_email($ctx);
> +					my ($author_name, $author_comment, $author_address, $comment2) = parse_email($author);
> +
> +					if($email_address eq $author_address) {

No space after if, etc...

> @@ -6891,9 +6917,32 @@ sub process {
>  		if ($signoff == 0) {
>  			ERROR("MISSING_SIGN_OFF",
>  			      "Missing Signed-off-by: line(s)\n");
> -		} elsif (!$authorsignoff) {
> -			WARN("NO_AUTHOR_SIGN_OFF",
> -			     "Missing Signed-off-by: line by nominal patch author '$author'\n");
> +		} elsif ($authorsignoff != 1) {
> +			# authorsignoff values:
> +			# 0 -> missing sign off
> +			# 1 -> sign off present

sign off identical

> +			# 2 -> address matches, name different
> +			# 3 -> name matches, address different
> +			# 4 -> name matches, address matches without extension

extension here isn't obvious

> +
> +			my $ctx_msg = "'Signed-off-by: $authorsignoff_ctx' should be:\n'Signed-off-by: $author'";

New line not necessary or useful really.

And for mismatches, it's really not known that
it should be one way or the or the other is it?

> +
> +			if($authorsignoff == 0) {
> +				WARN("NO_AUTHOR_SIGN_OFF",
> +					"Missing Signed-off-by: line by nominal patch author '$author'\n");
> +			}
> +			elsif($authorsignoff == 2) {
> +				WARN("NO_AUTHOR_SIGN_OFF",
> +					"Author name mismatch:\n$ctx_msg\n");
> +			}
> +			elsif($authorsignoff == 3) {
> +				WARN("NO_AUTHOR_SIGN_OFF",
> +					"Author address mismatch:\n$ctx_msg\n");
> +			}
> +			elsif($authorsignoff == 4) {
> +				CHK("NO_AUTHOR_SIGN_OFF",
> +					"Author mail extension mismatch:\n$ctx_msg\n");
> +			}
>  		}
>  	}
>  

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH RFC] checkpatch: add new warnings to author signoff checks.
  2020-10-05  6:48 [Linux-kernel-mentees] [PATCH RFC] checkpatch: add new warnings to author signoff checks Dwaipayan Ray
  2020-10-05  7:18 ` Joe Perches
@ 2020-10-05  7:30 ` Lukas Bulwahn
  1 sibling, 0 replies; 9+ messages in thread
From: Lukas Bulwahn @ 2020-10-05  7:30 UTC (permalink / raw)
  To: Dwaipayan Ray; +Cc: joe, linux-kernel-mentees, linux-kernel



On Mon, 5 Oct 2020, Dwaipayan Ray wrote:

> The author signed-off-by checks are currently very vague.
> Cases like same name or same address are not handled separately.
> 
> For example, running checkpatch on commit be6577af0cef
> ("parisc: Add atomic64_set_release() define to avoid CPU soft lockups"),
> gives:
> 
> WARNING: Missing Signed-off-by: line by nominal patch author
> 'John David Anglin <dave.anglin@bell.net>'
> 
> The signoff line was:
> "Signed-off-by: Dave Anglin <dave.anglin@bell.net>"
> 
> Clearly the author has signed off but with a slightly different version
> of his name. A more appropriate warning would have been to point out
> at the name mismatch instead.
> 
> Introduced three new types of warnings:
> 
> 1) Address matches, but names are different.
>    "James Watson <james@gmail.com>", "James <james@gmail.com>"
> 
> 2) Name matches, but addresses are different.
>    "James Watson <james@watson.com>", "James Watson <james@gmail.com>"
> 
> 3) Name matches, but addresses without mail extensions are same.
>    "James Watson <james@gmail.com>", "James Watson <james+a@gmail.com>"
> 
> For the 3rd class, a --strict check message is generated, and for the
> other two, warnings are generated.
>

I will start running an evaluation on checkpatch.pl before and after this 
patch to get some insight on this change.
 
> Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
> ---
>  scripts/checkpatch.pl | 57 ++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 53 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 31624bbb342e..80feb15f93cb 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2347,6 +2347,7 @@ sub process {
>  	my $signoff = 0;
>  	my $author = '';
>  	my $authorsignoff = 0;
> +	my $authorsignoff_ctx = '';
>  	my $is_patch = 0;
>  	my $is_binding_patch = -1;
>  	my $in_header_lines = $file ? 0 : 1;
> @@ -2674,9 +2675,34 @@ sub process {
>  		if ($line =~ /^\s*signed-off-by:\s*(.*)/i) {
>  			$signoff++;
>  			$in_commit_log = 0;
> -			if ($author ne '') {
> +			if ($author ne ''  && $authorsignoff != 1) {
>  				if (same_email_addresses($1, $author)) {
>  					$authorsignoff = 1;
> +				} else {
> +					my $ctx = $1;
> +					my ($email_name, $email_comment, $email_address, $comment1) = parse_email($ctx);
> +					my ($author_name, $author_comment, $author_address, $comment2) = parse_email($author);
> +
> +					if($email_address eq $author_address) {
> +						$authorsignoff_ctx = $ctx;
> +						$authorsignoff = 2;
> +					} elsif ($email_name eq $author_name) {
> +						$authorsignoff_ctx = $ctx;
> +						$authorsignoff = 3;
> +
> +						my $address1 = $email_address;
> +						my $address2 = $author_address;
> +
> +						if ($address1 =~ /(\S+)\+\S+(\@.*)/) {
> +							$address1 = $1.$2;
> +						}
> +						if ($address2 =~ /(\S+)\+\S+(\@.*)/) {
> +							$address2 = $1.$2;
> +						}
> +						if($address1 eq $address2) {
> +							$authorsignoff = 4;
> +						}
> +					}
>  				}
>  			}
>  		}
> @@ -6891,9 +6917,32 @@ sub process {
>  		if ($signoff == 0) {
>  			ERROR("MISSING_SIGN_OFF",
>  			      "Missing Signed-off-by: line(s)\n");
> -		} elsif (!$authorsignoff) {
> -			WARN("NO_AUTHOR_SIGN_OFF",
> -			     "Missing Signed-off-by: line by nominal patch author '$author'\n");
> +		} elsif ($authorsignoff != 1) {
> +			# authorsignoff values:
> +			# 0 -> missing sign off
> +			# 1 -> sign off present
> +			# 2 -> address matches, name different
> +			# 3 -> name matches, address different
> +			# 4 -> name matches, address matches without extension
> +
> +			my $ctx_msg = "'Signed-off-by: $authorsignoff_ctx' should be:\n'Signed-off-by: $author'";
> +
> +			if($authorsignoff == 0) {
> +				WARN("NO_AUTHOR_SIGN_OFF",
> +					"Missing Signed-off-by: line by nominal patch author '$author'\n");
> +			}

I think in this case, we could actually turn this into an ERROR; now that 
we have the refined cases (2,3,4) on which we would just warn or 'note' 
with --strict checks.

Lukas

> +			elsif($authorsignoff == 2) {
> +				WARN("NO_AUTHOR_SIGN_OFF",
> +					"Author name mismatch:\n$ctx_msg\n");
> +			}
> +			elsif($authorsignoff == 3) {
> +				WARN("NO_AUTHOR_SIGN_OFF",
> +					"Author address mismatch:\n$ctx_msg\n");
> +			}
> +			elsif($authorsignoff == 4) {
> +				CHK("NO_AUTHOR_SIGN_OFF",
> +					"Author mail extension mismatch:\n$ctx_msg\n");
> +			}
>  		}
>  	}
>  
> -- 
> 2.27.0
> 
> 
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH RFC] checkpatch: add new warnings to author signoff checks.
  2020-10-05  7:18 ` Joe Perches
@ 2020-10-05  7:40   ` Dwaipayan Ray
  2020-10-05  8:05     ` Joe Perches
  0 siblings, 1 reply; 9+ messages in thread
From: Dwaipayan Ray @ 2020-10-05  7:40 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel-mentees, linux-kernel

On Mon, Oct 5, 2020 at 12:48 PM Joe Perches <joe@perches.com> wrote:
>
> On Mon, 2020-10-05 at 12:18 +0530, Dwaipayan Ray wrote:
> > The author signed-off-by checks are currently very vague.
> > Cases like same name or same address are not handled separately.
> >
> > For example, running checkpatch on commit be6577af0cef
> > ("parisc: Add atomic64_set_release() define to avoid CPU soft lockups"),
> > gives:
> >
> > WARNING: Missing Signed-off-by: line by nominal patch author
> > 'John David Anglin <dave.anglin@bell.net>'
> >
> > The signoff line was:
> > "Signed-off-by: Dave Anglin <dave.anglin@bell.net>"
> >
> > Clearly the author has signed off but with a slightly different version
> > of his name. A more appropriate warning would have been to point out
> > at the name mismatch instead.
> >
> > Introduced three new types of warnings:
> >
> > 1) Address matches, but names are different.
> >    "James Watson <james@gmail.com>", "James <james@gmail.com>"
> >
> > 2) Name matches, but addresses are different.
> >    "James Watson <james@watson.com>", "James Watson <james@gmail.com>"
> >
> > 3) Name matches, but addresses without mail extensions are same.
> >    "James Watson <james@gmail.com>", "James Watson <james+a@gmail.com>"
> >
> > For the 3rd class, a --strict check message is generated, and for the
> > other two, warnings are generated.
>
> I don't have any issue with the concept, but please
> be consistent with spacing after if tests.
>
> Always use a single space after if
>

Okay sure I will take care of that.

> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>
> > @@ -2347,6 +2347,7 @@ sub process {
> >       my $signoff = 0;
> >       my $author = '';
> >       my $authorsignoff = 0;
> > +     my $authorsignoff_ctx = '';
>
> ctx isn't a descriptive name.
>
> Maybe $author_sob

Yes that's more illustrative. I will change that.

>
> > @@ -2674,9 +2675,34 @@ sub process {
> >               if ($line =~ /^\s*signed-off-by:\s*(.*)/i) {
> >                       $signoff++;
> >                       $in_commit_log = 0;
> > -                     if ($author ne '') {
> > +                     if ($author ne ''  && $authorsignoff != 1) {
>
> Has space after if
>
> >                               if (same_email_addresses($1, $author)) {
> >                                       $authorsignoff = 1;
> > +                             } else {
> > +                                     my $ctx = $1;
> > +                                     my ($email_name, $email_comment, $email_address, $comment1) = parse_email($ctx);
> > +                                     my ($author_name, $author_comment, $author_address, $comment2) = parse_email($author);
> > +
> > +                                     if($email_address eq $author_address) {
>
> No space after if, etc...
>
> > @@ -6891,9 +6917,32 @@ sub process {
> >               if ($signoff == 0) {
> >                       ERROR("MISSING_SIGN_OFF",
> >                             "Missing Signed-off-by: line(s)\n");
> > -             } elsif (!$authorsignoff) {
> > -                     WARN("NO_AUTHOR_SIGN_OFF",
> > -                          "Missing Signed-off-by: line by nominal patch author '$author'\n");
> > +             } elsif ($authorsignoff != 1) {
> > +                     # authorsignoff values:
> > +                     # 0 -> missing sign off
> > +                     # 1 -> sign off present
>
> sign off identical
>
> > +                     # 2 -> address matches, name different
> > +                     # 3 -> name matches, address different
> > +                     # 4 -> name matches, address matches without extension
>
> extension here isn't obvious

Yeah I was thinking of that. I was a bit confused about the message.
Will it be better as "address excluding mail extensions matches"?

>
> > +
> > +                     my $ctx_msg = "'Signed-off-by: $authorsignoff_ctx' should be:\n'Signed-off-by: $author'";
>
> New line not necessary or useful really.
>
> And for mismatches, it's really not known that
> it should be one way or the or the other is it?
>

I think that's true. But since the mail in the
From: part is the one which with others are being
compared, I think maybe it should have the higher
priority, and be treated as the expected one.

Otherwise I could change the message accordingly.

> > +
> > +                     if($authorsignoff == 0) {
> > +                             WARN("NO_AUTHOR_SIGN_OFF",
> > +                                     "Missing Signed-off-by: line by nominal patch author '$author'\n");
> > +                     }
> > +                     elsif($authorsignoff == 2) {
> > +                             WARN("NO_AUTHOR_SIGN_OFF",
> > +                                     "Author name mismatch:\n$ctx_msg\n");
> > +                     }
> > +                     elsif($authorsignoff == 3) {
> > +                             WARN("NO_AUTHOR_SIGN_OFF",
> > +                                     "Author address mismatch:\n$ctx_msg\n");
> > +                     }
> > +                     elsif($authorsignoff == 4) {
> > +                             CHK("NO_AUTHOR_SIGN_OFF",
> > +                                     "Author mail extension mismatch:\n$ctx_msg\n");
> > +                     }
> >               }
> >       }
> >
>
Thanks,
Dwaipayan.
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH RFC] checkpatch: add new warnings to author signoff checks.
  2020-10-05  7:40   ` Dwaipayan Ray
@ 2020-10-05  8:05     ` Joe Perches
       [not found]       ` <CABJPP5CAY+qJU8wnGZ7JgugeN9CyFbdct6nAsxpY0NdyaNuWLQ@mail.gmail.com>
  0 siblings, 1 reply; 9+ messages in thread
From: Joe Perches @ 2020-10-05  8:05 UTC (permalink / raw)
  To: Dwaipayan Ray; +Cc: linux-kernel-mentees, linux-kernel

On Mon, 2020-10-05 at 13:10 +0530, Dwaipayan Ray wrote:
> On Mon, Oct 5, 2020 at 12:48 PM Joe Perches <joe@perches.com> wrote:
> > On Mon, 2020-10-05 at 12:18 +0530, Dwaipayan Ray wrote:
> > > The author signed-off-by checks are currently very vague.
> > > Cases like same name or same address are not handled separately.
[]
> > And for mismatches, it's really not known that
> > it should be one way or the or the other is it?
> > 
> 
> I think that's true. But since the mail in the
> From: part is the one which with others are being
> compared, I think maybe it should have the higher
> priority, and be treated as the expected one.

I rather expect it to be the other way around.

The Signed-off-by: line should be authoritative
as that is what is put in the commit log.



_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH RFC] checkpatch: add new warnings to author signoff checks.
       [not found]         ` <f1536dd1c1fbf53a848b27a2817a973fbf809719.camel@perches.com>
@ 2020-10-05  8:52           ` Dwaipayan Ray
  0 siblings, 0 replies; 9+ messages in thread
From: Dwaipayan Ray @ 2020-10-05  8:52 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel-mentees, linux-kernel

On Mon, Oct 5, 2020 at 2:13 PM Joe Perches <joe@perches.com> wrote:
>
> On Mon, 2020-10-05 at 13:50 +0530, Dwaipayan Ray wrote:
> > On Mon, Oct 5, 2020 at 1:35 PM Joe Perches <joe@perches.com> wrote:
> > > On Mon, 2020-10-05 at 13:10 +0530, Dwaipayan Ray wrote:
> > > > On Mon, Oct 5, 2020 at 12:48 PM Joe Perches <joe@perches.com> wrote:
> > > > > On Mon, 2020-10-05 at 12:18 +0530, Dwaipayan Ray wrote:
> > > > > > The author signed-off-by checks are currently very vague.
> > > > > > Cases like same name or same address are not handled separately.
> > > []
> > > > > And for mismatches, it's really not known that
> > > > > it should be one way or the or the other is it?
> > > > >
> > > >
> > > > I think that's true. But since the mail in the
> > > > From: part is the one which with others are being
> > > > compared, I think maybe it should have the higher
> > > > priority, and be treated as the expected one.
> > >
> > > I rather expect it to be the other way around.
> > >
> > > The Signed-off-by: line should be authoritative
> > > as that is what is put in the commit log.
> > >
> > >
> > Yes that makes sense. So is it just better to point at
> > the difference?
> > Like:
> > Author email in From: (something) differs from
> > Signed-off-by: (something2).
>
> I think so yes.
>
> That's what I suggested when I replied to you
> with your first attempt.
>
> https://lore.kernel.org/lkml/7958ded756c895ca614ba900aae7b830a992475e.camel@perches.com/
>
>                         WARN("NO_AUTHOR_SIGN_OFF",
>                              "From:/SoB: email address mismatch: 'From: $author' != 'Signed-off-by: $authorsignoff'\n");
>
> And please keep replies on list.
>
Yes sure, I missed to cc the list.

I will fix the issues and get back to you with a new patch.

Thanks,
Dwaipayan.
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH RFC] checkpatch: add new warnings to author signoff checks.
  2020-10-05  6:19 ` Lukas Bulwahn
@ 2020-10-05  6:46   ` Dwaipayan Ray
  0 siblings, 0 replies; 9+ messages in thread
From: Dwaipayan Ray @ 2020-10-05  6:46 UTC (permalink / raw)
  To: Lukas Bulwahn; +Cc: linux-kernel-mentees

On Mon, Oct 5, 2020 at 11:49 AM Lukas Bulwahn <lukas.bulwahn@gmail.com> wrote:
>
>
>
> On Sun, 4 Oct 2020, Dwaipayan Ray wrote:
>
> > The author signed-off-by checks are currently very vague.
> > Cases like same name or same address are not handled separately.
> >
> > For example, running checkpatch on commit be6577af0cef
> > ("parisc: Add atomic64_set_release() define to avoid CPU soft lockups"),
> > gives:
> >
> > WARNING: Missing Signed-off-by: line by nominal patch author
> > 'John David Anglin <dave.anglin@bell.net>'
> >
> > The signoff line was:
> > "Signed-off-by: Dave Anglin <dave.anglin@bell.net>"
> >
> > Clearly the author has signed off but with a slightly different version
> > of his name. A more appropriate warning would have been to point out
> > at the name mismatch instead.
> >
> > Introduced three new types of warnings:
> >
> > 1) Address matches, but names are different.
> >    "James Watson <james@gmail.com>", "James <james@gmail.com>"
> >
> > 2) Name matches, but addresses are different.
> >    "James Watson <james@watson.com>", "James Watson <james@gmail.com>"
> >
> > 3) Name matches, but addresses without mail extensions are same.
> >    "James Watson <james@gmail.com>", "James Watson <james+a@gmail.com>"
> >
> > For the 3rd class, a --strict check message is generated, and for the
> > other two, warnings are generated.
> >
>
> Dwaipayan, I think it a good patch to start the discussion.
>
> Feel free to send this to Joe and lkml.
>
> > Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
> > ---
> >  scripts/checkpatch.pl | 57 ++++++++++++++++++++++++++++++++++++++++---
> >  1 file changed, 53 insertions(+), 4 deletions(-)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 31624bbb342e..80feb15f93cb 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -2347,6 +2347,7 @@ sub process {
> >       my $signoff = 0;
> >       my $author = '';
> >       my $authorsignoff = 0;
> > +     my $authorsignoff_ctx = '';
> >       my $is_patch = 0;
> >       my $is_binding_patch = -1;
> >       my $in_header_lines = $file ? 0 : 1;
> > @@ -2674,9 +2675,34 @@ sub process {
> >               if ($line =~ /^\s*signed-off-by:\s*(.*)/i) {
> >                       $signoff++;
> >                       $in_commit_log = 0;
> > -                     if ($author ne '') {
> > +                     if ($author ne ''  && $authorsignoff != 1) {
> >                               if (same_email_addresses($1, $author)) {
> >                                       $authorsignoff = 1;
> > +                             } else {
> > +                                     my $ctx = $1;
> > +                                     my ($email_name, $email_comment, $email_address, $comment1) = parse_email($ctx);
> > +                                     my ($author_name, $author_comment, $author_address, $comment2) = parse_email($author);
> > +
> > +                                     if($email_address eq $author_address) {
> > +                                             $authorsignoff_ctx = $ctx;
> > +                                             $authorsignoff = 2;
> > +                                     } elsif ($email_name eq $author_name) {
> > +                                             $authorsignoff_ctx = $ctx;
> > +                                             $authorsignoff = 3;
> > +
> > +                                             my $address1 = $email_address;
> > +                                             my $address2 = $author_address;
> > +
> > +                                             if ($address1 =~ /(\S+)\+\S+(\@.*)/) {
> > +                                                     $address1 = $1.$2;
> > +                                             }
> > +                                             if ($address2 =~ /(\S+)\+\S+(\@.*)/) {
> > +                                                     $address2 = $1.$2;
> > +                                             }
> > +                                             if($address1 eq $address2) {
> > +                                                     $authorsignoff = 4;
> > +                                             }
> > +                                     }
> >                               }
> >                       }
> >               }
> > @@ -6891,9 +6917,32 @@ sub process {
> >               if ($signoff == 0) {
> >                       ERROR("MISSING_SIGN_OFF",
> >                             "Missing Signed-off-by: line(s)\n");
> > -             } elsif (!$authorsignoff) {
> > -                     WARN("NO_AUTHOR_SIGN_OFF",
> > -                          "Missing Signed-off-by: line by nominal patch author '$author'\n");
> > +             } elsif ($authorsignoff != 1) {
> > +                     # authorsignoff values:
> > +                     # 0 -> missing sign off
> > +                     # 1 -> sign off present
> > +                     # 2 -> address matches, name different
> > +                     # 3 -> name matches, address different
> > +                     # 4 -> name matches, address matches without extension
> > +
> > +                     my $ctx_msg = "'Signed-off-by: $authorsignoff_ctx' should be:\n'Signed-off-by: $author'";
> > +
> > +                     if($authorsignoff == 0) {
> > +                             WARN("NO_AUTHOR_SIGN_OFF",
> > +                                     "Missing Signed-off-by: line by nominal patch author '$author'\n");
>
> I think in this case, we could actually turn this into an ERROR; now that
> we have the refined cases (2,3,4) on which we would just warn or 'note'
> with --strict checks.
>
> Send it as is to Joe Perches and lkml and I will repeat my comment on that
> mail and we will discuss it with Joe.

Okay sure I will do that. Thanks!

Dwaipayan
>
> Lukas
>
> > +                     }
> > +                     elsif($authorsignoff == 2) {
> > +                             WARN("NO_AUTHOR_SIGN_OFF",
> > +                                     "Author name mismatch:\n$ctx_msg\n");
> > +                     }
> > +                     elsif($authorsignoff == 3) {
> > +                             WARN("NO_AUTHOR_SIGN_OFF",
> > +                                     "Author address mismatch:\n$ctx_msg\n");
> > +                     }
> > +                     elsif($authorsignoff == 4) {
> > +                             CHK("NO_AUTHOR_SIGN_OFF",
> > +                                     "Author mail extension mismatch:\n$ctx_msg\n");
> > +                     }
> >               }
> >       }
> >
> > --
> > 2.27.0
> >
> >
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH RFC] checkpatch: add new warnings to author signoff checks.
  2020-10-04 14:38 Dwaipayan Ray
@ 2020-10-05  6:19 ` Lukas Bulwahn
  2020-10-05  6:46   ` Dwaipayan Ray
  0 siblings, 1 reply; 9+ messages in thread
From: Lukas Bulwahn @ 2020-10-05  6:19 UTC (permalink / raw)
  To: Dwaipayan Ray; +Cc: linux-kernel-mentees



On Sun, 4 Oct 2020, Dwaipayan Ray wrote:

> The author signed-off-by checks are currently very vague.
> Cases like same name or same address are not handled separately.
> 
> For example, running checkpatch on commit be6577af0cef
> ("parisc: Add atomic64_set_release() define to avoid CPU soft lockups"),
> gives:
> 
> WARNING: Missing Signed-off-by: line by nominal patch author
> 'John David Anglin <dave.anglin@bell.net>'
> 
> The signoff line was:
> "Signed-off-by: Dave Anglin <dave.anglin@bell.net>"
> 
> Clearly the author has signed off but with a slightly different version
> of his name. A more appropriate warning would have been to point out
> at the name mismatch instead.
> 
> Introduced three new types of warnings:
> 
> 1) Address matches, but names are different.
>    "James Watson <james@gmail.com>", "James <james@gmail.com>"
> 
> 2) Name matches, but addresses are different.
>    "James Watson <james@watson.com>", "James Watson <james@gmail.com>"
> 
> 3) Name matches, but addresses without mail extensions are same.
>    "James Watson <james@gmail.com>", "James Watson <james+a@gmail.com>"
> 
> For the 3rd class, a --strict check message is generated, and for the
> other two, warnings are generated.
>

Dwaipayan, I think it a good patch to start the discussion.

Feel free to send this to Joe and lkml.
 
> Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
> ---
>  scripts/checkpatch.pl | 57 ++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 53 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 31624bbb342e..80feb15f93cb 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2347,6 +2347,7 @@ sub process {
>  	my $signoff = 0;
>  	my $author = '';
>  	my $authorsignoff = 0;
> +	my $authorsignoff_ctx = '';
>  	my $is_patch = 0;
>  	my $is_binding_patch = -1;
>  	my $in_header_lines = $file ? 0 : 1;
> @@ -2674,9 +2675,34 @@ sub process {
>  		if ($line =~ /^\s*signed-off-by:\s*(.*)/i) {
>  			$signoff++;
>  			$in_commit_log = 0;
> -			if ($author ne '') {
> +			if ($author ne ''  && $authorsignoff != 1) {
>  				if (same_email_addresses($1, $author)) {
>  					$authorsignoff = 1;
> +				} else {
> +					my $ctx = $1;
> +					my ($email_name, $email_comment, $email_address, $comment1) = parse_email($ctx);
> +					my ($author_name, $author_comment, $author_address, $comment2) = parse_email($author);
> +
> +					if($email_address eq $author_address) {
> +						$authorsignoff_ctx = $ctx;
> +						$authorsignoff = 2;
> +					} elsif ($email_name eq $author_name) {
> +						$authorsignoff_ctx = $ctx;
> +						$authorsignoff = 3;
> +
> +						my $address1 = $email_address;
> +						my $address2 = $author_address;
> +
> +						if ($address1 =~ /(\S+)\+\S+(\@.*)/) {
> +							$address1 = $1.$2;
> +						}
> +						if ($address2 =~ /(\S+)\+\S+(\@.*)/) {
> +							$address2 = $1.$2;
> +						}
> +						if($address1 eq $address2) {
> +							$authorsignoff = 4;
> +						}
> +					}
>  				}
>  			}
>  		}
> @@ -6891,9 +6917,32 @@ sub process {
>  		if ($signoff == 0) {
>  			ERROR("MISSING_SIGN_OFF",
>  			      "Missing Signed-off-by: line(s)\n");
> -		} elsif (!$authorsignoff) {
> -			WARN("NO_AUTHOR_SIGN_OFF",
> -			     "Missing Signed-off-by: line by nominal patch author '$author'\n");
> +		} elsif ($authorsignoff != 1) {
> +			# authorsignoff values:
> +			# 0 -> missing sign off
> +			# 1 -> sign off present
> +			# 2 -> address matches, name different
> +			# 3 -> name matches, address different
> +			# 4 -> name matches, address matches without extension
> +
> +			my $ctx_msg = "'Signed-off-by: $authorsignoff_ctx' should be:\n'Signed-off-by: $author'";
> +
> +			if($authorsignoff == 0) {
> +				WARN("NO_AUTHOR_SIGN_OFF",
> +					"Missing Signed-off-by: line by nominal patch author '$author'\n");

I think in this case, we could actually turn this into an ERROR; now that 
we have the refined cases (2,3,4) on which we would just warn or 'note' 
with --strict checks.

Send it as is to Joe Perches and lkml and I will repeat my comment on that 
mail and we will discuss it with Joe.

Lukas

> +			}
> +			elsif($authorsignoff == 2) {
> +				WARN("NO_AUTHOR_SIGN_OFF",
> +					"Author name mismatch:\n$ctx_msg\n");
> +			}
> +			elsif($authorsignoff == 3) {
> +				WARN("NO_AUTHOR_SIGN_OFF",
> +					"Author address mismatch:\n$ctx_msg\n");
> +			}
> +			elsif($authorsignoff == 4) {
> +				CHK("NO_AUTHOR_SIGN_OFF",
> +					"Author mail extension mismatch:\n$ctx_msg\n");
> +			}
>  		}
>  	}
>  
> -- 
> 2.27.0
> 
> 
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Linux-kernel-mentees] [PATCH RFC] checkpatch: add new warnings to author signoff checks.
@ 2020-10-04 14:38 Dwaipayan Ray
  2020-10-05  6:19 ` Lukas Bulwahn
  0 siblings, 1 reply; 9+ messages in thread
From: Dwaipayan Ray @ 2020-10-04 14:38 UTC (permalink / raw)
  To: lukas.bulwahn; +Cc: dwaipayanray1, linux-kernel-mentees

The author signed-off-by checks are currently very vague.
Cases like same name or same address are not handled separately.

For example, running checkpatch on commit be6577af0cef
("parisc: Add atomic64_set_release() define to avoid CPU soft lockups"),
gives:

WARNING: Missing Signed-off-by: line by nominal patch author
'John David Anglin <dave.anglin@bell.net>'

The signoff line was:
"Signed-off-by: Dave Anglin <dave.anglin@bell.net>"

Clearly the author has signed off but with a slightly different version
of his name. A more appropriate warning would have been to point out
at the name mismatch instead.

Introduced three new types of warnings:

1) Address matches, but names are different.
   "James Watson <james@gmail.com>", "James <james@gmail.com>"

2) Name matches, but addresses are different.
   "James Watson <james@watson.com>", "James Watson <james@gmail.com>"

3) Name matches, but addresses without mail extensions are same.
   "James Watson <james@gmail.com>", "James Watson <james+a@gmail.com>"

For the 3rd class, a --strict check message is generated, and for the
other two, warnings are generated.

Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
---
 scripts/checkpatch.pl | 57 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 53 insertions(+), 4 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 31624bbb342e..80feb15f93cb 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2347,6 +2347,7 @@ sub process {
 	my $signoff = 0;
 	my $author = '';
 	my $authorsignoff = 0;
+	my $authorsignoff_ctx = '';
 	my $is_patch = 0;
 	my $is_binding_patch = -1;
 	my $in_header_lines = $file ? 0 : 1;
@@ -2674,9 +2675,34 @@ sub process {
 		if ($line =~ /^\s*signed-off-by:\s*(.*)/i) {
 			$signoff++;
 			$in_commit_log = 0;
-			if ($author ne '') {
+			if ($author ne ''  && $authorsignoff != 1) {
 				if (same_email_addresses($1, $author)) {
 					$authorsignoff = 1;
+				} else {
+					my $ctx = $1;
+					my ($email_name, $email_comment, $email_address, $comment1) = parse_email($ctx);
+					my ($author_name, $author_comment, $author_address, $comment2) = parse_email($author);
+
+					if($email_address eq $author_address) {
+						$authorsignoff_ctx = $ctx;
+						$authorsignoff = 2;
+					} elsif ($email_name eq $author_name) {
+						$authorsignoff_ctx = $ctx;
+						$authorsignoff = 3;
+
+						my $address1 = $email_address;
+						my $address2 = $author_address;
+
+						if ($address1 =~ /(\S+)\+\S+(\@.*)/) {
+							$address1 = $1.$2;
+						}
+						if ($address2 =~ /(\S+)\+\S+(\@.*)/) {
+							$address2 = $1.$2;
+						}
+						if($address1 eq $address2) {
+							$authorsignoff = 4;
+						}
+					}
 				}
 			}
 		}
@@ -6891,9 +6917,32 @@ sub process {
 		if ($signoff == 0) {
 			ERROR("MISSING_SIGN_OFF",
 			      "Missing Signed-off-by: line(s)\n");
-		} elsif (!$authorsignoff) {
-			WARN("NO_AUTHOR_SIGN_OFF",
-			     "Missing Signed-off-by: line by nominal patch author '$author'\n");
+		} elsif ($authorsignoff != 1) {
+			# authorsignoff values:
+			# 0 -> missing sign off
+			# 1 -> sign off present
+			# 2 -> address matches, name different
+			# 3 -> name matches, address different
+			# 4 -> name matches, address matches without extension
+
+			my $ctx_msg = "'Signed-off-by: $authorsignoff_ctx' should be:\n'Signed-off-by: $author'";
+
+			if($authorsignoff == 0) {
+				WARN("NO_AUTHOR_SIGN_OFF",
+					"Missing Signed-off-by: line by nominal patch author '$author'\n");
+			}
+			elsif($authorsignoff == 2) {
+				WARN("NO_AUTHOR_SIGN_OFF",
+					"Author name mismatch:\n$ctx_msg\n");
+			}
+			elsif($authorsignoff == 3) {
+				WARN("NO_AUTHOR_SIGN_OFF",
+					"Author address mismatch:\n$ctx_msg\n");
+			}
+			elsif($authorsignoff == 4) {
+				CHK("NO_AUTHOR_SIGN_OFF",
+					"Author mail extension mismatch:\n$ctx_msg\n");
+			}
 		}
 	}
 
-- 
2.27.0

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-10-05  8:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05  6:48 [Linux-kernel-mentees] [PATCH RFC] checkpatch: add new warnings to author signoff checks Dwaipayan Ray
2020-10-05  7:18 ` Joe Perches
2020-10-05  7:40   ` Dwaipayan Ray
2020-10-05  8:05     ` Joe Perches
     [not found]       ` <CABJPP5CAY+qJU8wnGZ7JgugeN9CyFbdct6nAsxpY0NdyaNuWLQ@mail.gmail.com>
     [not found]         ` <f1536dd1c1fbf53a848b27a2817a973fbf809719.camel@perches.com>
2020-10-05  8:52           ` Dwaipayan Ray
2020-10-05  7:30 ` Lukas Bulwahn
  -- strict thread matches above, loose matches on Subject: below --
2020-10-04 14:38 Dwaipayan Ray
2020-10-05  6:19 ` Lukas Bulwahn
2020-10-05  6:46   ` Dwaipayan Ray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).