[cvs] bogofilter bogofilter.xml,1.11,1.12

Matthias Andree matthias.andree at gmx.de
Sun Oct 6 03:20:36 CEST 2002


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