GNOME Bugzilla – Bug 560420
Failed spamassassin pipe on Evolution
Last modified: 2008-12-03 21:52:25 UTC
Please describe the problem: The bug has been opened on https://bugs.launchpad.net/ubuntu/+source/evolution/+bug/275746 "I am using Evolution after an upgrade to Ubuntu 8.10. I have activated the spamfilter (spamassassin). My incoming mail is being filtered. However, each time a new message is downloaded, a warning message appears on the lower status bar. If I click on it, an error window pops up and says that the pipe to spamassassin failed (and exited with error code 5). The filter is applied. It works. It is only an annoyance..." Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information: Possible solution: http://launchpadlibrarian.net/19512159/fix-evolution-spamc-error.diff
Confirming. According to the man page [1], we need to be silencing exit codes 5 and 6 as they're not errors. -L learn type Send message to spamd for learning. The learn type can be either spam, ham or forget. The exitcode for spamc will be set to 5 if the message was learned, or 6 if it was already learned. [1] http://spamassassin.apache.org/full/3.1.x/doc/spamc.html
I have added a patch to the downstream ubuntu bug that fixes the problem. My description of the fix: I have looked into this bug, and I have found the following problem: plugins/sa-junk-plugin/em-junk-filter.c starts spamc through pipe_to_sa_full(). This function starts the various client programs and checks the exit status of the command that was run. This last part is the problem : on line 253 a check for the exit code of either spamc or spamassassin is done and an error is returned to evolution (which results in the popup). The interesting thing about this is that the rest of the plugin uses a non-zero exit status to denote spam, but the pipe_to_sa_full() funtion returns an error when the exit status is non-zero. So, every spam message gets processed as it should be, but pipe_to_sa_full() considers it an error. Spamassassin and spamc use error code '64' and above to denote abnormal program termination. pipe_to_sa_full() should thus check for return codes of >= 64 not >0. Attached you will find a patch that changes the error to only appear if the errorcode is >=64.
Created attachment 122655 [details] [review] spamc and spamassassin use error codes of 64 and above to denote execution errors, not non-null
Good catch, but I think there's a bit more to do. Non-zero return values from pipe_to_sa_full() are still being treated as errors in some places, and we return the exit code as is. It might be as simple as just returning zero if the exit code is < 64, but double check that that will be handled correctly in all places.
No, the functions that call pipe_to_sa_full() expect a non-zero exit code to denote spam. The 'best' fix would be to return -1 on error codes of >=64 and have all callers of pipe_to_sa_full() recognize it as a runtime error and ignore the results. pipe_to_sa_full() should just continue spewing error messages when the call fails I think.
*** Bug 561592 has been marked as a duplicate of this bug. ***
*** Bug 563085 has been marked as a duplicate of this bug. ***
Will the proposed solution make the SpamAssassin plugin correctly identify spam?
Yes, I run with these patches, and it works just fine :)
Committed to trunk (revision 36828) and gnome-2-24 (revision 36829).