From c41e4b76cdf91030b229906bc25d19f463adae89 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 23 Nov 2020 21:43:13 +0100 Subject: [PATCH] add python 3.9 support and remove an old patch --- debian/patches/python-3.9.patch | 74 ++++++++++++++++++++++++++++ debian/patches/roundcude-update.diff | 11 ----- debian/patches/series | 2 +- 3 files changed, 75 insertions(+), 12 deletions(-) create mode 100644 debian/patches/python-3.9.patch delete mode 100644 debian/patches/roundcude-update.diff diff --git a/debian/patches/python-3.9.patch b/debian/patches/python-3.9.patch new file mode 100644 index 00000000..1535abed --- /dev/null +++ b/debian/patches/python-3.9.patch @@ -0,0 +1,74 @@ +Index: fail2ban/fail2ban/server/jailthread.py +=================================================================== +--- fail2ban.orig/fail2ban/server/jailthread.py ++++ fail2ban/fail2ban/server/jailthread.py +@@ -120,3 +120,6 @@ class JailThread(Thread): + ## python 2.x replace binding of private __bootstrap method: + if sys.version_info < (3,): # pragma: 3.x no cover + JailThread._Thread__bootstrap = JailThread._JailThread__bootstrap ++## python 3.9, restore isAlive method: ++elif not hasattr(JailThread, 'isAlive'): # pragma: 2.x no cover ++ JailThread.isAlive = JailThread.is_alive +Index: fail2ban/fail2ban/tests/sockettestcase.py +=================================================================== +--- fail2ban.orig/fail2ban/tests/sockettestcase.py ++++ fail2ban/fail2ban/tests/sockettestcase.py +@@ -83,11 +83,11 @@ class Socket(LogCaptureTestCase): + serverThread.start() + self.assertTrue(Utils.wait_for(self.server.isActive, unittest.F2B.maxWaitTime(10))) + return serverThread +- ++ + def _stopServerThread(self): + serverThread = self.serverThread + # wait for end of thread : +- Utils.wait_for(lambda: not serverThread.isAlive() ++ Utils.wait_for(lambda: not serverThread.is_alive() + or serverThread.join(Utils.DEFAULT_SLEEP_TIME), unittest.F2B.maxWaitTime(10)) + self.serverThread = None + +@@ -98,7 +98,7 @@ class Socket(LogCaptureTestCase): + self.server.close() + # wait for end of thread : + self._stopServerThread() +- self.assertFalse(serverThread.isAlive()) ++ self.assertFalse(serverThread.is_alive()) + # clean : + self.server.stop() + self.assertFalse(self.server.isActive()) +@@ -139,7 +139,7 @@ class Socket(LogCaptureTestCase): + self.server.stop() + # wait for end of thread : + self._stopServerThread() +- self.assertFalse(serverThread.isAlive()) ++ self.assertFalse(serverThread.is_alive()) + self.assertFalse(self.server.isActive()) + self.assertFalse(os.path.exists(self.sock_name)) + +@@ -149,7 +149,7 @@ class Socket(LogCaptureTestCase): + client = Utils.wait_for(self._serverSocket, 2) + # unexpected stop during message body: + testMessage = ["A", "test", "message", [protocol.CSPROTO.END]] +- ++ + org_handler = RequestHandler.found_terminator + try: + RequestHandler.found_terminator = lambda self: self.close() +@@ -180,7 +180,7 @@ class Socket(LogCaptureTestCase): + self.server.stop() + # wait for end of thread : + self._stopServerThread() +- self.assertFalse(serverThread.isAlive()) ++ self.assertFalse(serverThread.is_alive()) + + def testLoopErrors(self): + # replace poll handler to produce error in loop-cycle: +@@ -216,7 +216,7 @@ class Socket(LogCaptureTestCase): + self.server.stop() + # wait for end of thread : + self._stopServerThread() +- self.assertFalse(serverThread.isAlive()) ++ self.assertFalse(serverThread.is_alive()) + self.assertFalse(self.server.isActive()) + self.assertFalse(os.path.exists(self.sock_name)) + diff --git a/debian/patches/roundcude-update.diff b/debian/patches/roundcude-update.diff deleted file mode 100644 index 3304d0bc..00000000 --- a/debian/patches/roundcude-update.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- fail2ban-0.11.1.orig/config/filter.d/roundcube-auth.conf -+++ fail2ban-0.11.1/config/filter.d/roundcube-auth.conf -@@ -18,7 +18,7 @@ prefregex = ^\s*(\[\])?(%(__hostname)s\s - failregex = ^(?:FAILED login|Login failed) for .* from (?:(?:\([^\)]*\))?\. (?:(?! from ).)*(?: user=(?P=user))? in \S+\.php on line \d+ \(\S+ \S+\))?$ - ^(?:<[\w]+> )?Failed login for .* from in session \w+( \(error: \d\))?$ - --ignoreregex = -+ignoreregex = Could not connect to .* Connection refused - - journalmatch = SYSLOG_IDENTIFIER=roundcube - diff --git a/debian/patches/series b/debian/patches/series index 4fbf4140..6fb515d1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -5,4 +5,4 @@ deb_manpages_reportbug deb_no_iptables_service python3-test-suite.diff no-python-user.diff -roundcude-update.diff +python-3.9.patch