courier-dovecot-migrate.pl and courier-5: UTF-8 flag

Maxim Nikulin mnikulin at plesk.com
Fri May 8 13:53:19 EEST 2020


Hi,

Courier to dovecot migration script
https://dovecot.org/tools/courier-dovecot-migrate.pl
referenced at the https://wiki.dovecot.org/Migration/Courier
page has a couple of problems. One of them is that the script
could not process courierpop3dsizelist generated by courier-5.
File format has been changed a bit to mark UTF-8 messages
with an additional attribute.

Is it safe to ignore such flag or its value should
be stored somewhere for dovecot? Internally courier
assumes false value during migration from the previous format
version (v2 to v3).


--- courier-dovecot-migrate.pl.orig	2012-07-28 17:14:20.000000000 +0000
+++ courier-dovecot-migrate.pl	2020-05-08 09:54:53.249214022 +0000
@@ -170,8 +170,9 @@
     my $pop3_fname = "$dir/$courier_pop3_uidfile";
     open( $f, $pop3_fname ) || die $!;
     my $pop3_hdr = <$f>;
-    if ( $pop3_hdr =~ /^\/2 (\d+) (\d+)$/ ) {
+    if ( $pop3_hdr =~ /^\/[23] (\d+) (\d+)$/ ) {
         # /2 <next uid> <uidvalidity>
+        # /3 <next uid> <uidvalidity>
         $_ = <$f>;
     }
     elsif ( $pop3_hdr =~ /^\/1 (\d+)$/ ) {
@@ -193,9 +194,13 @@
         chomp $_;
 	$line++;
         
-        my ( $full_fname, $fsize, $uid, $uidv );
+        my ( $full_fname, $fsize, $uid, $uidv, $_is_utf8 );
         
-        if ( /^([^ ]+) (\d+) (\d+):(\d+)$/ ) {
+        if ( /^([^ ]+) (\d+) (\d+):(\d+):(\d+)$/ ) {
+            # v3
+            ( $full_fname, $fsize, $uid, $uidv, $_is_utf8 ) = ( $1, $2, $3, $4, $5 );
+        }
+        elsif ( /^([^ ]+) (\d+) (\d+):(\d+)$/ ) {
             # v2
             ( $full_fname, $fsize, $uid, $uidv ) = ( $1, $2, $3, $4 );
         }


More information about the dovecot mailing list