email header lines can look like signature tags. It's valid to have multiple email recipients on a single line but not valid to have multiple signatures on a single line. Validate signatures only when not in the email headers. Clear the $in_commit_log flag when the patch filename appears. Add '-' to the valid chars in a message header for headers like "Message-Id:" and "In-Reply-To:".
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -1504,9 +1504,11 @@ sub process { · 1503 unmodified lines | |||
| 1504 | if ($line =~ /^diff --git.*?(\S+)$/) { | 1504 | if ($line =~ /^diff --git.*?(\S+)$/) { |
| 1505 | $realfile = $1; | 1505 | $realfile = $1; |
| 1506 | $realfile =~ s@^([^/]*)/@@; | 1506 | $realfile =~ s@^([^/]*)/@@; |
| 1507 | $in_commit_log = 0; | ||
| 1507 | } elsif ($line =~ /^\+\+\+\s+(\S+)/) { | 1508 | } elsif ($line =~ /^\+\+\+\s+(\S+)/) { |
| 1508 | $realfile = $1; | 1509 | $realfile = $1; |
| 1509 | $realfile =~ s@^([^/]*)/@@; | 1510 | $realfile =~ s@^([^/]*)/@@; |
| 1511 | $in_commit_log = 0; | ||
| 1510 | 1512 | ||
| 1511 | $p1_prefix = $1; | 1513 | $p1_prefix = $1; |
| 1512 | if (!$file && $tree && $p1_prefix ne '' && | 1514 | if (!$file && $tree && $p1_prefix ne '' && |
| @@ -1546,7 +1548,8 @@ sub process { · 33 unmodified lines | |||
| 1546 | } | 1548 | } |
| 1547 | 1549 | ||
| 1548 | # Check signature styles | 1550 | # Check signature styles |
| 1549 | if ($line =~ /^(\s*)($signature_tags)(\s*)(.*)/) { | 1551 | if (!$in_header_lines && |
| 1552 | $line =~ /^(\s*)($signature_tags)(\s*)(.*)/) { | ||
| 1550 | my $space_before = $1; | 1553 | my $space_before = $1; |
| 1551 | my $sign_off = $2; | 1554 | my $sign_off = $2; |
| 1552 | my $space_after = $3; | 1555 | my $space_after = $3; |
| @@ -1623,7 +1626,7 @@ sub process { · 70 unmodified lines | |||
| 1623 | # Check if it's the start of a commit log | 1626 | # Check if it's the start of a commit log |
| 1624 | # (not a header line and we haven't seen the patch filename) | 1627 | # (not a header line and we haven't seen the patch filename) |
| 1625 | if ($in_header_lines && $realfile =~ /^$/ && | 1628 | if ($in_header_lines && $realfile =~ /^$/ && |
| 1626 | $rawline !~ /^(commit\b|from\b|\w+:).+$/i) { | 1629 | $rawline !~ /^(commit\b|from\b|[\w-]+:).+$/i) { |
| 1627 | $in_header_lines = 0; | 1630 | $in_header_lines = 0; |
| 1628 | $in_commit_log = 1; | 1631 | $in_commit_log = 1; |
| 1629 | } | 1632 | } |