Skip to content

Commit

Permalink
checkpatch: fix patch separator line regex
Browse files Browse the repository at this point in the history
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: c599d5c ("checkpatch.py: A simple script for finding patch issues")
Signed-off-by: Aaron Conole <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
apconole authored and blp committed Jul 3, 2018
1 parent 79d0dfa commit 128b46a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utilities/checkpatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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-+]+) @@')
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 128b46a

Please sign in to comment.