[exim] exiqsumm edge case

Góra strony
Delete this message
Reply to this message
Autor: Richard.Hall
Data:  
Dla: exim-users
Temat: [exim] exiqsumm edge case
Hello,

I'm trying very hard to resist the urge to call this a 0-day problem ;-)

Given the following output from mailq:-

-------------------------------------------------
 6d  6.5K 1TYBPc-0002Lb-UC <redacted@???>
          redacted@???


-------------------------------------------------


the output from 'mailq | exiqsumm' is

Count Volume Oldest Newest Domain
----- ------ ------ ------ ------

    1    6656      6d      6d  uqah.uquebec.ca
---------------------------------------------------------------
    1    6656      6d   0000d  TOTAL


whereas I think it should be

Count Volume Oldest Newest Domain
----- ------ ------ ------ ------

    1    6656      6d      6d  uqah.uquebec.ca
---------------------------------------------------------------
    1    6656      6d      6d  TOTAL


Note the difference in the 'TOTAL' line.


The following patch fixes it for me

--- exiqsumm.old Thu May 31 00:40:15 2012
+++ exiqsumm.new Mon Nov 19 13:40:59 2012
@@ -139,7 +139,7 @@
print "\nCount Volume Oldest Newest Domain";
print "\n----- ------ ------ ------ ------\n\n";

-my ($count, $volume, $max_age, $min_age) = (0, 0, "0m", "0000d");
+my ($count, $volume, $max_age, $min_age) = (0, 0, "0m", undef);

 foreach $id (sort
             {
@@ -153,10 +153,12 @@
     $queue{$id}, &print_volume_rounded($q_size{$id}), $q_oldest{$id},
     $q_recent{$id}, $id);
     $max_age = $q_oldest{$id} if &older($q_oldest{$id}, $max_age) > 0;
-    $min_age = $q_recent{$id} if &older($min_age, $q_recent{$id}) > 0;
+    $min_age = $q_recent{$id}
+      if (!defined $min_age || &older($min_age, $q_recent{$id}) > 0);
     $volume += $q_size{$id};
     $count += $queue{$id};
   }
+$min_age = "0000d" if !defined $min_age;


printf("---------------------------------------------------------------\n");
printf("%5d %.6s %6s %6s %.80s\n",
$count, &print_volume_rounded($volume), $max_age, $min_age, "TOTAL");




Regards,
Richard