[evolution-patches] 63521, messages left on server after pop delete




found a whole raft of bugs related to this issue.  see the bug report for more details.

the 'forcing delete of message' bit could be 'risky' since it just deletes every message on the server, even those we didn't download, if 'keep on server' isn't set.  but i see no other solution to the original problem.  however, it absolutely relies on the exception not getting cleared 'incidentally'!

various other fixes mean that unless we have a network outage, deletes always go to the server now anyway, even if the user cancelled the download.

--
Michael Zucchi <notzed ximian com>
"born to die, live to work, it's all downhill from here"
Novell's Evolution and Free Software Developer
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3444.2.8
diff -u -3 -r1.3444.2.8 ChangeLog
--- mail/ChangeLog	21 Sep 2004 01:50:33 -0000	1.3444.2.8
+++ mail/ChangeLog	21 Sep 2004 08:58:11 -0000
@@ -1,3 +1,12 @@
+2004-09-21  Not Zed  <NotZed Ximian com>
+
+	** See bug #63521.
+
+	* mail-ops.c (fetch_mail_fetch): delete all the messages on the
+	server if we're not in keep on server mode and everything worked.
+	uncancel ourselves before saving the cache uid since it could be
+	cancelled otherwise.
+
 2004-09-21  David Malcolm  <dmalcolm redhat com>
 
 	* em-folder-tree-model.c (em_folder_tree_model_set_selected): Fix
Index: mail/mail-ops.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-ops.c,v
retrieving revision 1.438
diff -u -3 -r1.438 mail-ops.c
--- mail/mail-ops.c	17 Jun 2004 07:34:50 -0000	1.438
+++ mail/mail-ops.c	21 Sep 2004 08:58:14 -0000
@@ -317,16 +317,27 @@
 					fm->cache = cache;
 					em_filter_folder_element_filter (mm);
 					
+					/* need to uncancel so writes/etc. don't fail */
+					if (mm->ex.id == CAMEL_EXCEPTION_USER_CANCEL)
+						camel_operation_uncancel(NULL);
+
 					/* save the cache of uids that we've just downloaded */
 					camel_uid_cache_save (cache);
+				}
 
-					/* if we don't do this, no operations on the folder will work */
-					if (mm->ex.id == CAMEL_EXCEPTION_USER_CANCEL)
-						camel_operation_uncancel(NULL);
+				if (fm->delete && mm->ex.id == CAMEL_EXCEPTION_NONE) {
+					/* not keep on server - just delete all the actual messages on the server */
+					for (i=0;i<folder_uids->len;i++) {
+						d(printf("force delete uid '%s'\n", (char *)folder_uids->pdata[i]));
+						camel_folder_delete_message(folder, folder_uids->pdata[i]);
+					}
+				}
 
+				if (fm->delete || cache_uids) {
 					/* expunge messages (downloaded so far) */
 					camel_folder_sync(folder, fm->delete, NULL);
 				}
