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 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user