[Dovecot] Bug in maildir-size-fix.pl (was Broken physical size caching in Dovecot 2.1.10)

Steffen Kaiser skdovecot at smail.inf.fh-brs.de
Wed Mar 6 12:47:04 EET 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 16 Feb 2013, Timo Sirainen wrote:

> BTW. http://dovecot.org/tools/maildir-size-fix.pl has been updated to
> work with compressed files also, making maildir-size-check.sh obsolete.

This script seems to be broken for v1.x uidlist files, because those do 
not have a ":" preceeding the filename always. Therefore the condition 
never matches. Attached patch corrects that.

- --- maildir-size-fix.pl_orig    2013-03-06 09:20:53.000000000 +0100
+++ maildir-size-fix.pl_origExtraFix    2013-03-06 11:26:24.000000000 
+0100
@@ -130,3 +130,3 @@
      chomp $_;
- -    if (/^(\d+) ([^:]*)?:(.*)$/) {
+    if (/^(\d+) ([^:]*:)?(.*)$/) {
        my ($uid, $extra, $fname) = ($1, $2, $3);
@@ -135,12 +135,15 @@
        $base_fname =~ s/:.*$//;
- -      my $new_fname = $base_renames{$base_fname};
- -      if (!$new_fname || !$preserve_pop3_uidl || $extra =~ /\bP/) {
- -       $fname = $new_fname if ($new_fname);
- -       print $fout "$uid $extra:$fname\n";
- -      } else {
- -       $fname =~ s/:.*$//;
- -       print $fout "$uid P$fname $extra:$new_fname\n";
+      if(exists $base_renames{$base_fname}) {
+       # filename changes
+       $extra = ":" unless defined $extra;     # v2 uidlist has : always
+               print $fout $uid;
+        if ($preserve_pop3_uidl && $extra !~ /\bP/) {
+               print $fout " P", $base_fname;
+        }
+               print $fout " ", $extra, $base_renames{$base_fname}, "\n";
+      } else { # no new name, keep line unchanged
+        print $fout $_, "\n";
        }
      } else {
- -      print $fout "$_\n";
+      print $fout $_, "\n";
      }

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEVAwUBUTceqF3r2wJMiz2NAQLEvgf9GcSFXRy3sdu6zTsBpD7csgtgUGbrbDxD
z2zWtAsyGL61giNGEemaP+l4aZazS3dR8eby3uCrttduoAJ6ZEKm/H3pzHF9cTDd
+LLZbw2Kz//ckdAWTaLEt3QoWzKgjMkyYrgVpHyP5OGsz8ZcKtpQ58/E2c3rQXnf
WFX2f0P9edtM8ShVwbhYRozPnCXp54E/YW/ro37esJgAPTySY/pqyfrTEt38GhIH
z3L30nIm1Cs83X4hRezMz6xQAWghnbJy4MttAZy6NSur5riHp5oZVWDR3fkAD89t
+gh5q3+d6fBbTsLmi1I4E/r3qrtqcFHNmmdrP82YXtTL7SiCAMdlHw==
=K0Vm
-----END PGP SIGNATURE-----


More information about the dovecot mailing list