Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1607206 > unrolled thread

Re: [PATCH] checkpatch: Allow space leading blank lines in email headers

Started byDarren Hart <dvhart@infradead.org>
First post2017-03-23 08:50 +0100
Last post2017-03-23 17:00 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] checkpatch: Allow space leading blank lines in email  headers Darren Hart <dvhart@infradead.org> - 2017-03-23 08:50 +0100
    Re: [PATCH] checkpatch: Allow space leading blank lines in email  headers Joe Perches <joe@perches.com> - 2017-03-23 08:50 +0100
      Re: [PATCH] checkpatch: Allow space leading blank lines in email  headers Darren Hart <dvhart@infradead.org> - 2017-03-23 17:00 +0100

#1607206 — Re: [PATCH] checkpatch: Allow space leading blank lines in email headers

FromDarren Hart <dvhart@infradead.org>
Date2017-03-23 08:50 +0100
SubjectRe: [PATCH] checkpatch: Allow space leading blank lines in email headers
Message-ID<to5Fo-7vn-9@gated-at.bofh.it>
On Wed, Mar 22, 2017 at 10:35:21PM -0700, Joe Perches wrote:
> Allow a leading space and otherwise blank link in the email headers
> as it can be a line wrapped Spamassassin multiple line string or any
> other valid rfc 2822/5322 email header.
> 
> 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.
> 
> Reported-by: Darren Hart (VMware) <dvhart@infradead.org>
> Original-patch-by: John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  scripts/checkpatch.pl | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 832e8150dba3..089c974aa3a5 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2628,8 +2628,8 @@ 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 && $realfile =~ /^$/ &&
> -		    !($rawline =~ /^\s+\S/ ||
> -		      $rawline =~ /^(commit\b|from\b|[\w-]+:).*$/i)) {
> +		    !($rawline =~ /^\s+(?:\S|$)/ ||

First, thanks Joe. The above change alone is sufficient to resolve the specific
issue I observed with the long header fields (RFC 5322 2.2.3) used by spam
assassin.

Tested-by: Darren Hart (VMware) <dvhart@infradead.org>

I do have an open question regarding how we're going about testing for the end
of the header lines. Since we're not just testing for an empty line to separate
headers and body, there is clearly more going on here - but I'm not sure what it
is ... so I can't be sure this doesn't have an unintended consequence.

> +		      $rawline =~ /^(?:commit\b|from\b|[\w-]+:)/i)) {

This appears to be an unrelated change, introducing the non-capturing-group
(?:) and dropping the superfluous .*$ postfix. Did I get that right?

-- 
Darren Hart
VMware Open Source Technology Center

[toc] | [next] | [standalone]


#1607209

FromJoe Perches <joe@perches.com>
Date2017-03-23 08:50 +0100
Message-ID<to5Fp-7vn-29@gated-at.bofh.it>
In reply to#1607206
On Wed, 2017-03-22 at 23:20 -0700, Darren Hart wrote:
> I do have an open question regarding how we're going about testing for the end
> of the header lines. Since we're not just testing for an empty line to separate
> headers and body, there is clearly more going on here - but I'm not sure what it
> is ... so I can't be sure this doesn't have an unintended consequence.
> 
> > +		      $rawline =~ /^(?:commit\b|from\b|[\w-]+:)/i)) {
> 
> This appears to be an unrelated change, introducing the non-capturing-group
> (?:) and dropping the superfluous .*$ postfix. Did I get that right?

Exactly right.

The capturing of the initial bit of the match and
testing of the rest of the line is simply unnecessary.

I frequently make localized changes like that when I
notice them.  It's not a problem.

cheers, Joe

[toc] | [prev] | [next] | [standalone]


#1607643

FromDarren Hart <dvhart@infradead.org>
Date2017-03-23 17:00 +0100
Message-ID<todjz-4ib-3@gated-at.bofh.it>
In reply to#1607209
On Wed, Mar 22, 2017 at 11:28:40PM -0700, Joe Perches wrote:
> On Wed, 2017-03-22 at 23:20 -0700, Darren Hart wrote:
> > I do have an open question regarding how we're going about testing for the end
> > of the header lines. Since we're not just testing for an empty line to separate
> > headers and body, there is clearly more going on here - but I'm not sure what it
> > is ... so I can't be sure this doesn't have an unintended consequence.
> > 
> > > +		      $rawline =~ /^(?:commit\b|from\b|[\w-]+:)/i)) {
> > 
> > This appears to be an unrelated change, introducing the non-capturing-group
> > (?:) and dropping the superfluous .*$ postfix. Did I get that right?
> 
> Exactly right.
> 
> The capturing of the initial bit of the match and
> testing of the rest of the line is simply unnecessary.
> 
> I frequently make localized changes like that when I
> notice them.  It's not a problem.

Thanks Joe. Your call, when I see unrelated changes in patches to me I ask that
they be broken out or at least mentioned in the commit log - which is why I
asked, in case it slipped in unintentionally.

The fix addresses my concern in what appears to be the simplest possible way,
and generally for long header fields, with minimal change.

In addition to my tested-by, feel free to include my review tag:

Reviewed-by: Darren Hart (VMware) <dvhart@vmware.com>

Thanks to both you and John for the time on this.

-- 
Darren Hart
VMware Open Source Technology Center

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web