@@ -274,7 +274,7 @@ def diagram_to_nroff(nodes, para):
text_s = '.br\n'.join(["\\fL%s\n" % s for s in text if s != ""])
return para + """
.\\" check if in troff mode (TTY)
-.if t \{
+.if t \\{
.PS
boxht = .2
textht = 1/6
@@ -283,7 +283,7 @@ fillval = .2
.PE
\\}
.\\" check if in nroff mode:
-.if n \{
+.if n \\{
.nf
""" + text_s + """\
.fi
@@ -167,7 +167,7 @@ def get_simple_printable_row_string(row, columns):
s += "%s=%s " % (column, value)
s = s.strip()
s = re.sub('""|,|u?\'', "", s)
- s = re.sub('UUID\(([^)]+)\)', r'\1', s)
+ s = re.sub(r'UUID\(([^)]+)\)', r'\1', s)
s = re.sub('False', 'false', s)
s = re.sub('True', 'true', s)
s = re.sub(r'(ba)=([^[][^ ]*) ', r'\1=[\2] ', s)
@@ -518,38 +518,38 @@ checks = [
'check': lambda x: trailing_whitespace_or_crlf(x),
'print': lambda: print_warning("Line has trailing whitespace")},
- {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+ {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
'prereq': lambda x: not is_comment_line(x),
'check': lambda x: not if_and_for_whitespace_checks(x),
'print': lambda: print_error("Improper whitespace around control block")},
- {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+ {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
'prereq': lambda x: not is_comment_line(x),
'check': lambda x: not if_and_for_end_with_bracket_check(x),
'print': lambda: print_error("Inappropriate bracing around statement")},
- {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+ {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
'prereq': lambda x: not is_comment_line(x),
'check': lambda x: pointer_whitespace_check(x),
'print':
lambda: print_error("Inappropriate spacing in pointer declaration")},
- {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+ {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
'prereq': lambda x: not is_comment_line(x),
'check': lambda x: trailing_operator(x),
'print':
lambda: print_error("Line has '?' or ':' operator at end of line")},
- {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+ {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
'prereq': lambda x: has_comment(x),
'check': lambda x: has_xxx_mark(x),
'print': lambda: print_warning("Comment with 'xxx' marker")},
- {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+ {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
'prereq': lambda x: has_comment(x),
'check': lambda x: check_comment_spelling(x)},
- {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+ {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
'check': lambda x: empty_return_with_brace(x),
'interim_line': True,
'print':
@@ -584,7 +584,7 @@ std_functions = [
('error', 'Use ovs_error() in place of error()'),
]
checks += [
- {'regex': '(\.c|\.h)(\.in)?$',
+ {'regex': r'(\.c|\.h)(\.in)?$',
'match_name': None,
'prereq': lambda x: not is_comment_line(x),
'check': regex_function_factory(function_name),
@@ -601,11 +601,11 @@ infix_operators = \
[re.escape(op) for op in ['%', '<<', '>>', '<=', '>=', '==', '!=',
'^', '|', '&&', '||', '?:', '=', '+=', '-=', '*=', '/=', '%=',
'&=', '^=', '|=', '<<=', '>>=']] \
- + ['[^<" ]<[^=" ]', '[^->" ]>[^=" ]', '[^ !()/"]\*[^/]', '[^ !&()"]&',
- '[^" +(]\+[^"+;]', '[^" -(]-[^"->;]', '[^" <>=!^|+\-*/%&]=[^"=]',
+ + ['[^<" ]<[^=" ]', '[^->" ]>[^=" ]', r'[^ !()/"]\*[^/]', '[^ !&()"]&',
+ r'[^" +(]\+[^"+;]', '[^" -(]-[^"->;]', r'[^" <>=!^|+\-*/%&]=[^"=]',
'[^* ]/[^* ]']
checks += [
- {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
+ {'regex': r'(\.c|\.h)(\.in)?$', 'match_name': None,
'prereq': lambda x: not is_comment_line(x),
'check': regex_operator_factory(operator),
'print': lambda: print_warning("Line lacks whitespace around operator")}
@@ -694,7 +694,7 @@ def ovs_checkpatch_parse(text, filename, author=None, committer=None):
current_file = filename if checking_file else ''
previous_file = ''
seppatch = re.compile(r'^---([\w]*| \S+)$')
- hunks = re.compile('^(---|\+\+\+) (\S+)')
+ hunks = re.compile(r'^(---|\+\+\+) (\S+)')
hunk_differences = re.compile(
r'^@@ ([0-9-+]+),([0-9-+]+) ([0-9-+]+),([0-9-+]+) @@')
is_author = re.compile(r'^(Author|From): (.*)$', re.I | re.M | re.S)
@@ -325,7 +325,7 @@ def modinst():
_sh("modprobe", "openvswitch")
_sh("dmesg | grep openvswitch | tail -1")
- _sh("find /lib/modules/%s/ -iname vport-*.ko -exec insmod '{}' \;"
+ _sh("find /lib/modules/%s/ -iname vport-*.ko -exec insmod '{}' \\;"
% uname())
It appears that Python silently treats invalid escape sequences in strings as literals, e.g. "\." is the same as "\\.". Newer versions of checkpatch complain, and it does seem reasonable to me to fix these. Signed-off-by: Ben Pfaff <blp@ovn.org> --- python/build/nroff.py | 4 ++-- tests/test-ovsdb.py | 2 +- utilities/checkpatch.py | 24 ++++++++++++------------ utilities/ovs-dev.py | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-)