[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync-private.h, 1.61, 1.62 mbox-sync-rewrite.c, 1.69, 1.70 mbox-sync.c, 1.198, 1.199

tss at dovecot.org tss at dovecot.org
Mon Feb 19 23:29:03 UTC 2007


Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv17782

Modified Files:
	mbox-sync-private.h mbox-sync-rewrite.c mbox-sync.c 
Log Message:
Rewriting still wasn't replacing broken X-UID headers correctly always,
causing assert-crashes.



Index: mbox-sync-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-private.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- mbox-sync-private.h	16 Feb 2007 19:01:35 -0000	1.61
+++ mbox-sync-private.h	19 Feb 2007 23:29:00 -0000	1.62
@@ -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;
 

Index: mbox-sync-rewrite.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-rewrite.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- mbox-sync-rewrite.c	16 Feb 2007 19:01:35 -0000	1.69
+++ mbox-sync-rewrite.c	19 Feb 2007 23:29:01 -0000	1.70
@@ -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;
 }

Index: mbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -d -r1.198 -r1.199
--- mbox-sync.c	6 Feb 2007 19:51:13 -0000	1.198
+++ mbox-sync.c	19 Feb 2007 23:29:01 -0000	1.199
@@ -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;



More information about the dovecot-cvs mailing list