Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-libs/signond/, net-libs/signond/files/
Date: Fri, 05 Jun 2020 00:39:55
Message-Id: 1591317505.eb77bf011bd6d6a7c81fb6ed27d0bc23b7782c71.asturm@gentoo
1 commit: eb77bf011bd6d6a7c81fb6ed27d0bc23b7782c71
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 5 00:24:41 2020 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 5 00:38:25 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eb77bf01
7
8 net-libs/signond: Fix runtime crashes
9
10 Package-Manager: Portage-2.3.100, Repoman-2.3.22
11 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
12
13 net-libs/signond/files/signond-8.60-crashfix.patch | 160 +++++++++++++++++++++
14 net-libs/signond/signond-8.60-r2.ebuild | 76 ++++++++++
15 2 files changed, 236 insertions(+)
16
17 diff --git a/net-libs/signond/files/signond-8.60-crashfix.patch b/net-libs/signond/files/signond-8.60-crashfix.patch
18 new file mode 100644
19 index 00000000000..8cfc79ac431
20 --- /dev/null
21 +++ b/net-libs/signond/files/signond-8.60-crashfix.patch
22 @@ -0,0 +1,160 @@
23 +From ab9fab9763277783363f8c6d4b62405c3b0b0413 Mon Sep 17 00:00:00 2001
24 +From: Chris Adams <chris.adams@×××××××××××.com>
25 +Date: Wed, 31 Jul 2019 12:45:14 +1000
26 +Subject: [PATCH] Don't emit QObject::destroyed() within Identity::destroy()
27 +
28 +QObject::destroyed() should not be emitted manually, as that can
29 +cause unwanted side effects.
30 +
31 +Specifically, in this case, the
32 +QDBusConnectionPrivate::objectDestroyed() slot was invoked with
33 +invalidated object parameter (perhaps due to duplicate invocation)
34 +resulting in a warning in QObject::disconnect().
35 +
36 +Instead, ensure the object is unregistered from DBus immediately.
37 +---
38 + src/signond/signondaemonadaptor.cpp | 29 ++++++++++++++++++++++++++++-
39 + src/signond/signondaemonadaptor.h | 3 +++
40 + src/signond/signonidentity.cpp | 13 ++++++++-----
41 + src/signond/signonidentity.h | 1 +
42 + 4 files changed, 40 insertions(+), 6 deletions(-)
43 +
44 +diff --git a/src/signond/signondaemonadaptor.cpp b/src/signond/signondaemonadaptor.cpp
45 +index 8b35e4bd..abd8fd3a 100644
46 +--- a/src/signond/signondaemonadaptor.cpp
47 ++++ b/src/signond/signondaemonadaptor.cpp
48 +@@ -29,6 +29,13 @@
49 +
50 + namespace SignonDaemonNS {
51 +
52 ++struct RegisteredIdentity {
53 ++ RegisteredIdentity(const QDBusConnection &connection, QObject *identity)
54 ++ : conn(connection), ident(identity) {}
55 ++ QDBusConnection conn;
56 ++ QObject *ident = nullptr;
57 ++};
58 ++
59 + SignonDaemonAdaptor::SignonDaemonAdaptor(SignonDaemon *parent):
60 + QDBusAbstractAdaptor(parent),
61 + m_parent(parent)
62 +@@ -38,6 +45,7 @@ SignonDaemonAdaptor::SignonDaemonAdaptor(SignonDaemon *parent):
63 +
64 + SignonDaemonAdaptor::~SignonDaemonAdaptor()
65 + {
66 ++ qDeleteAll(m_registeredIdentities);
67 + }
68 +
69 + void SignonDaemonAdaptor::registerNewIdentity(const QString &applicationContext,
70 +@@ -46,7 +54,10 @@ void SignonDaemonAdaptor::registerNewIdentity(const QString &applicationContext,
71 + Q_UNUSED(applicationContext);
72 +
73 + QObject *identity = m_parent->registerNewIdentity();
74 +- objectPath = registerObject(parentDBusContext().connection(), identity);
75 ++ QDBusConnection dbusConnection(parentDBusContext().connection());
76 ++ objectPath = registerObject(dbusConnection, identity);
77 ++ m_registeredIdentities.append(new RegisteredIdentity(dbusConnection, identity));
78 ++ connect(identity, SIGNAL(unregistered()), this, SLOT(onIdentityUnregistered()));
79 +
80 + SignonDisposable::destroyUnused();
81 + }
82 +@@ -130,6 +141,22 @@ void SignonDaemonAdaptor::getIdentity(const quint32 id,
83 + SignonDisposable::destroyUnused();
84 + }
85 +
86 ++void SignonDaemonAdaptor::onIdentityUnregistered()
87 ++{
88 ++ QObject *ident = sender();
89 ++ if (!ident) {
90 ++ return;
91 ++ }
92 ++
93 ++ for (int i = 0; i < m_registeredIdentities.size(); ++i) {
94 ++ if (m_registeredIdentities[i]->ident == ident) {
95 ++ m_registeredIdentities[i]->conn.unregisterObject(ident->objectName());
96 ++ delete m_registeredIdentities.takeAt(i);
97 ++ return;
98 ++ }
99 ++ }
100 ++}
101 ++
102 + void SignonDaemonAdaptor::onIdentityAccessReplyFinished()
103 + {
104 + SignOn::AccessReply *reply = qobject_cast<SignOn::AccessReply*>(sender());
105 +diff --git a/src/signond/signondaemonadaptor.h b/src/signond/signondaemonadaptor.h
106 +index db8d875f..1c20cac3 100644
107 +--- a/src/signond/signondaemonadaptor.h
108 ++++ b/src/signond/signondaemonadaptor.h
109 +@@ -34,6 +34,7 @@
110 + namespace SignonDaemonNS {
111 +
112 + typedef QList<QVariantMap> MapList;
113 ++class RegisteredIdentity;
114 +
115 + class SignonDaemonAdaptor: public QDBusAbstractAdaptor
116 + {
117 +@@ -74,10 +75,12 @@ private:
118 + QObject *object);
119 +
120 + private Q_SLOTS:
121 ++ void onIdentityUnregistered();
122 + void onIdentityAccessReplyFinished();
123 + void onAuthSessionAccessReplyFinished();
124 +
125 + private:
126 ++ QList<RegisteredIdentity*> m_registeredIdentities;
127 + SignonDaemon *m_parent;
128 + }; //class SignonDaemonAdaptor
129 +
130 +diff --git a/src/signond/signonidentity.cpp b/src/signond/signonidentity.cpp
131 +index ce1ecfb0..a143c223 100644
132 +--- a/src/signond/signonidentity.cpp
133 ++++ b/src/signond/signonidentity.cpp
134 +@@ -84,7 +84,8 @@ private:
135 + SignonIdentity::SignonIdentity(quint32 id, int timeout,
136 + SignonDaemon *parent):
137 + SignonDisposable(timeout, parent),
138 +- m_pInfo(NULL)
139 ++ m_pInfo(NULL),
140 ++ m_destroyed(false)
141 + {
142 + m_id = id;
143 +
144 +@@ -112,7 +113,10 @@ SignonIdentity::SignonIdentity(quint32 id, int timeout,
145 +
146 + SignonIdentity::~SignonIdentity()
147 + {
148 +- emit unregistered();
149 ++ if (!m_destroyed) {
150 ++ m_destroyed = true;
151 ++ Q_EMIT unregistered();
152 ++ }
153 +
154 + delete m_signonui;
155 + delete m_pInfo;
156 +@@ -125,9 +129,8 @@ SignonIdentity *SignonIdentity::createIdentity(quint32 id, SignonDaemon *parent)
157 +
158 + void SignonIdentity::destroy()
159 + {
160 +- /* Emitting the destroyed signal makes QDBusConnection unregister the
161 +- * object */
162 +- Q_EMIT destroyed();
163 ++ m_destroyed = true;
164 ++ Q_EMIT unregistered();
165 + deleteLater();
166 + }
167 +
168 +diff --git a/src/signond/signonidentity.h b/src/signond/signonidentity.h
169 +index 9ec9be4e..f6321f30 100644
170 +--- a/src/signond/signonidentity.h
171 ++++ b/src/signond/signonidentity.h
172 +@@ -96,6 +96,7 @@ private:
173 + quint32 m_id;
174 + SignonUiAdaptor *m_signonui;
175 + SignonIdentityInfo *m_pInfo;
176 ++ bool m_destroyed;
177 + }; //class SignonDaemon
178 +
179 + } //namespace SignonDaemonNS
180 +--
181 +2.26.2
182 +
183
184 diff --git a/net-libs/signond/signond-8.60-r2.ebuild b/net-libs/signond/signond-8.60-r2.ebuild
185 new file mode 100644
186 index 00000000000..b1040feb3ec
187 --- /dev/null
188 +++ b/net-libs/signond/signond-8.60-r2.ebuild
189 @@ -0,0 +1,76 @@
190 +# Copyright 1999-2020 Gentoo Authors
191 +# Distributed under the terms of the GNU General Public License v2
192 +
193 +EAPI=7
194 +
195 +inherit qmake-utils
196 +
197 +DESCRIPTION="Signon daemon for libaccounts-glib"
198 +HOMEPAGE="https://gitlab.com/accounts-sso"
199 +SRC_URI="https://gitlab.com/accounts-sso/${PN}/-/archive/VERSION_${PV}/${PN}-VERSION_${PV}.tar.gz -> ${P}.tar.gz"
200 +
201 +LICENSE="LGPL-2.1"
202 +SLOT="0"
203 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
204 +IUSE="doc test"
205 +
206 +BDEPEND="doc? ( app-doc/doxygen )"
207 +RDEPEND="
208 + dev-qt/qtcore:5
209 + dev-qt/qtdbus:5
210 + dev-qt/qtgui:5
211 + dev-qt/qtnetwork:5
212 + dev-qt/qtsql:5
213 + net-libs/libproxy
214 +"
215 +DEPEND="${RDEPEND}
216 + test? ( dev-qt/qttest:5 )
217 +"
218 +
219 +RESTRICT="!test? ( test )"
220 +
221 +PATCHES=(
222 + "${FILESDIR}/${P}-buildsystem.patch"
223 + "${FILESDIR}/${P}-consistent-paths.patch" # bug 701142
224 + "${FILESDIR}/${P}-crashfix.patch"
225 +)
226 +
227 +S="${WORKDIR}/${PN}-VERSION_${PV}"
228 +
229 +src_prepare() {
230 + default
231 +
232 + # install docs to correct location
233 + sed -e "s|share/doc/\$\${PROJECT_NAME}|share/doc/${PF}|" \
234 + -i doc/doc.pri || die
235 + sed -e "/^documentation.path = /c\documentation.path = \$\${INSTALL_PREFIX}/share/doc/${PF}/\$\${TARGET}/" \
236 + -i lib/plugins/doc/doc.pri || die
237 + sed -e "/^documentation.path = /c\documentation.path = \$\${INSTALL_PREFIX}/share/doc/${PF}/libsignon-qt/" \
238 + -i lib/SignOn/doc/doc.pri || die
239 +
240 + # std flags
241 + sed -e "/CONFIG += c++11/d" \
242 + -i common-project-config.pri || die "failed fixing CXXFLAGS"
243 +
244 + # fix runtime failures
245 + sed -e "/fno-rtti/d" \
246 + -i common-project-config.pri src/plugins/plugins.pri \
247 + src/{remotepluginprocess/remotepluginprocess,extensions/cryptsetup/cryptsetup}.pro \
248 + tests/{signond-tests/signond-tests,extensions/extensions}.pri \
249 + tests/{passwordplugintest/passwordplugintest,libsignon-qt-tests/libsignon-qt-tests}.pro \
250 + || die "failed disabling -fno-rtti"
251 +
252 + use doc || sed -e "/include(\s*doc\/doc.pri\s*)/d" \
253 + -i signon.pro lib/SignOn/SignOn.pro lib/plugins/plugins.pro || die
254 +
255 + use test || sed -e '/^SUBDIRS/s/tests//' \
256 + -i signon.pro || die "couldn't disable tests"
257 +}
258 +
259 +src_configure() {
260 + eqmake5 PREFIX="${EPREFIX}"/usr LIBDIR=$(get_libdir)
261 +}
262 +
263 +src_install() {
264 + emake INSTALL_ROOT="${D}" install
265 +}