Package: spambayes
Version: 1.1b1-1
Severity: normal
Tags: patch
Dear Maintainer,
While trying to set up the XML-RPC scoring functionality, I'm running into the
problem that the Dibbler.py file in the package is incompatible with the
asyncore and asynchat changes in Python 2.6 and 2.7. I'm running into this
problem both on Wheezy and on Jessie.
Upstream has corrected this problem on February 25, 2011 in this commit:
https://sourceforge.net/p/spambayes/code/3271/
The steps to reproduce:
------
$ mkdir spambayes-config
$ cd spambayes-config
$ /usr/bin/core_server -P XMLRPCPlugin
SpamBayes Core Proxy Version 1.1b1 (February, 25, 2011)
User interface url is http://localhost:8880/
-------
Now try to access the URL mentioned while monitoring the system in 'top'. The
server doesn't send a response, but shows a high cpu % in top forever.
The attached patch is another solution; it doesn't duplicate the asyncore and
asynchat modules, but instead removes the code that's incompatible with the
post-2.6 python asyncore and asynchat module versions.
Regards,
Erik.
-- System Information:
Debian Release: 8.0
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.16.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages spambayes depends on:
ii python 2.7.9-1
ii python-dns 2.3.6-3
ii python-lockfile 1:0.8-2
spambayes recommends no packages.
spambayes suggests no packages.
-- no debconf information
diff -r 8304b0e30c9e -r 7c0f0474beaf spambayes/spambayes/Dibbler.py
--- a/spambayes/spambayes/Dibbler.py Wed Feb 06 09:59:27 2013 -0600
+++ b/spambayes/spambayes/Dibbler.py Sun May 17 06:19:39 2015 +0000
@@ -185,46 +185,6 @@
from spambayes.port import md5
from spambayes import asyncore, asynchat
-class BrighterAsyncChat(asynchat.async_chat):
- """An asynchat.async_chat that doesn't give spurious warnings on
- receiving an incoming connection, lets SystemExit cause an exit, can
- flush its output, and will correctly remove itself from a non-default
- socket map on `close()`."""
-
- def __init__(self, conn=None, map=None):
- """See `asynchat.async_chat`."""
- asynchat.async_chat.__init__(self, conn)
- self.__map = map
- self._closed = False
-
- def handle_connect(self):
- """Suppresses the asyncore "unhandled connect event" warning."""
- pass
-
- def handle_error(self):
- """Let SystemExit cause an exit."""
- type, v, t = sys.exc_info()
- if type == SystemExit:
- raise
- else:
- asynchat.async_chat.handle_error(self)
-
- def flush(self):
- """Flush everything in the output buffer."""
- # We check self._closed here because of the case where
- # self.initiate_send() raises an exception, causing self.close()
- # to be called. If we didn't check, we could end up in an infinite
- # loop.
- while (self.producer_fifo or self.ac_out_buffer) and not self._closed:
- self.initiate_send()
-
- def close(self):
- """Remove this object from the correct socket map."""
- self._closed = True
- self.del_channel(self.__map)
- self.socket.close()
-
-
class Context:
"""See the main documentation for details of `Dibbler.Context`."""
def __init__(self, asyncMap=asyncore.socket_map):
@@ -355,7 +315,7 @@
return "You must log in."
-class _HTTPHandler(BrighterAsyncChat):
+class _HTTPHandler(asynchat.async_chat):
"""This is a helper for the HTTP server class - one of these is created
for each incoming request, and does the job of decoding the HTTP traffic
and driving the plugins."""
@@ -367,8 +327,7 @@
def __init__(self, clientSocket, server, context):
# Grumble: asynchat.__init__ doesn't take a 'map' argument,
# hence the two-stage construction.
- BrighterAsyncChat.__init__(self, map=context._map)
- BrighterAsyncChat.set_socket(self, clientSocket, context._map)
+ asynchat.async_chat.__init__(self, clientSocket, context._map)
self._context = context
self._server = server
self._request = ''