On Tue, 2010-07-20 at 08:42 -0400, Erik Kratzenberg wrote:
I experienced this today with my own IMAP folder, so maybe being able to offer a more specific order of events will help. Also not sure if I previously mentioned that this is occasionally happening with IMAP folders even though it's much more common under POP3.
- I had just cleaned out my Junk folder.
- Two messages were received without error.
So basically what POP3 clients usually do, delete everything. Does the mailbox have the "FOLDER INTERNAL DATA" message at the beginning?
I marked the folder as read in Thunderbird.
I restarted Thunderbird
The next delivery attempt to that mailbox (using dovecot deliver) failed:
save failed to Junk: Mailbox isn't a valid mbox file
The odd thing is that the delivery *did* succeed because that message is in there.
Or maybe you just got two of those same messages? :) I don't think it could have written it after giving this error.
The very first message header is the one that was corrupted which always seems to be the case. Does "deliver" read/write the entire mbox file or just append the new message to the end?
deliver first checks that the mbox file is valid by reading and verifying the From_-line at the beginning of the file. If it's ok, then it appends to end of file. The corruption most likely happened during the expunge, not in deliver.
Hmm. See what it logs with attached patch?