postinst: avoid false positives when scanning logs for errors#973
postinst: avoid false positives when scanning logs for errors#973AshwinUjjwal wants to merge 1 commit intoni:nilrt/master/scarthgapfrom
Conversation
rajendra-desai-ni
left a comment
There was a problem hiding this comment.
Change looks good, but since the change is just in the test and not in the actual postinst script, it is better to update the commit title to postinst-test: or something instead of postinst:
Also, I guess this commit needs to be cherry-picked to dist-next and release branches. Can you update the same in the PR description?
632617f to
0023700
Compare
| # only present on first boot | ||
| if [ -e "$LOGFILE" ]; then | ||
| if egrep -i 'warn|error|fatal|fail' "$LOGFILE"; then | ||
| if grep -Eiw 'warn(ing)?|error|fatal|fail' "$LOGFILE"; then |
There was a problem hiding this comment.
What about strings like errors, failed, failure, etc? I think it's better to have false positives rather than false negatives.
There was a problem hiding this comment.
Updated the log scanning pattern to include additional keyword variations such as err, errored, errors, failed, and failure to improve coverage. Since log outputs are not fixed, included as many relevant keyword forms as possible to minimize false negatives.
Attempted to remove -w (using -Ei) for broader matching, but it introduced false positives from file names such as /lib/modules/.../str_error_r.o. Therefore, retained -Eiw to ensure meaningful matches .
Replace deprecated egrep usage with grep -E and improve the log matching pattern to avoid false positives. Previously, the pattern 'warn|error|fatal|fail' matched substrings such as 'str_error_r.o' and triggered failures due to the egrep deprecation warning. Updated the command to use: grep -Eiw 'warn(ing)?|error|fatal|fail' This ensures only whole words are matched and includes both 'warn' and 'warning', reducing incorrect test failures. Signed-off-by: AshwinUjjwal <ashwinujjwal.bharti@emerson.com>
0023700 to
99a2413
Compare
chaitu236
left a comment
There was a problem hiding this comment.
lgtm. But we won't be cherry-picking this into release branch. And we should wait until release is complete to cherry-pick into -next branch.
Summary of Changes
Replace deprecated egrep usage with grep -E and improve the log matching pattern to avoid false positives.
Previously, the pattern 'warn|error|fatal|fail' matched substrings such as 'str_error_r.o' and triggered failures due to the egrep deprecation warning.
Updated the command to use:
grep -Eiw 'warn(ing)?|error|fatal|fail'
This ensures only whole words are matched and includes both 'warn' and 'warning', reducing incorrect test failures.
Justification
AB#3429565
Testing
TODO: Detail what testing has been done to ensure this submission meets requirements.
Note
This change should also be cherry‑picked into the dist-next and the relevant release branches.
Procedure