bogofilter -o option, and default cutoff

Matthias Andree matthias.andree at gmx.de
Thu Mar 27 01:52:16 CET 2003


Dave Lovelace <dave at firstcomp.biz> writes:

> Minor thing first: the bogofilter man page says that the default cutoff for
> identifying a message as spam is 0.54, whereas it appears to be about 0.95.
> I'm pretty sure this is just a case of the man page being out of date, but
> someone probably needs to fix it.  This caused some confusion here.

I haven't looked into this.

> Second: I went to investigate 3-valued output (the -3 option), which requires
> setting a non-zero ham cutoff (according to the man page).  I could not get
> the -o option to accept two values.  The man page indicates:
> 	-o value ,value
> If I tried something like    -o 0.3 ,0.6    (or any other variation with
> two separate parameters, with or without a comma) bogofilter gave the
> message "Extra arguments given, first: ,0.6. Aborting.".  If I tried omitting
> the space, enclosing the whole "0.3 ,0.6" in quotes (again, with or without
> comma) the message was something like
> "Cannot parse -o option argument '0.3 ,0.6'.", normally repeated twice;
> in this case however bogofilter apparently ran (but with no -o
> option).

There is a bug in bogofilter, this patch should fix it. It has been
committed to the CVS tree as well (revision 1.28):

Index: src/bogoconfig.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bogoconfig.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -u -r1.27 -r1.28
--- src/bogoconfig.c	25 Mar 2003 18:25:52 -0000	1.27
+++ src/bogoconfig.c	27 Mar 2003 00:48:39 -0000	1.28
@@ -1,4 +1,4 @@
-/* $Id: bogoconfig.c,v 1.27 2003/03/25 18:25:52 relson Exp $ */
+/* $Id: bogoconfig.c,v 1.28 2003/03/27 00:48:39 m-a Exp $ */
 
 /*****************************************************************************
 
@@ -525,15 +525,22 @@
 
 	case 'o':
 	{
-	    bool ok = xatof(&spam_cutoff, optarg);
-	    if (ok) {
-		char *del = strtok(optarg, ",");
-		if ((del = strtok(NULL, ",")))
-		    ok = xatof(&ham_cutoff, del);
+	    char *parse = xstrdup(optarg);
+	    char *sc, *hc;
+	    bool ok = true;
+	    if (parse[0] == ',') {
+		sc = NULL;
+		hc = &parse[1];
+	    } else {
+		sc = strtok(parse, ",");
+		hc = strtok(NULL, "");
 	    }
+	    if (sc) ok = ok && xatof(&spam_cutoff, sc);
+	    if (hc) ok = ok && xatof(&ham_cutoff, hc);
 	    if (!ok) {
 		fprintf(stderr, "Cannot parse -%c option argument '%s'.\n", option, optarg);
 	    }
+	    xfree(parse);
 	    break;
 	}
 
-- 
Matthias Andree




More information about the Bogofilter mailing list