]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Don't crash if cache is thought broken for a newly saved mail
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 19 May 2017 08:05:22 +0000 (11:05 +0300)
committerGitLab <gitlab@git.dovecot.net>
Sat, 20 May 2017 18:22:04 +0000 (21:22 +0300)
It's a bug that it happens, but the resulting crash is confusing.
Although arguably this new error could be i_panic() instead.

Fixes:
Panic: file mail-index-transaction-update.c: line 1018 (mail_index_update_ext): assertion failed: (seq > 0 && (seq <= mail_index_view_get_messages_count(t->view) || seq <= t->last_new_seq))

src/lib-storage/index/index-mail.c

index 0d284890d22a5d3a6bc5bb17651cf55776869f5f..0b920691da504146270e57cdd3ae030a61f98f41 100644 (file)
@@ -2343,7 +2343,12 @@ void index_mail_set_cache_corrupted(struct mail *mail,
        mail_cache_transaction_reset(mail->transaction->cache_trans);
        imail->data.no_caching = TRUE;
        imail->data.forced_no_caching = TRUE;
-       if (reason[0] == '\0') {
+
+       if (mail->saving) {
+               mail_storage_set_critical(mail->box->storage,
+                       "BUG: Broken %s found in mailbox %s while saving a new mail: %s",
+                       field_name, mail->box->vname, reason);
+       } else if (reason[0] == '\0') {
                mail_set_mail_cache_corrupted(mail,
                        "Broken %s in mailbox %s",
                        field_name, mail->box->vname);