Skip to content

Commit

Permalink
msg-filter: ignore version-release in kernel scripts
Browse files Browse the repository at this point in the history
... `installed in usr/src/kernels/...+debug/scripts`

Related: https://issues.redhat.com/browse/OSH-563
  • Loading branch information
kdudka committed Apr 10, 2024
1 parent 608ffd4 commit 0be43cc
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/lib/msg-filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ std::string MsgFilter::filterPath(const std::string &origPath) const
return tmpPath;
}

// "/usr/src/kernels/4.18.0-552.el8.x86_64+debug/..."
// -> "/usr/src/kernels/VERSION-RELEASE+debug/..."
const RE reKrnUsrSrc("^(/usr/src/kernels/)[^/-]+-[^/-]+((?:\\+debug)?/.*)$");
path = regexReplaceWrap(path, reKrnUsrSrc, "\\1VERSION-RELEASE\\2");

boost::smatch sm;
if (boost::regex_match(path, sm, d->rePyBuild)) {
// %{_builddir}/build/lib/setuptools/glob.py ->
Expand Down
1 change: 1 addition & 0 deletions tests/csdiff/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@ test_csdiff(diff-misc 16-cov-parser-key-event)
test_csdiff(diff-misc 17-cov-parser-key-event)
test_csdiff(diff-misc 18-cov-parser-key-event)
test_csdiff(diff-misc 19-cov-parser-key-event)
test_csdiff(diff-misc 21-kernel-shell-code)

add_subdirectory(filter-file)
Empty file.
Empty file.
Empty file.
Empty file.
23 changes: 23 additions & 0 deletions tests/csdiff/diff-misc/21-kernel-shell-code-new.err
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Error: SHELLCHECK_WARNING (CWE-398):
/usr/libexec/kselftests/drivers/net/netdevsim/ethtool-common.sh:31:8: error[SC1073]: Couldn't parse this test expression. Fix to allow more checks.
# 29| [ -z "$exp_fail" ] && cop="-ne" || cop="-eq"
# 30|
# 31|-> if [ $code $cop 0 ]; then
# 32| ((num_errors++))
# 33| return

Error: SHELLCHECK_WARNING (CWE-398):
/usr/src/kernels/4.18.0-552.el8.x86_64+debug/scripts/decode_stacktrace.sh:116:6: error[SC1073]: Couldn't parse this test expression. Fix to allow more checks.
# 114|
# 115| # Format timestamps with tabs
# 116|-> if [[ ${words[$i]} == \[ && ${words[$i+1]} == *\] ]]; then
# 117| unset words[$i]
# 118| words[$i+1]=$(printf "[%13s\n" "${words[$i+1]}")

Error: SHELLCHECK_WARNING (CWE-398):
/usr/src/kernels/4.18.0-552.el8.x86_64/scripts/decode_stacktrace.sh:116:6: error[SC1073]: Couldn't parse this test expression. Fix to allow more checks.
# 114|
# 115| # Format timestamps with tabs
# 116|-> if [[ ${words[$i]} == \[ && ${words[$i+1]} == *\] ]]; then
# 117| unset words[$i]
# 118| words[$i+1]=$(printf "[%13s\n" "${words[$i+1]}")
23 changes: 23 additions & 0 deletions tests/csdiff/diff-misc/21-kernel-shell-code-old.err
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Error: SHELLCHECK_WARNING (CWE-398):
/usr/libexec/kselftests/drivers/net/netdevsim/ethtool-common.sh:31:8: error[SC1073]: Couldn't parse this test expression. Fix to allow more checks.
# 29| [ -z "$exp_fail" ] && cop="-ne" || cop="-eq"
# 30|
# 31|-> if [ $code $cop 0 ]; then
# 32| ((num_errors++))
# 33| return

Error: SHELLCHECK_WARNING (CWE-398):
/usr/src/kernels/4.18.0-513.5.1.el8.x86_64+debug/scripts/decode_stacktrace.sh:116:6: error[SC1073]: Couldn't parse this test expression. Fix to allow more checks.
# 114|
# 115| # Format timestamps with tabs
# 116|-> if [[ ${words[$i]} == \[ && ${words[$i+1]} == *\] ]]; then
# 117| unset words[$i]
# 118| words[$i+1]=$(printf "[%13s\n" "${words[$i+1]}")

Error: SHELLCHECK_WARNING (CWE-398):
/usr/src/kernels/4.18.0-513.5.1.el8.x86_64/scripts/decode_stacktrace.sh:116:6: error[SC1073]: Couldn't parse this test expression. Fix to allow more checks.
# 114|
# 115| # Format timestamps with tabs
# 116|-> if [[ ${words[$i]} == \[ && ${words[$i+1]} == *\] ]]; then
# 117| unset words[$i]
# 118| words[$i+1]=$(printf "[%13s\n" "${words[$i+1]}")
5 changes: 3 additions & 2 deletions tests/csdiff/diff-misc/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
set -x

csdiff=$(realpath ../../../csdiff_build/src/csdiff)
csgrep=$(realpath ../../../csdiff_build/src/csgrep)
test -x "$csdiff" || exit $?

for old in *-old.err; do
test=${old%-old.err}
new=${test}-new.err
for args in "" "-z"; do
$csdiff $args $old $new | csgrep > ${test}-add${args}.err
$csdiff $args $new $old | csgrep > ${test}-fix${args}.err
$csdiff $args $old $new | $csgrep > ${test}-add${args}.err
$csdiff $args $new $old | $csgrep > ${test}-fix${args}.err
done
done

0 comments on commit 0be43cc

Please sign in to comment.