Re: [Evolution-hackers] Huh .. mail_list_magic[0].pattern gets written to the summary file!



On Tue, 2006-07-11 at 22:28 +0200, Philip Van Hoof wrote:
> Somebody definitely needs to explain me how he managed to write
> mail_list_magic[0].pattern into the summary file of some of my mailing
> lists ;-)!
> 
> http://pvanhoof.be/files/mail_list_magic_in_summary.png
> 
> I didn't alter the code that writes the summary file. So I'm confident
> that this bug also happens for people who aren't using the mmap patches
> yet.
> 
> Note that the summary-loader will simply fail and Evolution will simply
> ask for a new summary file if this happen. So it's perfectly normal if
> you never saw a bug in bugzilla about this one.
> 
> It looks like it's always at the subject location. So right after the
> uid string in the summary file.

For now. I simply removed the functionality. With this patch, I'm no
longer seeing the problem in my summary files.

I tested this on a normal Camel, it also has the problem. So it's not
related to whatever I'm trying to do with mmap.

Try:

cd $HOME/.evolution/mail
grep "mailto": * -r | grep summary

And wonder why there's "mailto:"; in your summary files. ;-)


-- 
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be
Index: camel-mime-utils.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-mime-utils.c,v
retrieving revision 1.238
diff -u -p -r1.238 camel-mime-utils.c
--- camel-mime-utils.c	13 Apr 2006 19:59:13 -0000	1.238
+++ camel-mime-utils.c	11 Jul 2006 20:48:31 -0000
@@ -3979,117 +3979,11 @@ camel_header_msgid_generate (void)
 }
 
 
-static struct {
-	char *name;
-	char *pattern;
-	regex_t regex;
-} mail_list_magic[] = {
-	/* List-Post: <mailto:gnome-hackers gnome org> */
-	/* List-Post: <mailto:gnome-hackers> */
-	{ "List-Post", "[ \t]*<mailto:([^@>]+)@?([^ \n\t\r>]*)" },
-	/* List-Id: GNOME stuff <gnome-hackers.gnome.org> */
-	/* List-Id: <gnome-hackers.gnome.org> */
-	/* List-Id: <gnome-hackers> */
-	/* This old one wasn't very useful: { "List-Id", " *([^<]+)" },*/
-	{ "List-Id", "[^<]*<([^\\.>]+)\\.?([^ \n\t\r>]*)" },
-	/* Mailing-List: list gnome-hackers gnome org; contact gnome-hackers-owner gnome org */
-	{ "Mailing-List", "[ \t]*list ([^ ]+)@?([^ \n\t\r>;]*)" },
-	/* Originator: gnome-hackers gnome org */
-	{ "Originator", "[ \t]*([^ ]+)@?([^ \n\t\r>]*)" },
-	/* X-Mailing-List: <gnome-hackers gnome org> arcive/latest/100 */
-	/* X-Mailing-List: gnome-hackers gnome org */
-	/* X-Mailing-List: gnome-hackers */
-	/* X-Mailing-List: <gnome-hackers> */
-	{ "X-Mailing-List", "[ \t]*<?([^@>]+)@?([^ \n\t\r>]*)" },
-	/* X-Loop: gnome-hackers gnome org */
-	{ "X-Loop", "[ \t]*([^ ]+)@?([^ \n\t\r>]*)" },
-	/* X-List: gnome-hackers */
-	/* X-List: gnome-hackers gnome org */
-	{ "X-List", "[ \t]*([^ ]+)@?([^ \n\t\r>]*)" },	
-	/* Sender: owner-gnome-hackers gnome org */
-	/* Sender: owner-gnome-hacekrs */
-	{ "Sender", "[ \t]*owner-([^ ]+)@?([^ @\n\t\r>]*)" },
-	/* Sender: gnome-hackers-owner gnome org */
-	/* Sender: gnome-hackers-owner */
-	{ "Sender", "[ \t]*([^ ]+)-owner ?([^ @\n\t\r>]*)" },
-	/* Delivered-To: mailing list gnome-hackers gnome org */
-	/* Delivered-To: mailing list gnome-hackers */
-	{ "Delivered-To", "[ \t]*mailing list ([^ ]+)@?([^ \n\t\r>]*)" },
-	/* Sender: owner-gnome-hackers gnome org */
-	/* Sender: <owner-gnome-hackers gnome org> */
-	/* Sender: owner-gnome-hackers */
-	/* Sender: <owner-gnome-hackers> */
-	{ "Return-Path", "[ \t]*<?owner-([^@>]+)@?([^ \n\t\r>]*)" },
-	/* X-BeenThere: gnome-hackers gnome org */
-	/* X-BeenThere: gnome-hackers */
-	{ "X-BeenThere", "[ \t]*([^ ]+)@?([^ \n\t\r>]*)" },
-	/* List-Unsubscribe:  <mailto:gnome-hackers-unsubscribe gnome org> */
-	{ "List-Unsubscribe", "<mailto:(.+)-unsubscribe@([^ \n\t\r>]*)" },
-};
-
-static pthread_once_t mailing_list_init_once = PTHREAD_ONCE_INIT;
-
-static void
-mailing_list_init(void)
-{
-	int i, errcode, failed=0;
-
-	/* precompile regex's for speed at runtime */
-	for (i = 0; i < G_N_ELEMENTS (mail_list_magic); i++) {
-		errcode = regcomp(&mail_list_magic[i].regex, mail_list_magic[i].pattern, REG_EXTENDED|REG_ICASE);
-		if (errcode != 0) {
-			char *errstr;
-			size_t len;
-		
-			len = regerror(errcode, &mail_list_magic[i].regex, NULL, 0);
-			errstr = g_malloc0(len + 1);
-			regerror(errcode, &mail_list_magic[i].regex, errstr, len);
-		
-			g_warning("Internal error, compiling regex failed: %s: %s", mail_list_magic[i].pattern, errstr);
-			g_free(errstr);
-			failed++;
-		}
-	}
-
-	g_assert(failed == 0);
-}
 
 char *
 camel_header_raw_check_mailing_list(struct _camel_header_raw **list)
 {
-	const char *v;
-	regmatch_t match[3];
-	int i, j;
-
-	pthread_once(&mailing_list_init_once, mailing_list_init);
-
-	for (i = 0; i < sizeof (mail_list_magic) / sizeof (mail_list_magic[0]); i++) {
-		v = camel_header_raw_find (list, mail_list_magic[i].name, NULL);
-		for (j=0;j<3;j++) {
-			match[j].rm_so = -1;
-			match[j].rm_eo = -1;
-		}
-		if (v != NULL && regexec (&mail_list_magic[i].regex, v, 3, match, 0) == 0 && match[1].rm_so != -1) {
-			int len1, len2;
-			char *mlist;
-			
-			len1 = match[1].rm_eo - match[1].rm_so;
-			len2 = match[2].rm_eo - match[2].rm_so;
-			
-			mlist = g_malloc (len1 + len2 + 2);
-			memcpy (mlist, v + match[1].rm_so, len1);
-			if (len2) {
-				mlist[len1] = '@';
-				memcpy (mlist + len1 + 1, v + match[2].rm_so, len2);
-				mlist[len1 + len2 + 1] = '\0';
-			} else {
-				mlist[len1] = '\0';
-			}
-			
-			return mlist;
-		}
-	}
-
+	/* Disabled for it writes crap to my summary files */
 	return NULL;
 }
 


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