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. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20090517/03303c03/attachment-0002.bin>
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