After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 560420 - Failed spamassassin pipe on Evolution
Failed spamassassin pipe on Evolution
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Plugins
2.24.x (obsolete)
Other All
: Normal trivial
: ---
Assigned To: evolution-plugin-maintainers
Evolution QA team
: 561592 563085 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-11-12 00:35 UTC by Alexander Ovcharenko
Modified: 2008-12-03 21:52 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24


Attachments
spamc and spamassassin use error codes of 64 and above to denote execution errors, not non-null (408 bytes, patch)
2008-11-14 14:02 UTC, hp
committed Details | Review

Description Alexander Ovcharenko 2008-11-12 00:35:46 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
Comment 1 Matthew Barnes 2008-11-12 01:12:36 UTC
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
Comment 2 hp 2008-11-14 14:01:12 UTC
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.
Comment 3 hp 2008-11-14 14:02:09 UTC
Created attachment 122655 [details] [review]
spamc and spamassassin use error codes of 64 and above to denote execution errors, not non-null
Comment 4 Matthew Barnes 2008-11-14 15:59:12 UTC
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.
Comment 5 hp 2008-11-14 16:57:28 UTC
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.
Comment 6 Matthew Barnes 2008-11-19 21:28:23 UTC
*** Bug 561592 has been marked as a duplicate of this bug. ***
Comment 7 Matthew Barnes 2008-12-03 13:40:29 UTC
*** Bug 563085 has been marked as a duplicate of this bug. ***
Comment 8 Alexander Shopov 2008-12-03 20:37:05 UTC
Will the proposed solution make the SpamAssassin plugin correctly identify spam?
Comment 9 hp 2008-12-03 21:00:14 UTC
Yes, I run with these patches, and it works just fine :)
Comment 10 Matthew Barnes 2008-12-03 21:52:25 UTC
Committed to trunk (revision 36828) and gnome-2-24 (revision 36829).