1 |
commit: d173a3f19dec579437be5f5dd139339c22404a8e |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jun 1 07:20:25 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jun 1 07:25:35 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d173a3f1 |
7 |
|
8 |
dev-python/dbus-next: fix test crash w/ Python 3.11 |
9 |
|
10 |
Not yet adding Python 3.11 support though as I get another failure. |
11 |
|
12 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
13 |
|
14 |
dev-python/dbus-next/dbus-next-0.2.3-r1.ebuild | 46 ++++++++++++++++++++++ |
15 |
.../files/dbus-next-0.2.3-glib-crash.patch | 33 ++++++++++++++++ |
16 |
2 files changed, 79 insertions(+) |
17 |
|
18 |
diff --git a/dev-python/dbus-next/dbus-next-0.2.3-r1.ebuild b/dev-python/dbus-next/dbus-next-0.2.3-r1.ebuild |
19 |
new file mode 100644 |
20 |
index 000000000000..7826aedf1dc8 |
21 |
--- /dev/null |
22 |
+++ b/dev-python/dbus-next/dbus-next-0.2.3-r1.ebuild |
23 |
@@ -0,0 +1,46 @@ |
24 |
+# Copyright 1999-2022 Gentoo Authors |
25 |
+# Distributed under the terms of the GNU General Public License v2 |
26 |
+ |
27 |
+EAPI=8 |
28 |
+ |
29 |
+DISTUTILS_USE_PEP517=setuptools |
30 |
+PYTHON_COMPAT=( python3_{8..10} ) |
31 |
+inherit distutils-r1 virtualx |
32 |
+ |
33 |
+DESCRIPTION="The next great DBus library for Python with asyncio support" |
34 |
+HOMEPAGE="https://python-dbus-next.readthedocs.io/en/latest/" |
35 |
+SRC_URI="https://github.com/altdesktop/python-dbus-next/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" |
36 |
+S="${WORKDIR}"/python-${P} |
37 |
+ |
38 |
+LICENSE="MIT" |
39 |
+SLOT="0" |
40 |
+KEYWORDS="~amd64" |
41 |
+ |
42 |
+BDEPEND="test? ( |
43 |
+ dev-python/pygobject[${PYTHON_USEDEP}] |
44 |
+ dev-python/pytest-asyncio[${PYTHON_USEDEP}] |
45 |
+ dev-python/pytest-timeout[${PYTHON_USEDEP}] |
46 |
+ )" |
47 |
+ |
48 |
+PATCHES=( |
49 |
+ "${FILESDIR}"/${PN}-0.2.3-glib-crash.patch |
50 |
+) |
51 |
+ |
52 |
+EPYTEST_IGNORE=( |
53 |
+ # "interface not found on this object: org.freedesktop.DBus.Debug.Stats" |
54 |
+ # Seems like we build dbus w/o this? |
55 |
+ test/client/test_signals.py |
56 |
+) |
57 |
+ |
58 |
+distutils_enable_tests pytest |
59 |
+ |
60 |
+src_test() { |
61 |
+ local dbus_params=( |
62 |
+ $(dbus-daemon --session --print-address --fork --print-pid) |
63 |
+ ) |
64 |
+ local -x DBUS_SESSION_BUS_ADDRESS=${dbus_params[0]} |
65 |
+ |
66 |
+ virtx distutils-r1_src_test |
67 |
+ |
68 |
+ kill "${dbus_params[1]}" || die |
69 |
+} |
70 |
|
71 |
diff --git a/dev-python/dbus-next/files/dbus-next-0.2.3-glib-crash.patch b/dev-python/dbus-next/files/dbus-next-0.2.3-glib-crash.patch |
72 |
new file mode 100644 |
73 |
index 000000000000..714d733f3689 |
74 |
--- /dev/null |
75 |
+++ b/dev-python/dbus-next/files/dbus-next-0.2.3-glib-crash.patch |
76 |
@@ -0,0 +1,33 @@ |
77 |
+https://github.com/altdesktop/python-dbus-next/pull/114 |
78 |
+https://github.com/altdesktop/python-dbus-next/issues/113 |
79 |
+https://gitlab.gnome.org/GNOME/pygobject/-/issues/525 |
80 |
+ |
81 |
+From 445bc2cd0df80e36154e45ea3c4f268b550890b5 Mon Sep 17 00:00:00 2001 |
82 |
+From: Peter Hutterer <peter.hutterer@×××××.net> |
83 |
+Date: Tue, 22 Mar 2022 22:11:01 +1000 |
84 |
+Subject: [PATCH] glib: destroy the _AuthLineSource explicitly |
85 |
+ |
86 |
+See https://gitlab.gnome.org/GNOME/pygobject/-/issues/525 for an |
87 |
+explanation, the summary is: we need to explicitly call source.destroy() |
88 |
+if dispatch returns GLib.SOURCE_REMOVE. |
89 |
+ |
90 |
+Deleting the source by resetting it to None causes invalid memory |
91 |
+accesses and eventual crashes. |
92 |
+ |
93 |
+This can be reproduced with a basic call to |
94 |
+ bus = dbus_next.glib.MessageBus(bus_type=dbus_next.BusType.SESSION).connect_sync() |
95 |
+and a GLib.MainLoop() after this call. Run in valgrind --tool=memcheck. |
96 |
+ |
97 |
+Fixes #113 |
98 |
+--- a/dbus_next/glib/message_bus.py |
99 |
++++ b/dbus_next/glib/message_bus.py |
100 |
+@@ -457,7 +457,7 @@ def line_notify(line): |
101 |
+ self._stream.write(Authenticator._format_line(resp)) |
102 |
+ self._stream.flush() |
103 |
+ if resp == 'BEGIN': |
104 |
+- self._readline_source = None |
105 |
++ self._readline_source.destroy() |
106 |
+ authenticate_notify(None) |
107 |
+ return True |
108 |
+ except Exception as e: |
109 |
+ |