Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1605784
| From | "John 'Warthog9' Hawley (VMware)" <warthog9@eaglescrag.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] checkpatch: Flag spam header (X-Spam-Report) to prevent spurious warnings |
| Date | 2017-03-21 17:40 +0100 |
| Message-ID | <tnuZb-5Ru-1@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Spamassassin sticks a long (~79 character) long string after a
line that has a single space in it. The line with space causes
checkpatch to erroniously think that it's in the content body, as
opposed to headers and thus flag a mail header as an unwrapped long
comment line.
This flags when X-Spam-Report is found, till an e-mail
body indicator (blank line, /^[/n/r]*/) is found, blocking setting
$in_commit_log. When found, unsets itself allowing the rest of
the detection to function normally.
Reported-by: Darren Hart (VMware) <dvhart@infradead.org>
Signed-off-by: John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>
---
scripts/checkpatch.pl | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index baa3c7b..d2ce89a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2134,6 +2134,7 @@ sub process {
my $signoff = 0;
my $is_patch = 0;
my $in_header_lines = $file ? 0 : 1;
+ my $found_spam_header = 0;
my $in_commit_log = 0; #Scanning lines before patch
my $has_commit_log = 0; #Encountered lines before patch
my $commit_log_possible_stack_dump = 0;
@@ -2279,6 +2280,12 @@ sub process {
my $rawline = $rawlines[$linenr - 1];
+#if we encounter a spamassassin mail header, mark it
+ if ($in_header_lines == 1 && $line =~ /^X-Spam-Report:/) {
+ #mail header found, this needs to be flagged
+ $found_spam_header = 1;
+ }
+
#extract the line range in the file after the patch is applied
if (!$in_commit_log &&
$line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) {
@@ -2627,9 +2634,15 @@ sub process {
# Check if it's the start of a commit log
# (not a header line and we haven't seen the patch filename)
+ if ($in_header_lines && $found_spam_header && $line =~ /^[\n\r]*$/) {
+ # we are now past the header info that could be confusing
+ $found_spam_header = 0;
+ }
+
if ($in_header_lines && $realfile =~ /^$/ &&
!($rawline =~ /^\s+\S/ ||
- $rawline =~ /^(commit\b|from\b|[\w-]+:).*$/i)) {
+ $rawline =~ /^(commit\b|from\b|[\w-]+:).*$/i) &&
+ !$found_spam_header) {
$in_header_lines = 0;
$in_commit_log = 1;
$has_commit_log = 1;
--
2.5.5
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] checkpatch: Flag spam header (X-Spam-Report) to prevent spurious warnings "John 'Warthog9' Hawley (VMware)" <warthog9@eaglescrag.net> - 2017-03-21 17:40 +0100
Re: [PATCH] checkpatch: Flag spam header (X-Spam-Report) to prevent spurious warnings Joe Perches <joe@perches.com> - 2017-03-21 20:00 +0100
Re: [PATCH] checkpatch: Flag spam header (X-Spam-Report) to prevent spurious warnings Darren Hart <dvhart@infradead.org> - 2017-03-22 16:30 +0100
Re: [PATCH] checkpatch: Flag spam header (X-Spam-Report) to prevent spurious warnings Joe Perches <joe@perches.com> - 2017-03-22 19:20 +0100
Re: [PATCH] checkpatch: Flag spam header (X-Spam-Report) to prevent spurious warnings Darren Hart <dvhart@infradead.org> - 2017-03-23 08:50 +0100
Re: [PATCH] checkpatch: Flag spam header (X-Spam-Report) to prevent spurious warnings Joe Perches <joe@perches.com> - 2017-03-23 09:40 +0100
Re: [PATCH] checkpatch: Flag spam header (X-Spam-Report) to prevent spurious warnings John 'Warthog9' Hawley <warthog9@eaglescrag.net> - 2017-03-24 21:20 +0100
Re: [PATCH] checkpatch: Flag spam header (X-Spam-Report) to prevent spurious warnings John 'Warthog9' Hawley <warthog9@eaglescrag.net> - 2017-03-24 21:20 +0100
csiph-web