PATCH [was: 0.9.1 errors]

David Relson relson at osagesoftware.com
Wed Dec 4 20:01:58 CET 2002


Greetings,

I have a simple fix for bogofilter's overly zealous complaints "must get 
only one message to calculate spamicity!". It's a simple enhancement for 
the "^From " pattern for detecting message starts.  The pattern used to 
just check the first 5 characters of the line;  now it checks those 
characters and ensures that the line ends with a digit (presumably from the 
year).

I'm publishing it here so y'all can give it a sanity check :-)

David


Index: lexer.l
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/lexer.l,v
retrieving revision 1.39
diff -u -r1.39 lexer.l
--- lexer.l	4 Dec 2002 17:09:31 -0000	1.39
+++ lexer.l	4 Dec 2002 18:53:18 -0000
@@ -228,7 +228,7 @@
  \<\!--	;
  -->	;

-^From\ 						{past_header = 0; return(FROM);}
+^From\ .*[0-9]$					{past_header = 0; return(FROM);}
  ^Date:.*|Delivery-Date:.*			;
  ^Message-ID:.*					;
  {BASE64}					;
Index: bogofilter.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/bogofilter.c,v
retrieving revision 1.92
diff -u -r1.92 bogofilter.c
--- bogofilter.c	4 Dec 2002 15:03:35 -0000	1.92
+++ bogofilter.c	4 Dec 2002 18:53:18 -0000
@@ -74,6 +74,11 @@
  	++msgcount;
      } while(cont);

+    if (msgcount > 1) {
+	fprintf(stderr, "%s: must get only one message to calculate 
spamicity!\n", progname);
+	exit(2);
+    }
+
      spamicity = method->compute_spamicity(wordhash, NULL);

      db_lock_release_list(word_lists);
--------------------------------------------------------
David Relson                   Osage Software Systems, Inc.
relson at osagesoftware.com       Ann Arbor, MI 48103
www.osagesoftware.com          tel:  734.821.8800





More information about the Bogofilter mailing list