[cvs] bogofilter bogofilter.xml,1.11,1.12

David Relson relson at osagesoftware.com
Sun Oct 6 04:02:54 CEST 2002


Matthias,

I seem to remember that spamassassin does some interesting things regarding 
return codes.  Normally, it produces a return code of 0.  It also has a 
'-e' switch for returning 0 or 1 depending on spam status.

While working with procmail yesterday, it seemed that bogofilter needed to 
work the same way.  Consequently, I added a '-e' option to my test version.

My '-e' test version returns 0 when '-e is not used.  When '-e' is used, it 
returns 0 to indicate spam and 1 to indicate non-spam (which are 
bogofilter's current return codes).

After getting my procmail recipe working (with the '-e'), I tried the 
recipe without the '-e'.  It still worked.  At this point, I'm not sure 
what the heck is going on...

Fer sure, I can release my '-e' code.  At the moment, I don't know if it's 
needed or not.

David


At 09:20 PM 10/5/02, Matthias Andree wrote:
>On Fri, 04 Oct 2002, relson at users.sourceforge.net wrote:
>
> > ! <programlisting class="procmail">
> > !    :0fw
> > !    | bogofilter -u -p
> > !
> > !    :0:
> > !    * ^X-Spam-Status: Yes
> > !    spam-bogofilter
> > !
> > ! </programlisting>
>
>Look at this:
>
>$ ./bogofilter -p </dev/null ; echo $?
>X-Spam-Status: No, tests=bogofilter, spamicity=0.500000
>
>1
>
>This does not look right to me:
>
>Bogofilter sees "no spam" and exits 1.
>
>Procmail thinks the mail was NOT filtered and takes the original mail,
>without the additional header. Is this what we want? I don't think so.
>
>I believe we should twist exit codes of 1 to 0 in -p (passthrough) mode,
>to the effect that -p will always exit 0 (regardless of spam or nonspam)
>or 2 (failure). The information "isspam" is in the output.
>
>Any objections? Otherwise, this patch is ready for commit:
>
>Index: main.c
>===================================================================
>RCS file: /cvsroot/bogofilter/bogofilter/main.c,v
>retrieving revision 1.24
>diff -u -r1.24 main.c
>--- main.c      6 Oct 2002 00:27:25 -0000       1.24
>+++ main.c      6 Oct 2002 01:18:20 -0000
>@@ -266,6 +266,8 @@
>
>      close_lists();
>
>+    if (passthrough && exitcode == 1)
>+       exitcode = 0;
>      exit(exitcode);
>  }
>



More information about the bogofilter-dev mailing list