Cyrus 2.4.X delete mailbox oddities

Bron Gondwana brong at
Tue Jun 28 08:31:54 EDT 2011

On Tue, 28 Jun 2011 10:02 +0100, "David Carter" <dpc22 at> wrote:
> On Tue, 28 Jun 2011, Bron Gondwana wrote:
> >> I have however discovered two wrinkles when deleting mailboxes selected by
> >> some other IMAP session. PINE might leave a mailbox selected for days.
> >
> > Well, that's classy PINE.
> Do you want to have an debate with Mark Crispin about correct behaviour of 
> IMAP clients? I still have the scars from last time, and that was probably 
> about 1997 :)
> > How is it keeping the connection open?  Surely it sees the deletion 
> > event and closes it.
> PINE sees that the messages in the selected mailbox have been expunged:
>   . NOOP
>   * 1 EXPUNGE
>   . OK Completed

Oh, that's a bug.

    if (imapd_index)
>-------index_check(imapd_index, 1, 0);

    prot_printf(imapd_out, "%s OK %s\r\n", tag,

It should check the result of "index_check" and return an error if the
mailbox has gone away I suspect.

> It would need to do a 'LIST "" *' to spot that the list of available 
> mailboxes had changed.
> I've just trying forcing this and it doesn't seem to unselect the deleted 
> mailbox. It is possible that it would sort itself out eventually, but the 
> deleted mailbox was still selected after several minutes.

Yeah - hopefully if I fix that bug.

> > Yeah, sorry - short of forcibly killing the connection, there's not much 
> > we can do about this without breaking the guarantees that messages are 
> > still available.
> Fair enough. I don't know whether this is actually a problem yet, I just 
> noticed a difference in behaviour from 2.3.X in my testing.

Yes, 2.3.x was unsafe in a bunch of ways, and this was one of them.  I
wanted to enforce reliable semantics in 2.4 - hence this locking system.
You can't delete any files while someone else has the mailbox open, you
can only set a flag in the header so the other connection knows that a
cleanup is required.

This even applied to "immediate" expunge.  It only actually unlinks the
files if nobody else has the mailbox open.

  Bron Gondwana
  brong at

More information about the Info-cyrus mailing list