Message ID | 20220914152749.539677-1-i.maximets@ovn.org |
---|---|
State | Accepted |
Commit | 950aee1f7e1113a030b5e62ed036608480118b9d |
Headers | show |
Series | [ovs-dev] checkpatch: Add check for egrep/fgrep. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | warning | apply and check: warning |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/intel-ovs-compilation | success | test: success |
Bleep bloop. Greetings Ilya Maximets, I am a robot and I have tried out your patch. Thanks for your contribution. I encountered some error that I wasn't expecting. See the details below. checkpatch: ERROR: grep -E/-F should be used instead of egrep/fgrep #29 FILE: tests/checkpatch.at:370: AT_SETUP([checkpatch - check egrep / fgrep]) ERROR: grep -E/-F should be used instead of egrep/fgrep #37 FILE: tests/checkpatch.at:378: +C_H_E_C_K([[ovs-vsctl show | egrep 'my-port.*[[0-9]]$']]) ERROR: grep -E/-F should be used instead of egrep/fgrep #39 FILE: tests/checkpatch.at:380: "ERROR: grep -E/-F should be used instead of egrep/fgrep ERROR: grep -E/-F should be used instead of egrep/fgrep #41 FILE: tests/checkpatch.at:382: C_H_E_C_K([[ovs-vsctl show | egrep 'my-port.*[[0-9]]$']]) ERROR: grep -E/-F should be used instead of egrep/fgrep #46 FILE: tests/checkpatch.at:387: +C_H_E_C_K([[ovs-vsctl show | fgrep 'my-port.*[[0-9]]$']]) ERROR: grep -E/-F should be used instead of egrep/fgrep #48 FILE: tests/checkpatch.at:389: "ERROR: grep -E/-F should be used instead of egrep/fgrep ERROR: grep -E/-F should be used instead of egrep/fgrep #50 FILE: tests/checkpatch.at:391: C_H_E_C_K([[ovs-vsctl show | fgrep 'my-port.*[[0-9]]$']]) Lines checked: 97, Warnings: 0, Errors: 7 Please check this out. If you feel there has been an error, please email aconole@redhat.com Thanks, 0-day Robot
Ilya Maximets <i.maximets@ovn.org> writes: > 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. > > Signed-off-by: Ilya Maximets <i.maximets@ovn.org> > --- LGTM, and the bot already tested itself. Acked-by: Aaron Conole <aconole@redhat.com>
On 9/14/22 20:57, Aaron Conole wrote: > Ilya Maximets <i.maximets@ovn.org> writes: > >> 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. >> >> Signed-off-by: Ilya Maximets <i.maximets@ovn.org> >> --- > > LGTM, and the bot already tested itself. > > Acked-by: Aaron Conole <aconole@redhat.com> > Applied. Thanks! Best regards, Ilya Maximets.
diff --git a/tests/checkpatch.at b/tests/checkpatch.at index 9ab87410e..fdcdb846e 100755 --- a/tests/checkpatch.at +++ b/tests/checkpatch.at @@ -366,6 +366,33 @@ try_checkpatch \ AT_CLEANUP + +AT_SETUP([checkpatch - check egrep / fgrep]) +try_checkpatch \ + "COMMON_PATCH_HEADER([tests/something.at]) + +C_H_E_C_K([[ovs-vsctl show | grep -E 'my-port.*[[0-9]]$' | grep -F 'port']]) + " + +try_checkpatch \ + "COMMON_PATCH_HEADER([tests/something.at]) + +C_H_E_C_K([[ovs-vsctl show | egrep 'my-port.*[[0-9]]$']]) + " \ + "ERROR: grep -E/-F should be used instead of egrep/fgrep + #8 FILE: tests/something.at:1: + C_H_E_C_K([[ovs-vsctl show | egrep 'my-port.*[[0-9]]$']]) +" + +try_checkpatch \ + "COMMON_PATCH_HEADER([tests/something.at]) + +C_H_E_C_K([[ovs-vsctl show | fgrep 'my-port.*[[0-9]]$']]) + " \ + "ERROR: grep -E/-F should be used instead of egrep/fgrep + #8 FILE: tests/something.at:1: + C_H_E_C_K([[ovs-vsctl show | fgrep 'my-port.*[[0-9]]$']]) +" +AT_CLEANUP + + AT_SETUP([checkpatch - whitespace around cast]) try_checkpatch \ "COMMON_PATCH_HEADER 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")}, ]
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. Signed-off-by: Ilya Maximets <i.maximets@ovn.org> --- tests/checkpatch.at | 27 +++++++++++++++++++++++++++ utilities/checkpatch.py | 11 +++++++++++ 2 files changed, 38 insertions(+)