FastMail Cyrus Patches for upstream

Bron Gondwana brong at
Fri Aug 28 01:08:35 EDT 2009

On Fri, Aug 28, 2009 at 12:45:06AM -0400, Brian Awood wrote:
> > Right - that would be a bug then.  I'll poke around the code.
> > Just to confirm - the symptom is copied messages out of
> > order causing the intermediate cache records to be copied
> > as well?
> Yeah, one place I noticed a problem was in index_copysetup(), there's
>           CACHE_OFFSET(msgno+1) - CACHE_OFFSET(msgno);
> and
> 	  cache_end - CACHE_OFFSET(msgno);

You're quite right!  It should just be one case:

copyargs->copymsg[copyargs->nummsg].cache_len =
  mailbox_cacherecord_index(mailbox, msgno, 0);
> > Yeah, that's the problem though, because if the copied-back records
> > might have the wrong offsets unless everything was kept in sync
> > properly.
> Remember that the index records contain the correct offset, but the 
> cache records are "out of order".  So doing something like,
>   CACHE_OFFSET(msgno+1) - CACHE_OFFSET(msgno)
> returns a negative value.  It could also return too large of a value 
> if there are UIDs in the expunged state in between msgno+1 and msgno.  
> But it looks like using your cache_parserecord() instead should 
> correct those issues.

Yep :)

I've rolled that patch back down into my cache parsing updates.

Note I frequently rebase my "fastmail" branch on github, so it's a bit
of a pain to follow!  Unfortunately there's really no choice, because
you have to rebase in and our of CVS anyway.


More information about the Cyrus-devel mailing list