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 273041 - No warning when spamassassin is not running
No warning when spamassassin is not running
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: general
2.4.x (obsolete)
Other All
: Normal normal
: ---
Assigned To: Milan Crha
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2005-02-25 19:06 UTC by Gustavo Rahal
Modified: 2008-04-29 13:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed evo patch (17.17 KB, patch)
2008-04-25 10:29 UTC, Milan Crha
committed Details | Review

Description Gustavo Rahal 2005-02-25 19:06:33 UTC
Distribution: Debian 3.1
Package: Evolution
Priority: Normal
Version: GNOME2.9.91 2.1
Gnome-Distributor: Ubuntu
Synopsis: No warning when spamassassin is not running
Bugzilla-Product: Evolution
Bugzilla-Component: Miscellaneous
Bugzilla-Version: 2.1
Description:
Description of Problem:
Evolution does not give a warning if spamassassin is not running. The
User things that junk filter just doesn't work (it happened with me).

Steps to reproduce the problem:
1. Uninstall or stop spamassassin
2. Open Evolution
3. No messages appear even when pressing the junk button


How often does this happen?
Always



Unknown reporter: gustavo@grahal.net, changed to bugbuddy-import@ximian.com.
Setting qa contact to the default for this product.
   This bug either had no qa contact or an invalid one.

Comment 1 Not Zed 2005-08-02 06:39:43 UTC
apparently it barely works anyway.  should probably disable the buttons if it
isn't available (if it was a proper plugin, this could be done)
Comment 2 André Klapper 2005-10-25 18:06:56 UTC
it is a plugin now and even when disabling it, the UI is still there.
adding jvivek@novell.com to the cc list since you've been working on the plugin.

reassigning old bugs to get rid of triage@ximian.com as assignee.
Comment 3 Matthew Barnes 2006-12-31 20:59:42 UTC
FYI - This was also reported against Fedora Core:
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=137229
Comment 4 Milan Crha 2008-04-25 10:29:42 UTC
Created attachment 109892 [details] [review]
proposed evo patch

for evolution;

This patch adds ability of error propagation from junk plugin to UI in hook target. (which means for report junk, report not-junk and check junk). It will show the error in the status bar, because it can be somehow intrusive when receiving many mails and checking will fail.
Comment 5 Matthew Barnes 2008-04-25 12:17:55 UTC
Better to use g_set_error() than g_error_new() because it handles the case where the 'error' pointer is NULL. (I know it won't be in this case, but that's the convention for GError.  See [1] for examples.)  Patch looks good to me otherwise.

[1] http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html
Comment 6 Milan Crha 2008-04-25 13:13:51 UTC
Slightly modified patch committed to trunk. Committed revision 35415.

I see I did a checking myself, so your suggestion will be better.
Comment 7 Reid Thompson 2008-04-29 12:17:04 UTC
Patch needs to be updated.

Patch posts error message if return status from bogofilter is not 0.  This results in false error messages.

bogofilter returns:
 0 for spam; 1 for non-spam; 2 for unsure ; 3 for I/O or other errors.


if (waitres >= 0 && WIFEXITED (status)) {
	res = WEXITSTATUS (status);
} else {
	res = BOGOFILTER_ERROR;
}

if (res != 0)
		g_set_error (error, EM_JUNK_ERROR, res, _("Pipe to Bogofilter failed, error code: %d."), res);

res == 0 | res == 1 | res == 2 are non-error responses.



Comment 8 Milan Crha 2008-04-29 12:45:36 UTC
Thanks Reid, I committed fix to trunk. Committed revision 35443.

I just wonder whether same applies to SpamAssassin too...
Comment 9 Reid Thompson 2008-04-29 13:53:46 UTC
it appears to be a bit different.  It looks like the code makes attempts to pass parameters to spamassassin to insure that the return response(s) are of the appropriate type being checked for.  

My guess based on a quick look is that things are OK -- the only way to be sure is to have someone who uses it setup the appropriate debug params and validate the output of the debug macro

#define d(x) (camel_debug("junk")?(x):0)

messages created.  It looks like output from invocations of the above is the only place that the response is noted

if (em_junk_sa_use_spamc && em_junk_sa_use_daemon) {
	out = g_byte_array_new ();
	argv[i++] = em_junk_sa_spamc_binary;
	argv[i++] = "-c";
	argv[i++] = "-t";
	argv[i++] = "60";
	if (!em_junk_sa_system_spamd_available) {
		argv[i++] = "-U";

		pthread_mutex_lock (&em_junk_sa_preferred_socket_path_lock);
		socket_i = i;
		argv[i++] = to_free = g_strdup (em_junk_sa_get_socket_path ());
		pthread_mutex_unlock (&em_junk_sa_preferred_socket_path_lock);
	}
} else {
	argv [i++] = "spamassassin";
	argv [i++] = "--exit-code";
	if (em_junk_sa_local_only)
		argv [i++] = "--local";
}

rv = pipe_to_sa_full (msg, NULL, argv, 0, 1, out, &target->error) != 0;

if (!rv && out && !strcmp ((const char *)out->data, "0/0\n")) {
	/* an error occurred */
	if (em_junk_sa_respawn_spamd ()) {
		g_byte_array_set_size (out, 0);

		pthread_mutex_lock (&em_junk_sa_preferred_socket_path_lock);
		g_free (to_free);
		argv [socket_i] = to_free = g_strdup (em_junk_sa_get_socket_path ());
		pthread_mutex_unlock (&em_junk_sa_preferred_socket_path_lock);

		rv = pipe_to_sa_full (msg, NULL, argv, 0, 1, out, &target->error) != 0;
	} else if (!em_junk_sa_use_spamc)
		/* in case respawning were too fast we fallback to spamassassin */
		rv = em_junk_sa_check_junk (ep, target);
}

d(fprintf (stderr, "em_junk_sa_check_junk rv = %d\n", rv));