+
 				camel_uid_cache_destroy (cache);
 				camel_folder_free_uids (folder, folder_uids);
 			} else {
Index: camel/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.2251.2.2
diff -u -3 -r1.2251.2.2 ChangeLog
--- camel/ChangeLog	20 Sep 2004 08:10:23 -0000	1.2251.2.2
+++ camel/ChangeLog	21 Sep 2004 08:58:16 -0000
@@ -1,3 +1,39 @@
+2004-09-21  Not Zed  <NotZed Ximian com>
+
+	** See bug #63521.
+
+	* camel-movemail.c (camel_movemail): don't clear exception on entry.
+
+	* camel-folder-search.c (match_words_message): use local exception.
+
+	* camel-operation.c (camel_operation_cancel_check): soak up all
+	cancellation requests as soon as we get one.
+	(camel_operation_uncancel): soak up all cancellation reqeusts when
+	we uncancel.
+
+	* camel-uid-cache.c (camel_uid_cache_save): open the file O_TRUNC
+	rather than O_EXCL, otherwise a crash would mean this file never
+	gets updated.
+	(camel_uid_cache_save): block cancellation around writes otherwise
+	we could be interupted from old cancellation.
+
+	* providers/local/camel-local-folder.c
+	(camel_local_folder_construct): don't clear exception here, just
+	don't pass it to summary load.
+
+	* providers/pop3/camel-pop3-store.c (pop3_connect): only clear the
+	exception when we received one we handled.
+
+	* camel-filter-driver.c (close_folder): if exception is already
+	set, don't pass it to folder.sync().
+
+	* camel-lock.c (camel_lock_folder): don't clear the exception
+	here, if it came in set its a programming error.
+
+	* camel-filter-driver.c (camel_filter_driver_filter_message): if
+	the exception is set after evaluating the expression, stop
+	immediately.
+
 2004-09-15  Not Zed  <NotZed Ximian com>
 
 	** See bug #0xffff.
Index: camel/camel-filter-driver.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-filter-driver.c,v
retrieving revision 1.86
diff -u -3 -r1.86 camel-filter-driver.c
--- camel/camel-filter-driver.c	14 Jul 2004 19:00:37 -0000	1.86
+++ camel/camel-filter-driver.c	21 Sep 2004 08:58:16 -0000
@@ -937,7 +937,7 @@
 	g_free (key);
 
 	if (folder != FOLDER_INVALID) {
-		camel_folder_sync (folder, FALSE, p->ex);
+		camel_folder_sync (folder, FALSE, camel_exception_is_set(p->ex)?NULL : p->ex);
 		camel_folder_thaw (folder);
 		camel_object_unref (folder);
 	}
@@ -1422,6 +1422,9 @@
 				goto error;
 			}
 			r = e_sexp_eval (p->eval);
