From c9600326f0235948698dbde43df5d2e45abf6973 Mon Sep 17 00:00:00 2001 From: wk333 <13474090681@163.com> Date: Sun, 26 Jan 2025 16:56:54 +0800 Subject: [PATCH] Fix build error for python-dkimpy,python3,python-falcon upgrade --- ...in-lmtp-runner-and-return-451-status.patch | 49 ++++++++++++++++++ ...c_sign-test-to-work-with-dkimpy-both.patch | 50 +++++++++++++++++++ fix-falcon-4.0.2-upgrade.patch | 30 +++++++++++ fix-testcase-to-check-address-in-string.patch | 36 +++++++++++++ mailman.spec | 13 ++++- 5 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 Catch-a-database-exception-in-lmtp-runner-and-return-451-status.patch create mode 100644 Modify-arc_sign-test-to-work-with-dkimpy-both.patch create mode 100644 fix-falcon-4.0.2-upgrade.patch create mode 100644 fix-testcase-to-check-address-in-string.patch diff --git a/Catch-a-database-exception-in-lmtp-runner-and-return-451-status.patch b/Catch-a-database-exception-in-lmtp-runner-and-return-451-status.patch new file mode 100644 index 0000000..77157b4 --- /dev/null +++ b/Catch-a-database-exception-in-lmtp-runner-and-return-451-status.patch @@ -0,0 +1,49 @@ +From 4e17b9a8d46b58c1214b34604cf286b82ce092a3 Mon Sep 17 00:00:00 2001 +From: Mark Sapiro +Date: Thu, 9 May 2024 23:11:22 -0700 +Subject: [PATCH] Catch a database exception in lmtp runner and return 451 + status. + +Also, make a minor change in the test data for +mailman.email.tests.test_message.test_as_string_python_bug_32330 +so the test passes for older versions and for Python 3.11.9+ and +3.12.3+ where the bug is fixed. +--- + src/mailman/docs/NEWS.rst | 2 ++ + src/mailman/email/tests/data/bad_email_2.eml | 2 +- + src/mailman/runners/lmtp.py | 6 +++++- + 3 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/mailman/email/tests/data/bad_email_2.eml b/src/mailman/email/tests/data/bad_email_2.eml +index a5f4b1a0aa..8430582cf1 100644 +--- a/src/mailman/email/tests/data/bad_email_2.eml ++++ b/src/mailman/email/tests/data/bad_email_2.eml +@@ -1,7 +1,7 @@ + To: + Subject: Defective email + From: user@example.com +-Content-Type: text/plain; charset=us-ascii ++Content-Type: text/plain; charset="us-ascii" + Content-Transfer-Encoding: 8bit + Message-Id: <20160614102505.9OFQ19L1C> + +diff --git a/src/mailman/runners/lmtp.py b/src/mailman/runners/lmtp.py +index 804c79a141..18acc80a6c 100644 +--- a/src/mailman/runners/lmtp.py ++++ b/src/mailman/runners/lmtp.py +@@ -134,7 +134,11 @@ class LMTPHandler: + + @transactional + def _handle_RCPT(self, server, session, envelope, to, rcpt_options): +- listnames = set(getUtility(IListManager).names) ++ try: ++ listnames = set(getUtility(IListManager).names) ++ except Exception as e: ++ slog.exception(f"Can't get list names: {e}") ++ return ERR_451 + try: + to = parseaddr(to)[1].lower() + local, subaddress, domain = split_recipient(to) +-- +GitLab + diff --git a/Modify-arc_sign-test-to-work-with-dkimpy-both.patch b/Modify-arc_sign-test-to-work-with-dkimpy-both.patch new file mode 100644 index 0000000..8085a3c --- /dev/null +++ b/Modify-arc_sign-test-to-work-with-dkimpy-both.patch @@ -0,0 +1,50 @@ +From a29ad3e5866c35add2e94015e50e2d81d9fed779 Mon Sep 17 00:00:00 2001 +From: Mark Sapiro +Date: Mon, 24 Jun 2024 13:48:23 -0700 +Subject: [PATCH] Modify arc_sign test to work with dkimpy both < and >= 1.1.7. + +--- + src/mailman/handlers/tests/test_arc_sign.py | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/src/mailman/handlers/tests/test_arc_sign.py b/src/mailman/handlers/tests/test_arc_sign.py +index 9dd769a9a3..1fc428c7bd 100644 +--- a/src/mailman/handlers/tests/test_arc_sign.py ++++ b/src/mailman/handlers/tests/test_arc_sign.py +@@ -81,7 +81,7 @@ uEzxBDAr518Z8VFbR41in3W4Y3yCDgQlLlcETrS+zYcL + + msg = """Authentication-Results: lists.example.org; arc=none; + spf=pass smtp.mfrom=jqd@d1.example; +- dkim=pass (1024-bit key) header.i=@d1.example; dmarc=pass ++ dkim=pass header.i=@d1.example; dmarc=pass + MIME-Version: 1.0 + Return-Path: + Received: by 10.157.14.6 with HTTP; Tue, 3 Jan 2017 12:22:54 -0800 (PST) +@@ -100,7 +100,7 @@ This is a test message. + ARCSign().process(lst, msg, msgdata) + + res = ["i=1;lists.example.org;arc=none;spf=passsmtp.mfrom=jqd@d1" +- ".example;dkim=pass(1024-bitkey)header.i=@d1.example;dmar" ++ ".example;dkim=passheader.i=@d1.example;dmar" + "c=pass"] + self.assertEqual("".join(msg["ARC-Authentication-Results"].split()), + "".join(res)) +@@ -117,10 +117,11 @@ i=1; s=dummy; t=12345""" + expected = set(expected) + self.assertEqual(sig, expected) + +- seal = "".join(["a=rsa-sha256;b=Pg8Yyk1AgYy2l+kb6iy+mY106AXm5EdgDwJ" +- "hLP7+XyT6yaS38ZUho+bmgSDorV+LyARH4A967A/oWMX3coyC7" +- "pAGyI+hA3+JifL7P3/aIVP4ooRJ/WUgT79snPuulxE15jg6FgQ" +- "E68ObA1/hy77BxdbD9EQxFGNcr/wCKQoeKJ8=; cv=none; d=" ++ seal = "".join(["a=rsa-sha256;b=OI+GmgigM5/fJ8u+yoYCoT70X" ++ "a433kSYLvhZWtx4HdLnLB2wvKy9zX7KHFVOhfhZ6" ++ "gWtsfMAufWx0rw+xgZNseDnejbz++2pPfj+jKUg+" ++ "JF7VC15IbpPUloISLKjfiK1cxC+u7s9NLu1wI4QV" ++ "sAT/M6RQ42MauUR/dBSdQdSMho=; cv=none; d=" + "example.org; i=1; s=dummy; t=12345"]) + seal = set("".join(seal.split()).split(";")) + expected = set("".join(msg["ARC-Seal"].split()).split(";")) +-- +GitLab + diff --git a/fix-falcon-4.0.2-upgrade.patch b/fix-falcon-4.0.2-upgrade.patch new file mode 100644 index 0000000..4b9af74 --- /dev/null +++ b/fix-falcon-4.0.2-upgrade.patch @@ -0,0 +1,30 @@ +From 8ebfbb5c067753d93de4c77066c5a4610fea3172 Mon Sep 17 00:00:00 2001 +From: Vytautas Liuolia +Date: Sun, 22 Sep 2024 15:43:45 +0200 +Subject: [PATCH] fix(REST): only pass keyword arguments to + falcon.HTTPUnauthorized(...) + +The use of positional arguments is deprecated for optional initializer +parameters of `falcon.HTTPError` and its subclasses since Falcon 3.0. +--- + src/mailman/rest/wsgiapp.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/mailman/rest/wsgiapp.py b/src/mailman/rest/wsgiapp.py +index 456d28e4fe..7ccb356367 100644 +--- a/src/mailman/rest/wsgiapp.py ++++ b/src/mailman/rest/wsgiapp.py +@@ -63,8 +63,8 @@ class Middleware: + # Not authorized. + realm = 'Basic realm="{}",charset="{}"'.format(REALM, UTF8) + raise HTTPUnauthorized( +- '401 Unauthorized', +- 'REST API authorization failed', ++ title='401 Unauthorized', ++ description='REST API authorization failed', + challenges=[realm]) + + +-- +GitLab + diff --git a/fix-testcase-to-check-address-in-string.patch b/fix-testcase-to-check-address-in-string.patch new file mode 100644 index 0000000..aa7de3c --- /dev/null +++ b/fix-testcase-to-check-address-in-string.patch @@ -0,0 +1,36 @@ +From d455726de8221ee442ce7f5eeb2d331371cb7749 Mon Sep 17 00:00:00 2001 +From: Abhilash Raj <262-maxking@users.noreply.gitlab.com> +Date: Sun, 15 Sep 2024 08:07:47 +0000 +Subject: [PATCH] Prepare for the next release. + +* fix testcase to check address in string. + +msg.get('cc') returns a Header instance instead of string, which +causes the test case to fail. This updates the test case to compare +with the string representation of the header object. + +* Prepare for the next release. +--- + pyproject.toml | 12 ++++++++++++ + src/mailman/docs/NEWS.rst | 2 +- + src/mailman/handlers/tests/test_avoid_duplicates.py | 4 ++-- + 3 files changed, 15 insertions(+), 3 deletions(-) + +diff --git a/src/mailman/handlers/tests/test_avoid_duplicates.py b/src/mailman/handlers/tests/test_avoid_duplicates.py +index 75886bfc9e..761bdb848f 100644 +--- a/src/mailman/handlers/tests/test_avoid_duplicates.py ++++ b/src/mailman/handlers/tests/test_avoid_duplicates.py +@@ -161,8 +161,8 @@ More things to say. + # Don't test the whole message. The order in the Cc: varies with + # Python version. + ccs = msg.get('cc') +- self.assertIn('"last, first" ', ccs) +- self.assertIn('"real name (dept)" ', ccs) ++ self.assertIn('"last, first" ', str(ccs)) ++ self.assertIn('"real name (dept)" ', str(ccs)) + del msg['cc'] + self.assertMultiLineEqual(msg.as_string(), """\ + From: anne@example.com +-- +GitLab + diff --git a/mailman.spec b/mailman.spec index 47c80a7..7294b35 100644 --- a/mailman.spec +++ b/mailman.spec @@ -7,7 +7,7 @@ Name: mailman Version: 3.3.9 -Release: 1 +Release: 2 Epoch: 3 Summary: The GNU mailing list manager License: GPLv3 @@ -19,6 +19,14 @@ Source3: mailman3.service Source4: mailman3.logrotate Source5: mailman3-digests.service Source6: mailman3-digests.timer +# https://gitlab.com/mailman/mailman/-/merge_requests/1259 +Patch0: fix-testcase-to-check-address-in-string.patch +# https://gitlab.com/mailman/mailman/-/merge_requests/1228 +Patch1: Modify-arc_sign-test-to-work-with-dkimpy-both.patch +# https://gitlab.com/mailman/mailman/-/merge_requests/1207 +Patch2: Catch-a-database-exception-in-lmtp-runner-and-return-451-status.patch +# https://gitlab.com/mailman/mailman/-/merge_requests/1267 +Patch3: fix-falcon-4.0.2-upgrade.patch BuildArch: noarch BuildRequires: glibc-langpack-en BuildRequires: python%{python3_pkgversion}-devel >= 3.5 python%{python3_pkgversion}-setuptools @@ -203,6 +211,9 @@ done %{_datadir}/selinux/*/mailman3.pp %changelog +* Sun Jan 26 2025 wangkai <13474090681@163.com> - 3:3.3.9-2 +- Fix build error for python-dkimpy,python3,python-falcon upgrade + * Tue Jul 09 2024 yaoxin - 3:3.3.9-1 - Update to 3.3.9 * Python 3.9 is now the minimum supported version of Python. -- Gitee