Skip to content

Commit

Permalink
checkpatch: extend author Signed-off-by check for split From: header
Browse files Browse the repository at this point in the history
Checkpatch did not handle cases where the author From: header was split
into multiple lines.  The author identity could not be resolved and
checkpatch generated a false NO_AUTHOR_SIGN_OFF warning.

A typical example is commit e33bcba ("tee: add support for session's
client UUID generation").  When checkpatch was run on this commit, it
displayed:

"WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal
patch author ''"

This was due to split header lines not being handled properly and the
author himself wrote in commit cd26149 ("checkpatch: warn if missing
author Signed-off-by"):

"Split From: headers are not fully handled: only the first part
is compared."

Support split From: headers by correctly parsing the header extension
lines.  RFC 5322, Section-2.2.3 stated that each extended line must start
with a WSP character (a space or htab).  The solution was therefore to
concatenate the lines which start with a WSP to get the correct long
header.

Suggested-by: Joe Perches <[email protected]>
Signed-off-by: Dwaipayan Ray <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Tested-by: Lukas Bulwahn <[email protected]>
Reviewed-by: Lukas Bulwahn <[email protected]>
Acked-by: Joe Perches <[email protected]>
Link: https://lore.kernel.org/linux-kernel-mentees/[email protected]/
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
raydwaipayan authored and torvalds committed Oct 16, 2020
1 parent f5f6132 commit e7f929f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2679,6 +2679,10 @@ sub process {
# Check the patch for a From:
if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) {
$author = $1;
my $curline = $linenr;
while(defined($rawlines[$curline]) && ($rawlines[$curline++] =~ /^[ \t]\s*(.*)/)) {
$author .= $1;
}
$author = encode("utf8", $author) if ($line =~ /=\?utf-8\?/i);
$author =~ s/"//g;
$author = reformat_email($author);
Expand Down

0 comments on commit e7f929f

Please sign in to comment.