From 0774ed07298d87a97d305e37a4a8e8eccced7a7c Mon Sep 17 00:00:00 2001 From: h0tznpl0tz Date: Thu, 11 Sep 2025 15:02:08 +0200 Subject: [PATCH] Fix AWK array initialization error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Initialize rcpts array properly to avoid scalar/array error - Skip empty recipient strings in output formatting - Ensures proper 2D array handling in AWK 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- legacy/exitrace/exitrace.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/legacy/exitrace/exitrace.sh b/legacy/exitrace/exitrace.sh index a85e575..2f8b42f 100755 --- a/legacy/exitrace/exitrace.sh +++ b/legacy/exitrace/exitrace.sh @@ -362,7 +362,10 @@ fi # AWK Analysis grep_chain | awk -v TO_RE="${TO_REGEX:-}" -v WANTDOM="${TARGET_DOMAIN:-}" -v MSGIDREQ="${MSGID:-}" -v FROMREQ="${FROM:-}" -v EXTRA="${GREPEXTRA:-}" ' function trim(s){ sub(/^[ \t\r\n]+/, "", s); sub(/[ \t\r\n]+$/, "", s); return s } -function add_rcpt(id, rc){ if (!(rc in rcpts[id])) rcpts[id][rc]=1 } +function add_rcpt(id, rc){ + if (!(id in rcpts)) rcpts[id][""] = "" + if (!(rc in rcpts[id])) rcpts[id][rc]=1 +} BEGIN { FS=" " } @@ -484,7 +487,9 @@ END { out_rcpts="" if (id in rcpts){ for (r in rcpts[id]) { - out_rcpts = (out_rcpts=="" ? r : out_rcpts ", " r) + if (r != "") { + out_rcpts = (out_rcpts=="" ? r : out_rcpts ", " r) + } } }