From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49B8EC4338F for ; Fri, 30 Jul 2021 04:01:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22E8460E97 for ; Fri, 30 Jul 2021 04:01:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235799AbhG3D7x (ORCPT ); Thu, 29 Jul 2021 23:59:53 -0400 Received: from smtprelay0184.hostedemail.com ([216.40.44.184]:49714 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230352AbhG3D7v (ORCPT ); Thu, 29 Jul 2021 23:59:51 -0400 Received: from omf16.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id 1915420BD9; Fri, 30 Jul 2021 03:59:47 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf16.hostedemail.com (Postfix) with ESMTPA id 1B8D52550F1; Fri, 30 Jul 2021 03:59:45 +0000 (UTC) Message-ID: <7f55d9d0369f1ea840fab83eeb77f9f3601fee41.camel@perches.com> Subject: Re: checkpatch does not like quoting patch subject with doublequotes From: Joe Perches To: Michal =?ISO-8859-1?Q?Such=E1nek?= , linux-kernel@vger.kernel.org Cc: Andy Whitcroft , Dwaipayan Ray , Lukas Bulwahn Date: Thu, 29 Jul 2021 20:59:44 -0700 In-Reply-To: <20210729180724.GG21290@kitsune.suse.cz> References: <20210729180724.GG21290@kitsune.suse.cz> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1B8D52550F1 X-Stat-Signature: otdf36kqrxatd694b4et8z964wxrcaq7 X-Rspamd-Server: rspamout02 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX19ym3ybUc7TX+lb9wlbgj/OMv+Z0qsP4+4= X-HE-Tag: 1627617585-52422 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2021-07-29 at 20:07 +0200, Michal Suchánek wrote: > Hello, > > I got the following message from checkpatch: > > WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line) > #18: > commit 7c6986ade69e ("powerpc/stacktrace: Fix spurious "stale" traces in raise_backtrace_ipi()") That warning is true and useful. > ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("")' - ie: 'commit 7c6986ade69e ("powerpc/stacktrace: Fix spurious "stale" traces in raise_backtrace_ipi()")' > #18: > commit 7c6986ade69e ("powerpc/stacktrace: Fix spurious "stale" traces in raise_backtrace_ipi()") Yeah, that's a defect/weakness in the regex. It uses '([^"]+)' when instead it could use '(.*?)' as there is always a test for '"\)' immediately after that. Maybe: --- scripts/checkpatch.pl | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 461d4221e4a4a..8b95cf8fb1463 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3200,29 +3200,34 @@ 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 && + } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\(".*?$/i && defined $rawlines[$linenr] && - $rawlines[$linenr] =~ /^\s*[^"]+"\)/) { - $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; + $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; + } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && + defined $rawlines[$linenr] && + $rawlines[$linenr] =~ /^\s*"\((.*?)"\)/) { + $orig_desc = $1; + $hasparens = 1; } ($id, $description) = git_commit_info($orig_commit, $id, $orig_desc); if (defined($id) && - ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) { + ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) { ERROR("GIT_COMMIT_ID", "Please use git commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herecurr); }