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

Philip Van Hoof <[email protected]>
Newsgroups gmane.comp.gnome.evolution.devel
Message-ID <1152651115.21211.2.camel__16829.4252282523$1152717995$gmane$org@localhost.localdomain>
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

_______________________________________________
Evolution-hackers mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/evolution-hackers
camel_mime_utils_removes_the_mail_list_magic.diff (text/x-patch, 4.3 KB)
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:[email protected]> */
-	/* 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 [email protected]; contact [email protected] */
-	{ "Mailing-List", "[ \t]*list ([^@]+)@?([^ \n\t\r>;]*)" },
-	/* Originator: [email protected] */
-	{ "Originator", "[ \t]*([^@]+)@?([^ \n\t\r>]*)" },
-	/* X-Mailing-List: <[email protected]> arcive/latest/100 */
-	/* X-Mailing-List: [email protected] */
-	/* X-Mailing-List: gnome-hackers */
-	/* X-Mailing-List: <gnome-hackers> */
-	{ "X-Mailing-List", "[ \t]*<?([^@>]+)@?([^ \n\t\r>]*)" },
-	/* X-Loop: [email protected] */
-	{ "X-Loop", "[ \t]*([^@]+)@?([^ \n\t\r>]*)" },
-	/* X-List: gnome-hackers */
-	/* X-List: [email protected] */
-	{ "X-List", "[ \t]*([^@]+)@?([^ \n\t\r>]*)" },	
-	/* Sender: [email protected] */
-	/* Sender: owner-gnome-hacekrs */
-	{ "Sender", "[ \t]*owner-([^@]+)@?([^ @\n\t\r>]*)" },
-	/* Sender: [email protected] */
-	/* Sender: gnome-hackers-owner */
-	{ "Sender", "[ \t]*([^@]+)-owner@?([^ @\n\t\r>]*)" },
-	/* Delivered-To: mailing list [email protected] */
-	/* Delivered-To: mailing list gnome-hackers */
-	{ "Delivered-To", "[ \t]*mailing list ([^@]+)@?([^ \n\t\r>]*)" },
-	/* Sender: [email protected] */
-	/* Sender: <[email protected]> */
-	/* Sender: owner-gnome-hackers */
-	/* Sender: <owner-gnome-hackers> */
-	{ "Return-Path", "[ \t]*<?owner-([^@>]+)@?([^ \n\t\r>]*)" },
-	/* X-BeenThere: [email protected] */
-	/* X-BeenThere: gnome-hackers */
-	{ "X-BeenThere", "[ \t]*([^@]+)@?([^ \n\t\r>]*)" },
-	/* List-Unsubscribe:  <mailto:[email protected]> */
-	{ "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;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.