Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5171:55009a9c917a HEAD
Rewriting still wasn't replacing broken X-UID headers correctly always,
causing assert-crashes.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 20 Feb 2007 01:29:00 +0200 |
parents | 3516e9856179 |
children | b3e8f4fbab3e |
files | src/lib-storage/index/mbox/mbox-sync-private.h src/lib-storage/index/mbox/mbox-sync-rewrite.c src/lib-storage/index/mbox/mbox-sync.c |
diffstat | 3 files changed, 4 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync-private.h Mon Feb 19 22:00:25 2007 +0200 +++ b/src/lib-storage/index/mbox/mbox-sync-private.h Tue Feb 20 01:29:00 2007 +0200 @@ -123,7 +123,6 @@ pool_t saved_keywords_pool; uint32_t prev_msg_uid, next_uid, idx_next_uid; - uint32_t prev_next_uid, need_space_next_uid; uint32_t seq, idx_seq, need_space_seq; off_t expunged_space, space_diff;
--- a/src/lib-storage/index/mbox/mbox-sync-rewrite.c Mon Feb 19 22:00:25 2007 +0200 +++ b/src/lib-storage/index/mbox/mbox-sync-rewrite.c Tue Feb 20 01:29:00 2007 +0200 @@ -333,6 +333,10 @@ /* mbox_sync_parse_next_mail() checks that UIDs are growing, so we have to fool it. */ sync_ctx->prev_msg_uid = mails[idx].uid == 0 ? 0 : mails[idx].uid-1; + /* If we originally thought that the UID was broken, force the + brokeness now also. Otherwise try to make the UID what we wanted + it originally. */ + sync_ctx->next_uid = mails[idx].uid_broken ? 0 : mail_ctx->mail.uid - 1; first_mail_expunge_extra = 1 + sync_ctx->first_mail_crlf_expunged ? 1 : 0; @@ -359,9 +363,6 @@ if (mail_ctx->have_eoh) str_append_c(mail_ctx->header, '\n'); } - - if (mail_ctx->mail.uid >= sync_ctx->next_uid) - sync_ctx->next_uid = mail_ctx->mail.uid + 1; } static int mbox_sync_read_and_move(struct mbox_sync_context *sync_ctx, @@ -483,10 +484,8 @@ } i_assert(mails[first_nonexpunged_idx].space < 0); - /* broken UIDs are generated from next_uid */ orig_prev_msg_uid = sync_ctx->prev_msg_uid; orig_next_uid = sync_ctx->next_uid; - sync_ctx->next_uid = sync_ctx->need_space_next_uid; /* start moving backwards. */ while (idx > first_nonexpunged_idx) { @@ -565,7 +564,6 @@ i_stream_sync(sync_ctx->input); sync_ctx->next_uid = orig_next_uid; - sync_ctx->need_space_next_uid = 0; sync_ctx->prev_msg_uid = orig_prev_msg_uid; return ret; }
--- a/src/lib-storage/index/mbox/mbox-sync.c Mon Feb 19 22:00:25 2007 +0200 +++ b/src/lib-storage/index/mbox/mbox-sync.c Tue Feb 20 01:29:00 2007 +0200 @@ -115,7 +115,6 @@ istream_raw_mbox_get_start_offset(sync_ctx->input); mail_ctx->mail.offset = istream_raw_mbox_get_header_offset(sync_ctx->input); - sync_ctx->prev_next_uid = sync_ctx->next_uid; mbox_sync_parse_next_mail(sync_ctx->input, mail_ctx); i_assert(sync_ctx->input->v_offset != mail_ctx->mail.from_offset || @@ -758,10 +757,6 @@ sync_ctx->need_space_seq = sync_ctx->seq; sync_ctx->space_diff = 0; - /* remember what the next_uid was before we parsed this mail, - so that rewriting can set it back */ - sync_ctx->need_space_next_uid = sync_ctx->prev_next_uid; - if (sync_ctx->expunged_space > 0) { /* create dummy message to describe the expunged data */ struct mbox_sync_mail mail;