+			if (camel_exception_is_set(p->ex))
+				goto error;
+
 			if (r == NULL) {
 				camel_exception_setv (ex, 1, _("Error executing filter: %s: %s"),
 						      e_sexp_error (p->eval), node->action);
Index: camel/camel-folder-search.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-folder-search.c,v
retrieving revision 1.67
diff -u -3 -r1.67 camel-folder-search.c
--- camel/camel-folder-search.c	3 Jun 2004 09:29:08 -0000	1.67
+++ camel/camel-folder-search.c	21 Sep 2004 08:58:17 -0000
@@ -1108,15 +1108,16 @@
 {
 	guint32 mask;
 	CamelMimeMessage *msg;
+	CamelException x = CAMEL_EXCEPTION_INITIALISER;
 	int truth;
 
-	msg = camel_folder_get_message(folder, uid, ex);
+	msg = camel_folder_get_message(folder, uid, &x);
 	if (msg) {
 		mask = 0;
 		truth = match_words_1message((CamelDataWrapper *)msg, words, &mask);
 		camel_object_unref((CamelObject *)msg);
 	} else {
-		camel_exception_clear(ex);
+		camel_exception_clear(&x);
 		truth = FALSE;
 	}
 
Index: camel/camel-lock.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-lock.c,v
retrieving revision 1.17
diff -u -3 -r1.17 camel-lock.c
--- camel/camel-lock.c	11 Nov 2002 06:24:54 -0000	1.17
+++ camel/camel-lock.c	21 Sep 2004 08:58:18 -0000
@@ -314,8 +314,6 @@
 		if (retry > 0)
 			sleep(CAMEL_LOCK_DELAY);
 
-		camel_exception_clear(ex);
-
 		if (camel_lock_fcntl(fd, type, ex) == 0) {
 			if (camel_lock_flock(fd, type, ex) == 0) {
 				if (camel_lock_dot(path, ex) == 0)
Index: camel/camel-movemail.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-movemail.c,v
retrieving revision 1.20
diff -u -3 -r1.20 camel-movemail.c
--- camel/camel-movemail.c	18 Sep 2003 17:06:20 -0000	1.20
+++ camel/camel-movemail.c	21 Sep 2004 08:58:18 -0000
@@ -92,8 +92,6 @@
 	int sfd, dfd;
 	struct stat st;
 
-	camel_exception_clear(ex);
-
 	/* Stat and then open the spool file. If it doesn't exist or
 	 * is empty, the user has no mail. (There's technically a race
 	 * condition here in that an MDA might have just now locked it
Index: camel/camel-operation.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-operation.c,v
retrieving revision 1.18
diff -u -3 -r1.18 camel-operation.c
--- camel/camel-operation.c	18 Jun 2004 20:07:09 -0000	1.18
+++ camel/camel-operation.c	21 Sep 2004 08:58:18 -0000
@@ -334,7 +334,12 @@
 		cc = (CamelOperation *)pthread_getspecific(operation_key);
 
 	if (cc) {
+		CamelOperationMsg *msg;
+
 		LOCK();
+		while ((msg = (CamelOperationMsg *)e_msgport_get(cc->cancel_port)))
+			g_free(msg);
+
 		cc->flags &= ~CAMEL_OPERATION_CANCELLED;
 		UNLOCK();
 	}
@@ -406,7 +411,9 @@
 		cancelled = TRUE;
 	} else if ((msg = (CamelOperationMsg *)e_msgport_get(cc->cancel_port))) {
 		d(printf("Got cancellation message\n"));
-		g_free(msg);
+		do {
+			g_free(msg);
+		} while ((msg = (CamelOperationMsg *)e_msgport_get(cc->cancel_port)));
 		cc->flags |= CAMEL_OPERATION_CANCELLED;
 		cancelled = TRUE;
 	} else
Index: camel/camel-uid-cache.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-uid-cache.c,v
retrieving revision 1.13
diff -u -3 -r1.13 camel-uid-cache.c
--- camel/camel-uid-cache.c	23 Jul 2003 14:57:20 -0000	1.13
+++ camel/camel-uid-cache.c	21 Sep 2004 08:58:18 -0000
@@ -153,7 +153,7 @@
 	int fd;
 	
 	filename = g_strdup_printf ("%s~", cache->filename);
-	if ((fd = open (filename, O_WRONLY | O_CREAT | O_EXCL, 0666)) == -1) {
+	if ((fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC, 0666)) == -1) {
 		g_free (filename);
 		return FALSE;
 	}
@@ -267,7 +267,7 @@
 	
 	new_uids = g_ptr_array_new ();
 	cache->level++;
-	
+
 	for (i = 0; i < uids->len; i++) {
 		struct _uid_state *state;
 		
@@ -303,7 +303,7 @@
 	gpointer old_uid;
 	
 	g_return_if_fail (uid != NULL);
-	
+
 	if (g_hash_table_lookup_extended (cache->uids, uid, (void **)&old_uid, (void **)&state)) {
 		state->save = TRUE;
 		state->level = cache->level;
@@ -311,7 +311,7 @@
 		state = g_new (struct _uid_state, 1);
 		state->save = TRUE;
 		state->level = cache->level;
-		
+
 		g_hash_table_insert (cache->uids, g_strdup (uid), state);
 	}
 }
Index: camel/providers/local/camel-local-folder.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/local/camel-local-folder.c,v
retrieving revision 1.50.16.1
diff -u -3 -r1.50.16.1 camel-local-folder.c
--- camel/providers/local/camel-local-folder.c	20 Sep 2004 08:10:23 -0000	1.50.16.1
+++ camel/providers/local/camel-local-folder.c	21 Sep 2004 08:58:19 -0000
@@ -300,8 +300,8 @@
 	}
 
 	folder->summary = (CamelFolderSummary *)CLOCALF_CLASS(lf)->create_summary(lf->summary_path, lf->folder_path, lf->index);
-	if (camel_local_summary_load((CamelLocalSummary *)folder->summary, forceindex, ex) == -1) {
-		camel_exception_clear(ex);
+	if (camel_local_summary_load((CamelLocalSummary *)folder->summary, forceindex, NULL) == -1) {
+		/* ? */
 	}
 	
 	/*if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == -1) {*/
Index: camel/providers/pop3/camel-pop3-store.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/pop3/camel-pop3-store.c,v
retrieving revision 1.106
diff -u -3 -r1.106 camel-pop3-store.c
--- camel/providers/pop3/camel-pop3-store.c	24 Jun 2004 21:49:41 -0000	1.106
+++ camel/providers/pop3/camel-pop3-store.c	21 Sep 2004 08:58:19 -0000
@@ -593,7 +593,6 @@
 		return FALSE;
 	
 	do {
-		camel_exception_clear (ex);
 		status = pop3_try_authenticate (service, reprompt, errbuf, ex);
 		g_free (errbuf);
 		errbuf = NULL;
@@ -604,6 +603,7 @@
 			g_free (service->url->passwd);
 			service->url->passwd = NULL;
 			reprompt = TRUE;
+			camel_exception_clear (ex);
 		}
 	} while (status != -1 && ex->id == CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE);
 	


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]