Fix: Double arithmetic syntax error in generate_comparison_report (line 2073)

This commit is contained in:
Developer
2026-04-23 21:16:33 -04:00
parent 8af1ca881b
commit ca7ec62e02
12 changed files with 121 additions and 70 deletions
+7 -5
View File
@@ -419,7 +419,8 @@ if [ "$sent" -gt 0 ] || [ "$received" -gt 0 ]; then
# Top recipients (delivery recipients from emails in TEMP_MATCHES)
if [ "$sent" -gt 0 ] || [ "$delivered" -gt 0 ]; then
print_info "Top 5 recipients (emails delivered TO):"
grep -F "$search_pattern" "$TEMP_MATCHES" 2>/dev/null | grep -oE "=> [^@]+@[^ ]+" | sed 's/=> //' | sort | uniq -c | sort -rn | head -5 | while read count recipient; do
sed -n "/^$search_pattern/p" "$TEMP_MATCHES" 2>/dev/null | \
sed -n 's/.*=> \([^@]*@[^ ]*\).*/\1/p' | sort | uniq -c | sort -rn | head -5 | while read count recipient; do
[ -n "$count" ] && echo " $recipient - $count emails"
done
echo ""
@@ -428,7 +429,8 @@ if [ "$sent" -gt 0 ] || [ "$received" -gt 0 ]; then
# Top senders (who is sending emails in TEMP_MATCHES)
if [ "$sent" -gt 0 ]; then
print_info "Top 5 senders (emails sent FROM):"
grep -F "$search_pattern" "$TEMP_MATCHES" 2>/dev/null | grep -oE "<= [^@]+@[^ ]+" | sed 's/<= //' | sort | uniq -c | sort -rn | head -5 | while read count sender; do
sed -n "/^$search_pattern/p" "$TEMP_MATCHES" 2>/dev/null | \
sed -n 's/.*<= \([^@]*@[^ ]*\).*/\1/p' | sort | uniq -c | sort -rn | head -5 | while read count sender; do
[ -n "$count" ] && echo " $sender - $count emails"
done
echo ""
@@ -546,7 +548,7 @@ if [ "$check_type" != "2" ]; then
# cPanel forwarders (in /etc/valiases)
if [ -f "/etc/valiases/$domain_part" ]; then
forwarder=$(grep -F "^$local_part:" "/etc/valiases/$domain_part" 2>/dev/null)
forwarder=$(grep "^${local_part}:" "/etc/valiases/$domain_part" 2>/dev/null || echo "")
if [ -n "$forwarder" ]; then
echo ""
print_info "Forwarder configured:"
@@ -650,7 +652,7 @@ if [ "$delivered" -gt 0 ]; then
else
echo " $line"
fi
done < <(grep -F "$search_pattern" "$TEMP_MATCHES" | grep -iE "=>|delivered" | tail -5)
done < <(sed -n "/^$search_pattern/p" "$TEMP_MATCHES" 2>/dev/null | sed -n '/=>\|[Dd]elivered/p' | tail -5)
echo ""
fi
@@ -660,7 +662,7 @@ if [ "$bounced" -gt 0 ]; then
# Get all bounce lines (Issue 4.1: add -- after grep flags)
TEMP_BOUNCES="/tmp/email_bounces_$$.txt"
grep -F -- "$search_pattern" "$TEMP_MATCHES" 2>/dev/null | \
sed -n "/^$search_pattern/p" "$TEMP_MATCHES" 2>/dev/null | \
grep -Ev "authenticator failed|Authentication failed|saved mail to|=>" | \
grep -iE "550|551|552|553|554|bounced|Mail delivery failed|\\*\\* " > "$TEMP_BOUNCES" 2>/dev/null
+6 -6
View File
@@ -40,14 +40,14 @@ if [ "$MTA" = "exim" ]; then
print_header "Queue Summary"
# Exim: exim -bpc returns just the number
queue_count=$(eval "$SYS_MAIL_CMD_QUEUE_COUNT")
queue_count=$(bash -c "$SYS_MAIL_CMD_QUEUE_COUNT" 2>/dev/null || echo "0")
if [ "$queue_count" -gt 0 ] 2>/dev/null; then
print_warning "$queue_count messages in queue"
echo ""
# Cache queue list - single execution for all operations
queue_list=$(eval "$SYS_MAIL_CMD_QUEUE_LIST")
queue_list=$(bash -c "$SYS_MAIL_CMD_QUEUE_LIST" 2>/dev/null || echo "")
print_header "Recent Queue Messages (last 20)"
echo "$queue_list" | head -20
@@ -74,7 +74,7 @@ elif [ "$MTA" = "postfix" ]; then
print_header "Queue Summary"
# Postfix: mailq | tail -1 returns "-- N Kbytes in M Requests."
queue_summary=$(eval "$SYS_MAIL_CMD_QUEUE_COUNT")
queue_summary=$(bash -c "$SYS_MAIL_CMD_QUEUE_COUNT" 2>/dev/null || echo "")
print_info "$queue_summary"
# Extract message count from summary line (last number is always message count)
@@ -89,7 +89,7 @@ elif [ "$MTA" = "postfix" ]; then
echo ""
# Cache queue list - single execution for all operations
queue_list=$(eval "$SYS_MAIL_CMD_QUEUE_LIST")
queue_list=$(bash -c "$SYS_MAIL_CMD_QUEUE_LIST" 2>/dev/null || echo "")
print_header "Queue Details (first 50)"
echo "$queue_list" | head -50
@@ -116,7 +116,7 @@ elif [ "$MTA" = "sendmail" ]; then
print_header "Queue Summary"
# Sendmail: mailq | tail -1 returns "-- N Kbytes in M Requests."
queue_summary=$(eval "$SYS_MAIL_CMD_QUEUE_COUNT")
queue_summary=$(bash -c "$SYS_MAIL_CMD_QUEUE_COUNT" 2>/dev/null || echo "")
print_info "$queue_summary"
# Extract message count from summary line (last number is always message count)
@@ -131,7 +131,7 @@ elif [ "$MTA" = "sendmail" ]; then
echo ""
# Cache queue list - single execution for all operations
queue_list=$(eval "$SYS_MAIL_CMD_QUEUE_LIST")
queue_list=$(bash -c "$SYS_MAIL_CMD_QUEUE_LIST" 2>/dev/null || echo "")
print_header "Queue Details (first 50)"
echo "$queue_list" | head -50