imap flags lost after upgrade (2.0.15 to 2.2.6) [problem solved]

Tomas Lindroos DC skitta at
Wed Aug 18 11:08:24 EDT 2004

Ken Murchison wrote:

> Tomas Lindroos DC wrote:

>> I had to write a program that 'upgrades' this database, which is then 
>> run on all mailboxes before running 'reconstruct' on the new server. 
>> Now all flags and other data is transferred correctly.

> Exactly what does your script have to change?  I'd like to fix the 
> mailbox code.

I took the header source code from mailbox.h in version 2.0.15 and 2.2.6 
and looked at the differences, and checked with the documentation to see 
  what the records in cyrus.index should look like. Having the structs 
for index_header and index_record for both versions, I read records from 
the  old cyrus.index and constructed a new one. If everything seemed 
allright, i made a rename(oldfile, backupfile) and rename(newfile, 
oldfile). So I didn't do as much changes as I created a new database 
from scratch...

I do a couple of assumptions while converting the files, which may or 
may not be sane. Do any of these look too dangerous to be used?

index_record->content_lines = 0; /* wrong, but I don't parse all the 
messages to look for line counts right now */

index_record->cache_version = 0; /* I hope this contributes to getting 
the cache file rebuild from scratch */

index_header->generation_no = 0; /* as above, hopefully a cache gen 
mismatch. (this could be read from the cache-file, of course) */

Does this seem ok?

Also, no flags are shown to the imap client if the counters deleted, 
answered and flagged in cyrus.index are set to 0, so while converting 
the index_records I count these flags and set the values in the header.

Anyway, when I run reconstruct, mailbox_open_index() fails (line 515 in 
reconstruct.c), whereafter mailbox_read_index_record() does something 
that makes the check "if (old_index.uid == uid[msg])" false. Which in 
the end means that a lot of values for the current message are set to 
zero. I'm sorry, but I don't have the time to delve into this any 
further right now.

Ken, I could supply you one of my example-mailboxes that fails to 
convert, if that would help you get on with debugging this problem.


  Tomas 'Skitta' Lindroos. Planerare vid Datacentralen, UNIX-sektionen
                <skitta at>, (215)4469

Cyrus Home Page:
Cyrus Wiki/FAQ:
List Archives/Info:

More information about the Info-cyrus mailing list