From: Karl Fleischmann Date: Tue, 7 Feb 2023 10:07:05 +0000 (+0100) Subject: lib-storage: Make mail error UID reporting consistent for corrupted cache X-Git-Tag: 2.4.0~2984 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=965935c54954a1bc5b1d9c8c3d11da2b6b0b0834;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Make mail error UID reporting consistent for corrupted cache --- diff --git a/src/lib-index/mail-cache.c b/src/lib-index/mail-cache.c index 9016414e75..44e9146120 100644 --- a/src/lib-index/mail-cache.c +++ b/src/lib-index/mail-cache.c @@ -75,7 +75,7 @@ void mail_cache_set_seq_corrupted_reason(struct mail_cache_view *cache_view, mail_index_lookup_uid(cache_view->view, seq, &uid); const char *errstr = t_strdup_printf( - "Deleting corrupted cache record uid=%u: %s", uid, reason); + "UID %u: Deleting corrupted cache record: %s", uid, reason); e_error(event_create_passthrough(cache->event)-> set_name("mail_cache_record_corrupted")-> add_int("uid", uid)-> diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index 57731820df..40c17e1797 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -3387,9 +3387,7 @@ void mail_set_mail_cache_corrupted(struct mail *mail, const char *fmt, ...) T_BEGIN { mail_cache_set_seq_corrupted_reason(cache_view, mail->seq, - t_strdup_printf("UID %u: %s", - mail->uid, - t_strdup_vprintf(fmt, va))); + t_strdup_vprintf(fmt, va)); } T_END; /* update also the storage's internal error */ diff --git a/src/lib-storage/test-mail.c b/src/lib-storage/test-mail.c index 260e09438d..8d60da69f0 100644 --- a/src/lib-storage/test-mail.c +++ b/src/lib-storage/test-mail.c @@ -464,7 +464,7 @@ static void test_bodystructure_corruption_reparsing(void) mail_set_seq(mail, 1); test_assert(mail_get_special(mail, MAIL_FETCH_IMAP_BODY, &value) == 0); - test_expect_error_string("Mailbox INBOX: Deleting corrupted cache record uid=1: UID 1: Broken MIME parts in mailbox INBOX: test"); + test_expect_error_string("Mailbox INBOX: UID 1: Deleting corrupted cache record: Broken MIME parts in mailbox INBOX: test"); mail_set_cache_corrupted(mail, MAIL_FETCH_MESSAGE_PARTS, "test"); test_expect_no_more_errors(); test_assert(mail_get_special(mail, MAIL_FETCH_IMAP_BODYSTRUCTURE, &value) == 0);