diff options
author | Ilya Maximets <i.maximets@ovn.org> | 2022-09-14 13:06:38 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2022-09-15 14:18:25 +0200 |
commit | 950aee1f7e1113a030b5e62ed036608480118b9d (patch) | |
tree | 5d2aecab7a002edc00bc2e53a492be73c1bb4efe /utilities | |
parent | b1550dddeba968924e2bd79cc507d16e99aa7a13 (diff) | |
download | openvswitch-950aee1f7e1113a030b5e62ed036608480118b9d.tar.gz |
checkpatch: Add check for egrep/fgrep.
GNU grep 3.8 started complaining about use of obsolete egrep/fgrep:
egrep: warning: egrep is obsolescent; using grep -E
This breaks tests on such systems. All the instances was cleaned up
from the testsuite, but the checkpatch check is needed to catch issues
in new patches.
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'utilities')
-rwxr-xr-x | utilities/checkpatch.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index 887928404..0d30b71b5 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -182,6 +182,7 @@ __regex_empty_return = re.compile(r'\s*return;') __regex_if_macros = re.compile(r'^ +(%s) \([\S]([\s\S]+[\S])*\) { +\\' % __parenthesized_constructs) __regex_nonascii_characters = re.compile("[^\u0000-\u007f]") +__regex_efgrep = re.compile(r'.*[ef]grep.*$') skip_leading_whitespace_check = False skip_trailing_whitespace_check = False @@ -341,6 +342,11 @@ def has_xxx_mark(line): return __regex_has_xxx_mark.match(line) is not None +def has_efgrep(line): + """Returns TRUE if the current line contains 'egrep' or 'fgrep'.""" + return __regex_efgrep.match(line) is not None + + def filter_comments(current_line, keep=False): """remove all of the c-style comments in a line""" STATE_NORMAL = 0 @@ -608,6 +614,11 @@ checks = [ 'print': lambda: print_warning("Empty return followed by brace, consider omitting") }, + + {'regex': r'(\.at|\.sh)$', 'match_name': None, + 'check': lambda x: has_efgrep(x), + 'print': + lambda: print_error("grep -E/-F should be used instead of egrep/fgrep")}, ] |