linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH] checkpatch: fix author Signed-off-by warning for split From: header
@ 2020-09-18 12:29 Dwaipayan Ray
  2020-09-18 12:58 ` Lukas Bulwahn
  0 siblings, 1 reply; 5+ messages in thread
From: Dwaipayan Ray @ 2020-09-18 12:29 UTC (permalink / raw)
  To: lukas.bulwahn; +Cc: dwaipayanray1, linux-kernel-mentees

Checkpatch did not handle cases where the author From: header was
split into two lines. In those cases the author string went empty,
and checkpatch generated a false missing author signed-off-by
warning.

This patch adds support for split From: headers and resolves those
false warnings.

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

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 504d2e431c60..8c4119ca7d17 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2347,6 +2347,7 @@ sub process {
 	my $signoff = 0;
 	my $author = '';
 	my $authorsignoff = 0;
+	my $prevheader = 0;
 	my $is_patch = 0;
 	my $is_binding_patch = -1;
 	my $in_header_lines = $file ? 0 : 1;
@@ -2658,12 +2659,22 @@ sub process {
 			}
 		}
 
+# Check the patch for a split From:
+		if ($author eq '' && decode("MIME-Header", $prevheader) =~ /^From:\s*(.*)/) {
+			$author = $1.$line;
+			$author = encode("utf8", $author) if ($prevheader =~ /=\?utf-8\?/i);
+			$author =~ s/"//g;
+			$author = reformat_email($author);
+			$prevheader = '';
+		}
+
 # Check the patch for a From:
 		if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) {
 			$author = $1;
 			$author = encode("utf8", $author) if ($line =~ /=\?utf-8\?/i);
 			$author =~ s/"//g;
 			$author = reformat_email($author);
+			$prevheader = $line;
 		}
 
 # Check the patch for a signoff:
-- 
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] 5+ messages in thread

end of thread, other threads:[~2020-09-19  7:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 12:29 [Linux-kernel-mentees] [PATCH] checkpatch: fix author Signed-off-by warning for split From: header Dwaipayan Ray
2020-09-18 12:58 ` Lukas Bulwahn
2020-09-18 15:05   ` Dwaipayan Ray
2020-09-19  5:57   ` Dwaipayan Ray
2020-09-19  7:25     ` Lukas Bulwahn

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).