From 87c69cd59b67c7bb20610ae55e43b286626c387b Mon Sep 17 00:00:00 2001 From: cschantz Date: Fri, 2 Jan 2026 16:19:11 -0500 Subject: [PATCH] Fix integer expression errors in QA script category counts Same newline sanitization issue as email diagnostics - grep -c output can contain newlines causing "integer expression expected" errors. Fixed by sanitizing count variables: - Line 3367: Category count comparison - Line 2533: Performance cache occurrence count Added: echo "$count" | head -1 | tr -d '\n\r' Prevents errors like: [: 0\n0: integer expression expected --- tools/toolkit-qa-check.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/toolkit-qa-check.sh b/tools/toolkit-qa-check.sh index 621fe0b..ae2e818 100755 --- a/tools/toolkit-qa-check.sh +++ b/tools/toolkit-qa-check.sh @@ -2530,6 +2530,7 @@ while IFS= read -r file; do if [ -n "$duplicates" ]; then for cmd in $duplicates; do occurrences=$(grep -c "$cmd" "$file" 2>/dev/null) + occurrences=$(echo "$occurrences" | head -1 | tr -d '\n\r') first_line=$(grep -n "$cmd" "$file" 2>/dev/null | head -1 | cut -d: -f1) echo "MEDIUM|$file|$first_line|[PERF-CACHE] Command '$cmd' called $occurrences times" echo " Risk: Unnecessary overhead from repeated execution" @@ -3364,6 +3365,7 @@ echo -e "${BOLD}═════════════════════ declare -A cat_counts for tag in SQL-INJ CMD-INJ PANEL-CALL FILE-OP SECRET-LEAK RACE SOURCE RETURN NULL DEP TEMP SUBSHELL PIPE WORDSPLIT ARITH TEST REDIR TRAP ARRAY HEREDOC IF-MASK NUMCMP BG-JOB LOCALE PROC-SUB PRINTF REGEX BASHISM ESCAPE SLEEP-RACE IFS SUBSHELL-VAR TRAP-RACE PERF-LOOP PERF-CACHE PERF-READ RECURSION FD-LEAK ZOMBIE DISK-SPACE NET-TIMEOUT LOG-ROTATE CPU-LOOP HARDCODED-PATH MISSING-LIB USERDATA-ACCESS API-CHECK NO-CASE DB-PATTERN NO-USER-MGR NO-STANDALONE; do count=$(grep -c "\[$tag\]" "$REPORT" 2>/dev/null || echo 0) + count=$(echo "$count" | head -1 | tr -d '\n\r') if [ "$count" -gt 0 ]; then cat_counts[$tag]=$count fi