<<< Date Index >>>     <<< Thread Index >>>

[BUG] corruption when reopening mailbox



Hi,

I wanted to report a bug where two people editing the same
mailbox ends up corrupting the mailbox and losing most of
the messages.  Normally, if two people are changing the same
mailbox, mutt will report that the mailbox has changed and
just reload the mailbox.  We've found that often everything
will appear okay, but when we check the mailbox later we
find that it's virtually unreadable.


The bug seems to be in mutt_reopen_mailbox() in mbox.c.
That function does not actually reopen the mailbox
(in version 1.5.6i), but only does an fseek() to the beginning of
the file.  It looks like my stdio library is caching the file,
so that when the mailbox is resynced, it gets all the wrong message
offsets.  This manifests as a problem when two people are editing
the same mailbox, and we've been able to repeatedly have it
destroy the entire mailobox.

It looks like this can be easily fixed by adding a freopen()
into mutt_reopen_mailbox(), but I'm not 100% sure that this is
all that's necessary.  It works fine in my testing of it.

Thanks,
  -Bo Adler
   thumper@xxxxxxxxxxxxxxxx