Skip to content

Commit 632617f

Browse files
committed
postinst: avoid false positives when scanning logs for errors
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>
1 parent b9b2fe0 commit 632617f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

recipes-devtools/run-postinsts/files/test-run-postinsts-log.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ source "$CONFIG_FILE" || fail "Failed to run $CONFIG_FILE"
2020

2121
# only present on first boot
2222
if [ -e "$LOGFILE" ]; then
23-
if egrep -i 'warn|error|fatal|fail' "$LOGFILE"; then
23+
if grep -Eiw 'warn(ing)?|error|fatal|fail' "$LOGFILE"; then
2424
fail "One or more errors in LOGFILE=$LOGFILE"
2525
fi
2626
fi

0 commit comments

Comments
 (0)