LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* checkpatch does not like quoting patch subject with doublequotes
@ 2021-07-29 18:07 Michal Suchánek
2021-07-30 3:59 ` Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: Michal Suchánek @ 2021-07-29 18:07 UTC (permalink / raw)
To: linux-kernel; +Cc: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn
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()")
ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - 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()")
total: 1 errors, 1 warnings, 7 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
0001-powerpc-stacktrace-Include-linux-delay.h.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
AFAICT there is not problem with the way the patch is quoted but rather
checkpatch is confused by the patch subject containing double quotes.
Can you please have a look?
Thanks
Michal
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: checkpatch does not like quoting patch subject with doublequotes
2021-07-29 18:07 checkpatch does not like quoting patch subject with doublequotes Michal Suchánek
@ 2021-07-30 3:59 ` Joe Perches
0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2021-07-30 3:59 UTC (permalink / raw)
To: Michal Suchánek, linux-kernel
Cc: Andy Whitcroft, Dwaipayan Ray, Lukas Bulwahn
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> ("<title line>")' - 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);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-30 4:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 18:07 checkpatch does not like quoting patch subject with doublequotes Michal Suchánek
2021-07-30 3:59 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).