[Dovecot] migration and conversion from courier
Dear all,
back in January I posted about migration from courier and in
particular on the script courier-dovecot-migrate.pl.
That script had a bug on BSD (or should I say not-Linux?) type
systems*. On FreeBSD (6.1) and MacOSX (10.5) it appended a lot of
binary garbage at the end of dovecot-keywords files.
On a couple of systems I had not actually run the script with the --
convert option, as I had misunderstood the procedure, so those
systems, ironically, are the ones that I migrated better...
Now to the issue. My final question at the time was (http://dovecot.org/pipermail/dovecot/2009-January/036292.html):
can one delete the dovecot-keywords and rerun the script (leaving
alone the dovecot-uidlist)?
There is a problem if this cannot be done, as those files have the
following structure:
0 flag0 1 flag1 ... m binary garbage [optionally followed by more lines like the last]
and if a new keyword is added, the file ends up like (this is copy and
paste example):
0 JunkRecorded 1 $NotJunk 2 $Junk 3 Redirected 4 ^A<F0># 5 <B0><96># 6 $Forwarded
It does not look like a nice thing to me.
I doubt though that the script will cope with flags correctly, as in
principle will get the flags from an out of date courierimapkeywords,
thus missing any new ones.
Perhaps the only solution is to have a new script that deletes the
garbage lines and renumbers the following ones, so that the above
example would become:
0 JunkRecorded 1 $NotJunk 2 $Junk 3 Redirected 4 $Forwarded
and then renames all *g files to *e.
Thoughts?
Giuliano
- This bug was fixed back then by Timo who replaced the script on the
site http://www.dovecot.org/tools/courier-dovecot-migrate.pl. But
there's no note of the change on the site nor was an announcement made
to the list, AFAIK.
On Fri, 2009-05-15 at 10:55 +0200, Giuliano Gavazzi wrote:
I doubt though that the script will cope with flags correctly, as in
principle will get the flags from an out of date courierimapkeywords,
thus missing any new ones.
Right.
Perhaps the only solution is to have a new script that deletes the
garbage lines and renumbers the following ones, so that the above
example would become:0 JunkRecorded 1 $NotJunk 2 $Junk 3 Redirected 4 $Forwarded
and then renames all *g files to *e.
You don't have to do any renaming, the keywords don't need to be sequential. Just delete those lines with broken keywords. When adding new keywords Dovecot will then use the missing spots.
On S 17 May, 2009, at 20:45 , Timo Sirainen wrote:
On Fri, 2009-05-15 at 10:55 +0200, Giuliano Gavazzi wrote:
Perhaps the only solution is to have a new script that deletes the garbage lines and renumbers the following ones, so that the above example would become:
0 JunkRecorded 1 $NotJunk 2 $Junk 3 Redirected 4 $Forwarded
and then renames all *g files to *e.
You don't have to do any renaming, the keywords don't need to be sequential. Just delete those lines with broken keywords. When adding new keywords Dovecot will then use the missing spots.
that's great, thanks!
I suppose something like this should work, repeated over all maildirs:
/usr/local/etc/rc.d/dovecot stop find . -name "dovecot-keywords2" -exec sed -E -i .bu -e '/ ^[0-9]\ .*[^[:print:]].*$/d' \{\} \; /usr/local/etc/rc.d/dovecot start
(adapt to your system way to stop and start service)
There's only one point that escapes me, why perform the conversion
when migrating (using the --convert option) given that on the system
where I did not perform it the flags have been preserved (the files
got their name change consistently). Does dovecot detect the presence
of the courierimapkeywords/:list file and use its content? Seems
unlikely as a grep on the source does not reveal any match. Maybe it's
the MUA (Mail.app in the instance I checked) that did synchronise the
flags?
Giuliano
On Mon, 2009-05-18 at 00:57 +0200, Giuliano Gavazzi wrote:
There's only one point that escapes me, why perform the conversion
when migrating (using the --convert option) given that on the system
where I did not perform it the flags have been preserved (the files
got their name change consistently). Does dovecot detect the presence
of the courierimapkeywords/:list file and use its content?
No.
Seems
unlikely as a grep on the source does not reveal any match. Maybe it's
the MUA (Mail.app in the instance I checked) that did synchronise the
flags?
I guess something like that is possible. But did you check that it's also correct on the server side too and not just on client side?
On M 18 May, 2009, at 01:00 , Timo Sirainen wrote:
On Mon, 2009-05-18 at 00:57 +0200, Giuliano Gavazzi wrote:
There's only one point that escapes me, why perform the conversion when migrating (using the --convert option) given that on the system where I did not perform it the flags have been preserved (the files got their name change consistently). Does dovecot detect the presence of the courierimapkeywords/:list file and use its content?
No.
Seems unlikely as a grep on the source does not reveal any match. Maybe
it's the MUA (Mail.app in the instance I checked) that did synchronise the flags?I guess something like that is possible. But did you check that it's also correct on the server side too and not just on client side?
yes, is on the server: that's why I said that the files had the
consistent name change.
Well, that means that with all its faults Mail.app is not sooo bad!
I checked on another system with many OutLook and Thunderbird clients
and it looks like they might have lost the flags previous to the
change. I could write a script to update those files consistently to
the current dovecot-keywords, when required. This could be an option
of the migration script, say a --fix switch that would make it look in
courierimapkeywords and add the keys to dovecot-keywords when they do
not exist and then update the name of the message files when required.
Giuliano
participants (2)
-
Giuliano Gavazzi
-
Timo Sirainen