From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752915AbbKPWnZ (ORCPT ); Mon, 16 Nov 2015 17:43:25 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:34799 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751163AbbKPWnY (ORCPT ); Mon, 16 Nov 2015 17:43:24 -0500 Date: Mon, 16 Nov 2015 14:43:21 -0800 From: Brian Norris To: Joe Perches , Andy Whitcroft Cc: linux-kernel@vger.kernel.org Subject: [BUG] checkpatch: false positive for commits with quote characters Message-ID: <20151116224321.GR8456@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, What is the Blessed (TM) style for referencing commits that have quote characters in their subject line? e.g., this commit: commit 43163022927b6e7d202a7e6f939c3f392465494d Author: Brian Norris Date: Tue May 19 14:38:22 2015 -0700 mtd: m25p80: allow arbitrary OF matching for "jedec,spi-nor" Checkpatch reports false positive errors like this: ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("")' when I try to reference it on this patch: https://lkml.org/lkml/2015/11/16/826 I understand the double quoting is a little nasty to parse, but I think that just means we should relax the regexes in checkpatch.pl. I could try to patch myself, but I figured I'd just follow checkpatch's advice instead: NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Brian From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <linux-kernel-owner@vger.kernel.org> Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754479AbbKQRsd (ORCPT <rfc822;w@1wt.eu>); Tue, 17 Nov 2015 12:48:33 -0500 Received: from smtprelay0134.hostedemail.com ([216.40.44.134]:53305 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932146AbbKQRsb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 17 Nov 2015 12:48:31 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::,RULES_HIT:41:355:379:541:599:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3868:3870:3871:3873:3874:4184:4250:4321:5007:6261:7514:7522:10004:10400:10848:11232:11658:11914:12043:12438:12517:12519:12555:12679:12740:13069:13071:13163:13229:13311:13357:14096:14097:14659:21060:21080:30022:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: bee01_4a16379c3ea52 X-Filterd-Recvd-Size: 1676 Message-ID: <1447782507.6012.22.camel@perches.com> Subject: Re: [BUG] checkpatch: false positive for commits with quote characters From: Joe Perches <joe@perches.com> To: Brian Norris <computersforpeace@gmail.com>, Andy Whitcroft <apw@canonical.com> Cc: linux-kernel@vger.kernel.org Date: Tue, 17 Nov 2015 09:48:27 -0800 In-Reply-To: <20151116224321.GR8456@google.com> References: <20151116224321.GR8456@google.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.16.5-1ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2015-11-16 at 14:43 -0800, Brian Norris wrote: > Hi, > > What is the Blessed (TM) style for referencing commits that have quote > characters in their subject line? e.g., this commit: > > commit 43163022927b6e7d202a7e6f939c3f392465494d > Author: Brian Norris <computersforpeace@gmail.com> > Date: Tue May 19 14:38:22 2015 -0700 > > mtd: m25p80: allow arbitrary OF matching for "jedec,spi-nor" > > Checkpatch reports false positive errors like this: > > ERROR: Please use git commit description style 'commit <12+ chars of > sha1> ("")' Hi Brian. What version of checkpatch are you using? Using linux-next: $ git log --stat -p -1 --format=email 43163022927b6e7d202a7e6f939c3f392465494d | ./scripts/checkpatch.pl --strict - total: 0 errors, 0 warnings, 0 checks, 53 lines checked Your patch has no obvious style problems and is ready for submission. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <linux-kernel-owner@vger.kernel.org> Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753758AbbKQSDk (ORCPT <rfc822;w@1wt.eu>); Tue, 17 Nov 2015 13:03:40 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:33143 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751636AbbKQSDj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 17 Nov 2015 13:03:39 -0500 Date: Tue, 17 Nov 2015 10:03:36 -0800 From: Brian Norris <computersforpeace@gmail.com> To: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org Subject: Re: [BUG] checkpatch: false positive for commits with quote characters Message-ID: <20151117180336.GE8456@google.com> References: <20151116224321.GR8456@google.com> <1447782507.6012.22.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1447782507.6012.22.camel@perches.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 17, 2015 at 09:48:27AM -0800, Joe Perches wrote: > On Mon, 2015-11-16 at 14:43 -0800, Brian Norris wrote: > > Hi, > > > > What is the Blessed (TM) style for referencing commits that have quote > > characters in their subject line? e.g., this commit: > > > > commit 43163022927b6e7d202a7e6f939c3f392465494d > > Author: Brian Norris <computersforpeace@gmail.com> > > Date: Tue May 19 14:38:22 2015 -0700 > > > > mtd: m25p80: allow arbitrary OF matching for "jedec,spi-nor" > > > > Checkpatch reports false positive errors like this: > > > > ERROR: Please use git commit description style 'commit <12+ chars of > > sha1> ("")' > > Hi Brian. > > What version of checkpatch are you using? > > Using linux-next: > > $ git log --stat -p -1 --format=email 43163022927b6e7d202a7e6f939c3f392465494d | ./scripts/checkpatch.pl --strict - I was referring to running checkpatch on this: https://lkml.org/lkml/2015/11/16/826 which *referenced* commit 43163022927b6e7d202a7e6f939c3f392465494d. Sorry if that wasn't clear. See below, Brian $ curl http://patchwork.ozlabs.org/patch/545234/mbox/ | scripts/checkpatch.pl - % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 3741 0 3741 0 0 11525 0 --:--:-- --:--:-- --:--:-- 11510 ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'Commit 43163022927b ("mtd: m25p80: allow arbitrary OF matching for "jedec,spi-nor"")' #17: Commit 43163022927b ("mtd: m25p80: allow arbitrary OF matching for total: 1 errors, 0 warnings, 29 lines checked Your patch has style problems, please review. NOTE: Ignored message types: FILE_PATH_CHANGES NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <linux-kernel-owner@vger.kernel.org> Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754611AbbLDAN0 (ORCPT <rfc822;w@1wt.eu>); Thu, 3 Dec 2015 19:13:26 -0500 Received: from mail-pf0-f175.google.com ([209.85.192.175]:33498 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754574AbbLDANW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Dec 2015 19:13:22 -0500 Date: Thu, 3 Dec 2015 16:13:18 -0800 From: Brian Norris <computersforpeace@gmail.com> To: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org Subject: Re: [BUG] checkpatch: false positive for commits with quote characters Message-ID: <20151204001318.GA57739@google.com> References: <20151116224321.GR8456@google.com> <1447782507.6012.22.camel@perches.com> <20151117180336.GE8456@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151117180336.GE8456@google.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org Ping? I've hit some different false positives today on the same rule. I'll stop bothering to report them if no one cares. On Tue, Nov 17, 2015 at 10:03:36AM -0800, Brian Norris wrote: > On Tue, Nov 17, 2015 at 09:48:27AM -0800, Joe Perches wrote: > > On Mon, 2015-11-16 at 14:43 -0800, Brian Norris wrote: > > > Hi, > > > > > > What is the Blessed (TM) style for referencing commits that have quote > > > characters in their subject line? e.g., this commit: > > > > > > commit 43163022927b6e7d202a7e6f939c3f392465494d > > > Author: Brian Norris <computersforpeace@gmail.com> > > > Date: Tue May 19 14:38:22 2015 -0700 > > > > > > mtd: m25p80: allow arbitrary OF matching for "jedec,spi-nor" > > > > > > Checkpatch reports false positive errors like this: > > > > > > ERROR: Please use git commit description style 'commit <12+ chars of > > > sha1> ("")' > > > > Hi Brian. > > > > What version of checkpatch are you using? > > > > Using linux-next: > > > > $ git log --stat -p -1 --format=email 43163022927b6e7d202a7e6f939c3f392465494d | ./scripts/checkpatch.pl --strict - > > I was referring to running checkpatch on this: > > https://lkml.org/lkml/2015/11/16/826 > > which *referenced* commit 43163022927b6e7d202a7e6f939c3f392465494d. > Sorry if that wasn't clear. > > See below, > Brian > > $ curl http://patchwork.ozlabs.org/patch/545234/mbox/ | scripts/checkpatch.pl - > % Total % Received % Xferd Average Speed Time Time Time Current > Dload Upload Total Spent Left Speed > 100 3741 0 3741 0 0 11525 0 --:--:-- --:--:-- --:--:-- 11510 > ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'Commit 43163022927b ("mtd: m25p80: allow arbitrary OF matching for "jedec,spi-nor"")' > #17: > Commit 43163022927b ("mtd: m25p80: allow arbitrary OF matching for > > total: 1 errors, 0 warnings, 29 lines checked > > Your patch has style problems, please review. > > NOTE: Ignored message types: FILE_PATH_CHANGES > > NOTE: If any of the errors are false positives, please report > them to the maintainer, see CHECKPATCH in MAINTAINERS. > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <linux-kernel-owner@vger.kernel.org> Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754249AbbLDA3o (ORCPT <rfc822;w@1wt.eu>); Thu, 3 Dec 2015 19:29:44 -0500 Received: from smtprelay0113.hostedemail.com ([216.40.44.113]:33486 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752137AbbLDA3n (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Dec 2015 19:29:43 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::,RULES_HIT:41:355:379:541:599:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3653:3865:3867:4321:5007:6261:10004:10400:10848:11026:11232:11658:11783:11914:12043:12050:12294:12517:12519:12555:12679:12740:13069:13311:13357:13894:14659:21080:21221:30054:30080:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: show20_8eca529967640 X-Filterd-Recvd-Size: 2478 Message-ID: <1449188980.17296.18.camel@perches.com> Subject: Re: [BUG] checkpatch: false positive for commits with quote characters From: Joe Perches <joe@perches.com> To: Brian Norris <computersforpeace@gmail.com> Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org Date: Thu, 03 Dec 2015 16:29:40 -0800 In-Reply-To: <20151204001318.GA57739@google.com> References: <20151116224321.GR8456@google.com> <1447782507.6012.22.camel@perches.com> <20151117180336.GE8456@google.com> <20151204001318.GA57739@google.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.2-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2015-12-03 at 16:13 -0800, Brian Norris wrote: > Ping? I've hit some different false positives today on the same rule. > I'll stop bothering to report them if no one cares. Perhaps this: diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 9f0949b..196b77b 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2397,22 +2397,26 @@ sub process {   $long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i);   $space = 0 if ($line =~ /\bcommit [0-9a-f]/i);   $case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/); - if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) { + if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("(.*)"\)/i) {   $orig_desc = $1;   $hasparens = 1; + print("here1\n");   } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i &&    defined $rawlines[$linenr] && -  $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { +  $rawlines[$linenr] =~ /^\s*\("(.*)"\)/) {   $orig_desc = $1;   $hasparens = 1; + print("here2\n");   } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i &&    defined $rawlines[$linenr] && -  $rawlines[$linenr] =~ /^\s*[^"]+"\)/) { +  $rawlines[$linenr] =~ /^\s*.*"\)/) {   $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i;   $orig_desc = $1; - $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; + $rawlines[$linenr] =~ /^\s*(.*)"\)/;   $orig_desc .= " " . $1;   $hasparens = 1; + print("orig_desc: <$orig_desc>\n"); + print("here3\n");   }     ($id, $description) = git_commit_info($orig_commit, From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <linux-kernel-owner@vger.kernel.org> Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754327AbbLDAgd (ORCPT <rfc822;w@1wt.eu>); Thu, 3 Dec 2015 19:36:33 -0500 Received: from smtprelay0099.hostedemail.com ([216.40.44.99]:51830 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751146AbbLDAgb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Dec 2015 19:36:31 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::,RULES_HIT:41:355:379:541:599:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3653:3865:3867:4321:5007:6261:10004:10400:10848:11232:11658:11783:11914:12043:12050:12294:12517:12519:12555:12740:13069:13311:13357:13894:14659:21080:21221:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: rock22_38c3f2c19f642 X-Filterd-Recvd-Size: 2545 Message-ID: <1449189388.17296.20.camel@perches.com> Subject: Re: [BUG] checkpatch: false positive for commits with quote characters From: Joe Perches <joe@perches.com> To: Brian Norris <computersforpeace@gmail.com> Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org Date: Thu, 03 Dec 2015 16:36:28 -0800 In-Reply-To: <1449188980.17296.18.camel@perches.com> References: <20151116224321.GR8456@google.com> <1447782507.6012.22.camel@perches.com> <20151117180336.GE8456@google.com> <20151204001318.GA57739@google.com> <1449188980.17296.18.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.2-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2015-12-03 at 16:29 -0800, Joe Perches wrote: > On Thu, 2015-12-03 at 16:13 -0800, Brian Norris wrote: > > Ping? I've hit some different false positives today on the same rule. > > I'll stop bothering to report them if no one cares. > > Perhaps this: (minus the debugging this time...) ---  scripts/checkpatch.pl | 8 ++++----  1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d4960f7..b23dff8 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2397,20 +2397,20 @@ sub process {   $long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i);   $space = 0 if ($line =~ /\bcommit [0-9a-f]/i);   $case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/); - if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) { + if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("(.*)"\)/i) {   $orig_desc = $1;   $hasparens = 1;   } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i &&    defined $rawlines[$linenr] && -  $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { +  $rawlines[$linenr] =~ /^\s*\("(.*)"\)/) {   $orig_desc = $1;   $hasparens = 1;   } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i &&    defined $rawlines[$linenr] && -  $rawlines[$linenr] =~ /^\s*[^"]+"\)/) { +  $rawlines[$linenr] =~ /^\s*.*"\)/) {   $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i;   $orig_desc = $1; - $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; + $rawlines[$linenr] =~ /^\s*(.*)"\)/;   $orig_desc .= " " . $1;   $hasparens = 1;   } From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <linux-kernel-owner@vger.kernel.org> Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754615AbbLDBjx (ORCPT <rfc822;w@1wt.eu>); Thu, 3 Dec 2015 20:39:53 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:35057 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753487AbbLDBjw (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Dec 2015 20:39:52 -0500 Date: Thu, 3 Dec 2015 17:39:48 -0800 From: Brian Norris <computersforpeace@gmail.com> To: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org Subject: Re: [BUG] checkpatch: false positive for commits with quote characters Message-ID: <20151204013948.GB116589@google.com> References: <20151116224321.GR8456@google.com> <1447782507.6012.22.camel@perches.com> <20151117180336.GE8456@google.com> <20151204001318.GA57739@google.com> <1449188980.17296.18.camel@perches.com> <1449189388.17296.20.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1449189388.17296.20.camel@perches.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 03, 2015 at 04:36:28PM -0800, Joe Perches wrote: > On Thu, 2015-12-03 at 16:29 -0800, Joe Perches wrote: > > On Thu, 2015-12-03 at 16:13 -0800, Brian Norris wrote: > > > Ping? I've hit some different false positives today on the same rule. > > > I'll stop bothering to report them if no one cares. > > > > Perhaps this: Aside from the non-breaking spaces your copy of Evolution inserted, it's an improvement. (It doesn't give a false positive for the patch I reported.) But it's still got some holes. > (minus the debugging this time...) > --- >  scripts/checkpatch.pl | 8 ++++---- >  1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index d4960f7..b23dff8 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -2397,20 +2397,20 @@ sub process { >   $long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i); >   $space = 0 if ($line =~ /\bcommit [0-9a-f]/i); >   $case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/); > - if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) { > + if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("(.*)"\)/i) { You're got the reverse problem now. This will match too broadly. For instance, if there is another instance of terminating quote + parentheses on the same line, then we'll get a false postive. e.g., if I wrote a patch that included something like this: Commit 6dc0dcde406b ("parisc: Use platform_device_register_simple("rtc-generic")") is cool (as in "cool") Or even if it's wrapped like this: Commit 6dc0dcde406b ("parisc: Use platform_device_register_simple("rtc-generic")") is cool (as in "cool") Then the regexes will think the description was: parisc: Use platform_device_register_simple("rtc-generic")") is cool (as in "cool A hacky workaround for that one: only check for (loosely, not proper regex syntax): parsed_description =~ description . ")"; rather than: description == parsed_description Not sure how far you want to go on chasing false positives... >   $orig_desc = $1; >   $hasparens = 1; >   } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && >    defined $rawlines[$linenr] && > -  $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { > +  $rawlines[$linenr] =~ /^\s*\("(.*)"\)/) { >   $orig_desc = $1; >   $hasparens = 1; >   } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && >    defined $rawlines[$linenr] && > -  $rawlines[$linenr] =~ /^\s*[^"]+"\)/) { > +  $rawlines[$linenr] =~ /^\s*.*"\)/) { >   $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; >   $orig_desc = $1; > - $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; > + $rawlines[$linenr] =~ /^\s*(.*)"\)/; >   $orig_desc .= " " . $1; >   $hasparens = 1; >   } BTW, another false positive: just including this text in a commit triggers a different one: http://lkml.kernel.org/g/20151113220039.GA74382@google.com A simple hack (appended, in addition to yours) would be to assume that when people are trying to include badly-formatted commit hashes, they will be preceding them with whitespace, the beginning of a line, or encapsulating punctuation. Or use a URL parser. Brian diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d2993f19df3f..e7110ba3242b 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2349,7 +2349,7 @@ sub process { # Check for git id commit length and improperly formed commit descriptions if ($in_commit_log && !$commit_log_possible_stack_dump && ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i || - ($line =~ /\b[0-9a-f]{12,40}\b/i && + ($line =~ /\b[\s^\("][0-9a-f]{12,40}\b/i && $line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i && $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) { my $init_char = "c";