[exim-dev] exiqsumm edge case

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Richard.Hall
Date:  
À: exim-dev
Sujet: [exim-dev] exiqsumm edge case
I sent the following to exim-users back in ... yikes, November 2012 ...
and AFAICS there was no reaction. With talk of a new release coming up, I
hope it isn't too late to re-raise it.

[Caveat: I can't now remember which version of the source the proposed
patch applied to! Probably 4.80]

Can be found in the archives at
https://lists.exim.org/lurker/message/20121120.202727.ca031448.en.html


---------- Forwarded message ----------
[...]

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