dovecot-2.0-sslstream: maildir: Changed index/uidlist mismatch f...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:56:39 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/aa8a12288c93
changeset: 10387:aa8a12288c93
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Nov 23 12:19:24 2009 -0500
description:
maildir: Changed index/uidlist mismatch from assert-crashing to logging an error.

diffstat:

1 file changed, 18 insertions(+), 6 deletions(-)
src/lib-storage/index/maildir/maildir-uidlist.c |   24 +++++++++++++++++------

diffs (36 lines):

diff -r 711fbedaad9d -r aa8a12288c93 src/lib-storage/index/maildir/maildir-uidlist.c
--- a/src/lib-storage/index/maildir/maildir-uidlist.c	Mon Nov 23 11:41:29 2009 -0500
+++ b/src/lib-storage/index/maildir/maildir-uidlist.c	Mon Nov 23 12:19:24 2009 -0500
@@ -1319,14 +1319,26 @@ maildir_uidlist_records_drop_expunges(st
 
 	i_array_init(&new_records, hdr->messages_count + 64);
 	recs = array_get(&uidlist->records, &count);
-	for (i = 0, seq = 1; i < count && seq <= hdr->messages_count; i++) {
+	for (i = 0, seq = 1; i < count && seq <= hdr->messages_count; ) {
 		rec = mail_index_lookup(view, seq);
-		if (recs[i]->uid != rec->uid)
-			i_assert(recs[i]->uid < rec->uid);
-		else {
+		if (recs[i]->uid < rec->uid) {
+			/* expunged entry */
+			i++;
+		} else if (recs[i]->uid > rec->uid) {
+			i_error("%s: uid=%u exists in index, "
+				"but not in uidlist",
+				uidlist->path, rec->uid);
+			seq++;
+		} else {
 			array_append(&new_records, &recs[i], 1);
-			seq++;
-		}
+			seq++; i++;
+		}
+	}
+
+	for (; seq <= hdr->messages_count; seq++) {
+		rec = mail_index_lookup(view, seq);
+		i_error("%s: uid=%u exists in index tail, but not in uidlist",
+			uidlist->path, rec->uid);
 	}
 
 	/* drop messages expunged at the end of index */


More information about the dovecot-cvs mailing list