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 731720 - Junk test logic has useless ordering
Junk test logic has useless ordering
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: Mailer
3.12.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2014-06-16 12:59 UTC by Michael Ekstrand
Modified: 2014-06-17 15:44 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael Ekstrand 2014-06-16 12:59:51 UTC
The current junk testing filter code (junk_test in camel-filter-search.c) has the following logic:

1. Is a junk filter configured? If not, return false.
2. Does message have junk or not-junk flag? If so, return it.
3. Does message have junk header?
4. Is sender in address book?
5. How does junk filter classify?

This has at least two significant problems.  First, the junk logic is entirely disabled if there is no plugin.  However, the header and address book tests are still useful without a plugin, and one probably doesn't want a local SpamAssassin if the mail server is pre-processing through SpamAssassin.  Second, the address book checks do not preempt the junk header checks.  Again, when using server-side SpamAssassin, it is useful to override a spam filter false positive with the local address book.

Therefore, this logic should be reordered in my opinion:

1. Does message have junk flag?
2. Is sender in address book?
3. Does message have junk header?
4. Is there a junk filter, and if so, what does it say?
Comment 1 Michael Ekstrand 2014-06-16 13:03:10 UTC
This has been discussed further on the mailing list: https://mail.gnome.org/archives/evolution-hackers/2013-November/msg00016.html
Comment 2 Milan Crha 2014-06-17 15:44:09 UTC
Thanks for a bug report. The reason to have addressbook lookups after header tests was due to speed. the lookups can be very slow with remove books, but let's see how will others feel about this. I otherwise agree with the change too, thus the changes I made are:

a) test for 3rd-party junk test software only at the end, when it's needed,
   thus it doesn't block junk filtering based on the headers or addressbook
   lookup
b) when Junk flag is set, the filter returns TRUE, aka "it is a junk" (it
   used to return FALSE)
c) do addressbook lookups before header checks
d) when header check from message info fails repeat the check with headers
   from message itself
e) always debug-report result of the junk test

Created commit b93ab71 in eds master (3.13.3+) [1]
Created commit 3c4f149 in eds evolution-data-server-3-12 (3.12.4+)

[1] https://git.gnome.org/browse/evolution-data-server/commit/?id=b93ab71