The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Julia Lawall <julia.lawall@lip6.fr>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Andy Whitcroft <apw@shadowen.org>
Subject: [PATCH] checkpatch: Update signature "might be better as" warning
Date: Sun, 06 Nov 2011 11:00:27 +0200	[thread overview]
Message-ID: <1320570027.5755.7.camel@Joe-Laptop> (raw)
In-Reply-To: <alpine.DEB.2.02.1111052254540.1963@hadrien>

email header lines can look like signatures 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:".

Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Joe Perches <joe@perches.com>

---

On Sat, 2011-11-05 at 22:57 +0100, Julia Lawall wrote:
> Checkpatch is giving me, eg: 
> 'Simon Wunderlich <siwu@hrz.tu-chemnitz.de>,"David S. Miller" 
> <davem@davemloft.net>,b.a.t.m.a.n@lists.open-mesh.org,netdev@vger.kernel.org,linux-kernel@vger.kernel.org' 
> might be better as '"Simon Wunderlich <siwu@hrz.tu-chemnitz.de>,\"David S. 
> Miller" <davem@davemloft.net>,b.a.t.m.a.n@lists.open-mesh.org,netdev@vger.kernel.org,linux-kernel@vger.kernel.org'
> The problem seems to go away if I get rid of the quotes around "David S. 
> Miller".  Is it intentional to give a warning in this case?

 scripts/checkpatch.pl |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5e93342..9bc0e06 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1504,9 +1504,11 @@ sub process {
 		if ($line =~ /^diff --git.*?(\S+)$/) {
 			$realfile = $1;
 			$realfile =~ s@^([^/]*)/@@;
+			$in_commit_log = 0;
 		} elsif ($line =~ /^\+\+\+\s+(\S+)/) {
 			$realfile = $1;
 			$realfile =~ s@^([^/]*)/@@;
+			$in_commit_log = 0;
 
 			$p1_prefix = $1;
 			if (!$file && $tree && $p1_prefix ne '' &&
@@ -1546,7 +1548,8 @@ sub process {
 		}
 
 # Check signature styles
-		if ($line =~ /^(\s*)($signature_tags)(\s*)(.*)/) {
+		if (!$in_header_lines &&
+		    $line =~ /^(\s*)($signature_tags)(\s*)(.*)/) {
 			my $space_before = $1;
 			my $sign_off = $2;
 			my $space_after = $3;
@@ -1623,7 +1626,7 @@ 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 !~ /^(commit\b|from\b|\w+:).+$/i) {
+		    $rawline !~ /^(commit\b|from\b|[\w-]+:).+$/i) {
 			$in_header_lines = 0;
 			$in_commit_log = 1;
 		}
-- 
1.7.6.405.gc1be0


           reply	other threads:[~2011-11-06  8:59 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <alpine.DEB.2.02.1111052254540.1963@hadrien>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1320570027.5755.7.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox