dovecot-2.2: lib-index: Avoid assert-crashing when syncing an ol...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 29 12:45:01 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/b0a6fe3aa61f
changeset: 15262:b0a6fe3aa61f
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 29 12:43:29 2012 +0200
description:
lib-index: Avoid assert-crashing when syncing an old "keyword reset" from transaction log.

diffstat:

 src/lib-index/mail-index-transaction-update.c |  14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r 4d0d3cc20bdb -r b0a6fe3aa61f src/lib-index/mail-index-transaction-update.c
--- a/src/lib-index/mail-index-transaction-update.c	Mon Oct 29 12:40:14 2012 +0200
+++ b/src/lib-index/mail-index-transaction-update.c	Mon Oct 29 12:43:29 2012 +0200
@@ -1014,9 +1014,21 @@
 keyword_update_remove_existing(struct mail_index_transaction *t, uint32_t seq)
 {
 	ARRAY_TYPE(keyword_indexes) keywords;
+	uint32_t i, keywords_count;
 
 	t_array_init(&keywords, 32);
-	mail_index_transaction_lookup_latest_keywords(t, seq, &keywords);
+	if (t->view->v.lookup_full == NULL) {
+		/* syncing is saving a list of changes into this transaction.
+		   the seq is actual an uid, so we can't lookup the existing
+		   keywords. we shouldn't get here unless we're reading
+		   pre-v2.2 keyword-reset records from .log files. so we don't
+		   really care about performance that much here, */
+		keywords_count = array_count(&t->view->index->keywords);
+		for (i = 0; i < keywords_count; i++)
+			array_append(&keywords, &i, 1);
+	} else {
+		mail_index_transaction_lookup_latest_keywords(t, seq, &keywords);
+	}
 	if (array_count(&keywords) == 0)
 		return NULL;
 	return mail_index_keywords_create_from_indexes(t->view->index,


More information about the dovecot-cvs mailing list