[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-sync.c,
1.16, 1.17
cras at procontrol.fi
cras at procontrol.fi
Sat May 22 04:18:19 EEST 2004
Update of /home/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv24244/lib-storage/index/maildir
Modified Files:
maildir-sync.c
Log Message:
Fix bogus "UID inserted in the middle of mailbox" errors
Index: maildir-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-sync.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- a/maildir-sync.c 22 May 2004 00:48:45 -0000 1.16
+++ b/maildir-sync.c 22 May 2004 01:18:17 -0000 1.17
@@ -602,15 +602,36 @@
}
if (rec->uid > uid) {
- /* new UID in the middle of the mailbox -
- shouldn't happen */
- mail_storage_set_critical(ibox->box.storage,
- "Maildir sync: UID inserted in the middle "
- "of mailbox (%u > %u, file = %s)",
- rec->uid, uid, filename);
- mail_index_mark_corrupted(ibox->index);
- ret = -1;
- break;
+ /* most likely a race condition: we read the
+ maildir, then someone else expunged messages and
+ committed changes to index. so, this message
+ shouldn't actually exist. check to be sure.
+
+ FIXME: we could avoid this stat() and just mark
+ this check in the uidlist and check it at next
+ sync.. */
+ struct stat st;
+ const char *str;
+
+ t_push();
+ str = t_strdup_printf("%s/%s",
+ (uflags & MAILDIR_UIDLIST_REC_FLAG_NEW_DIR) ?
+ ctx->new_dir : ctx->cur_dir, filename);
+ if (stat(str, &st) == 0) {
+ t_pop();
+ mail_storage_set_critical(ibox->box.storage,
+ "Maildir sync: UID inserted in the "
+ "middle of mailbox "
+ "(%u > %u, file = %s)",
+ rec->uid, uid, filename);
+ mail_index_mark_corrupted(ibox->index);
+ ret = -1;
+ break;
+ }
+ t_pop();
+
+ seq--;
+ continue;
}
if ((rec->flags & MAIL_INDEX_MAIL_FLAG_DIRTY) != 0) {
More information about the dovecot-cvs
mailing list