Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jrse #222 #223

Merged
merged 3 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions src/storage-rbox/rbox-mail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,8 @@ using librmb::rbox_metadata_key;

void rbox_mail_set_expunged(struct rbox_mail *mail) {
FUNC_START();
struct mail *_mail = &mail->imail.mail.mail;

mail_index_refresh(_mail->box->index);
if (mail_index_is_expunged(_mail->transaction->view, _mail->seq)) {
mail_set_expunged(_mail);
} else {
mail_storage_set_critical(_mail->box->storage, "rbox %s: Unexpectedly lost uid=%u", mailbox_get_path(_mail->box),
_mail->uid);
/* the message was probably just purged */
mail_storage_set_error(_mail->box->storage, MAIL_ERROR_EXPUNGED, "requested messages no longer exist.");
rbox_set_mailbox_corrupted(_mail->box);
}
// only set mail to expunge. see #222 rbox_set_expunge => index rebuild!
mail_set_expunged((struct mail *)mail);
FUNC_END();
}

Expand Down
5 changes: 2 additions & 3 deletions src/tests/storage-rbox/it_test_read_mail_failed_rbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "TestCase.h"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow" // turn off warnings for Dovecot :-(
#pragma GCC diagnostic ignored "-Wshadow" // turn off warnings for Dovecot :-(
#pragma GCC diagnostic ignored "-Wundef" // turn off warnings for Dovecot :-(
#pragma GCC diagnostic ignored "-Wredundant-decls" // turn off warnings for Dovecot :-(
#ifndef __cplusplus
Expand Down Expand Up @@ -117,6 +117,7 @@ TEST_F(StorageTest, read_mail_fails) {

int ret2 = mail_get_stream(mail, &hdr_size, &body_size, &input);
EXPECT_EQ(ret2, -1);
EXPECT_TRUE(mail->expunged);
break;
}

Expand All @@ -132,8 +133,6 @@ TEST_F(StorageTest, read_mail_fails) {
FAIL() << "sync failed";
}

ASSERT_EQ(0, (int)box->index->map->hdr.messages_count);

mailbox_free(&box);
}

Expand Down