2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

checkpatch: fix patch separator line regex

The separator line always starts with three dashes on a line, optionally
followed by either white-space, OR a single space and a filename.  The
regex would previously match on any three dashes in a row.  This means
that a patch (such as [1]) would trigger the parser state machine to
advance beyond the signed-off checks.

Now, bound the check only to use what git-mailinfo would use as a
separator.
   --- <filename>
   ---<sp>

1: https://mail.openvswitch.org/pipermail/ovs-dev/2018-June/348625.html

Fixes: c599d5ccf3 ("checkpatch.py: A simple script for finding patch issues")
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Aaron Conole
2018-06-27 20:40:04 -04:00
committed by Ben Pfaff
parent 79d0dfa4e9
commit 128b46a077

View File

@@ -619,7 +619,7 @@ def ovs_checkpatch_parse(text, filename):
parse = 0
current_file = filename if checking_file else ''
previous_file = ''
scissors = re.compile(r'^[\w]*---[\w]*')
seppatch = re.compile(r'^---([\w]*| \S+)$')
hunks = re.compile('^(---|\+\+\+) (\S+)')
hunk_differences = re.compile(
r'^@@ ([0-9-+]+),([0-9-+]+) ([0-9-+]+),([0-9-+]+) @@')
@@ -652,7 +652,7 @@ def ovs_checkpatch_parse(text, filename):
print_file_name = current_file
continue
elif parse == PARSE_STATE_HEADING:
if scissors.match(line):
if seppatch.match(line):
parse = PARSE_STATE_DIFF_HEADER
if not skip_signoff_check:
if len(signatures) == 0: