commit:     3a4f8f8c3b3c367238ce3edf2dc38ee8ffda1e18
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu May 15 14:49:56 2025 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu May 15 15:34:26 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a4f8f8c

kde-frameworks/kwallet-runtime: Fix hanging clients w/ KWallet disabled

See also: https://invent.kde.org/frameworks/kwallet/-/merge_requests/117
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=504014

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 ...wallet-runtime-6.14.0-no-hang-if-disabled.patch | 101 +++++++++++++++++++++
 .../kwallet-runtime-6.14.0-r1.ebuild               |  69 ++++++++++++++
 2 files changed, 170 insertions(+)

diff --git 
a/kde-frameworks/kwallet-runtime/files/kwallet-runtime-6.14.0-no-hang-if-disabled.patch
 
b/kde-frameworks/kwallet-runtime/files/kwallet-runtime-6.14.0-no-hang-if-disabled.patch
new file mode 100644
index 000000000000..d1d07f0a9d6a
--- /dev/null
+++ 
b/kde-frameworks/kwallet-runtime/files/kwallet-runtime-6.14.0-no-hang-if-disabled.patch
@@ -0,0 +1,101 @@
+From a8490198ca9293cce3667a1ae5c09c5c825f139b Mon Sep 17 00:00:00 2001
+From: Marco Martin <[email protected]>
+Date: Thu, 15 May 2025 14:32:25 +0200
+Subject: [PATCH 1/2] Don't make clients hang if kwallet is disabled
+
+check if kwallet is disabled only after creating KWalletD,
+because if we were Dbus activated, the caller will stay
+hanged if we never bring up the service
+
+BUG:504014
+---
+ src/runtime/kwalletd/main.cpp | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/src/runtime/kwalletd/main.cpp b/src/runtime/kwalletd/main.cpp
+index 03c9ceaf..50b628d8 100644
+--- a/src/runtime/kwalletd/main.cpp
++++ b/src/runtime/kwalletd/main.cpp
+@@ -47,16 +47,19 @@ int main(int argc, char **argv)
+     parser.process(application);
+     aboutData.processCommandLine(&parser);
+ 
++    KDBusService dbusUniqueInstance(KDBusService::Unique);
++
++    KWalletD wallet;
++
+     // check if kwallet is disabled
++    // do this after creating KWalletD, because if we were
++    // Dbus activated, the caller will stay hanged if we never
++    // bring up the service
+     if (!isWalletEnabled()) {
+         qCDebug(KWALLETD_LOG) << "kwallet is disabled!";
+ 
+         return (0);
+     }
+ 
+-    KDBusService dbusUniqueInstance(KDBusService::Unique);
+-
+-    KWalletD wallet;
+-
+     return application.exec();
+ }
+-- 
+GitLab
+
+
+From 80ba18a9d52328acc45b541f423a5db587b1aea8 Mon Sep 17 00:00:00 2001
+From: Marco Martin <[email protected]>
+Date: Thu, 15 May 2025 15:29:45 +0200
+Subject: [PATCH 2/2] return -1 when disabled
+
+---
+ src/runtime/ksecretd/main.cpp |  2 +-
+ src/runtime/kwalletd/main.cpp | 13 +++++--------
+ 2 files changed, 6 insertions(+), 9 deletions(-)
+
+diff --git a/src/runtime/ksecretd/main.cpp b/src/runtime/ksecretd/main.cpp
+index df668a1d..97dcf3c3 100644
+--- a/src/runtime/ksecretd/main.cpp
++++ b/src/runtime/ksecretd/main.cpp
+@@ -192,7 +192,7 @@ int main(int argc, char **argv)
+         /* Do not keep dbus-daemon waiting for the org.freedesktop.secrets if 
kwallet is disabled */
+         KWalletFreedesktopService(nullptr);
+ 
+-        return (0);
++        return (-1);
+     }
+ 
+     KSecretD secretd;
+diff --git a/src/runtime/kwalletd/main.cpp b/src/runtime/kwalletd/main.cpp
+index 50b628d8..0682c7d5 100644
+--- a/src/runtime/kwalletd/main.cpp
++++ b/src/runtime/kwalletd/main.cpp
+@@ -47,19 +47,16 @@ int main(int argc, char **argv)
+     parser.process(application);
+     aboutData.processCommandLine(&parser);
+ 
+-    KDBusService dbusUniqueInstance(KDBusService::Unique);
+-
+-    KWalletD wallet;
+-
+     // check if kwallet is disabled
+-    // do this after creating KWalletD, because if we were
+-    // Dbus activated, the caller will stay hanged if we never
+-    // bring up the service
+     if (!isWalletEnabled()) {
+         qCDebug(KWALLETD_LOG) << "kwallet is disabled!";
+ 
+-        return (0);
++        return (-1);
+     }
+ 
++    KDBusService dbusUniqueInstance(KDBusService::Unique);
++
++    KWalletD wallet;
++
+     return application.exec();
+ }
+-- 
+GitLab
+

diff --git a/kde-frameworks/kwallet-runtime/kwallet-runtime-6.14.0-r1.ebuild 
b/kde-frameworks/kwallet-runtime/kwallet-runtime-6.14.0-r1.ebuild
new file mode 100644
index 000000000000..68d263f09601
--- /dev/null
+++ b/kde-frameworks/kwallet-runtime/kwallet-runtime-6.14.0-r1.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+KDE_ORG_NAME="kwallet"
+QTMIN=6.7.2
+inherit ecm frameworks.kde.org optfeature
+
+DESCRIPTION="Framework providing desktop-wide storage for passwords"
+
+LICENSE="LGPL-2+"
+KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv ~x86"
+IUSE="gpg +man +keyring +legacy-kwallet X"
+
+DEPEND="
+       >=app-crypt/qca-2.3.9:2[qt6(+)]
+       dev-libs/libgcrypt:0=
+       >=dev-qt/qtbase-${QTMIN}:6[dbus,gui,widgets]
+       =kde-frameworks/kcolorscheme-${KDE_CATV}*:6
+       =kde-frameworks/kconfig-${KDE_CATV}*:6
+       =kde-frameworks/kcoreaddons-${KDE_CATV}*:6
+       =kde-frameworks/kcrash-${KDE_CATV}*:6
+       =kde-frameworks/kdbusaddons-${KDE_CATV}*:6
+       =kde-frameworks/ki18n-${KDE_CATV}*:6
+       =kde-frameworks/knotifications-${KDE_CATV}*:6
+       =kde-frameworks/kservice-${KDE_CATV}*:6
+       =kde-frameworks/kwallet-${KDE_CATV}*:6
+       =kde-frameworks/kwidgetsaddons-${KDE_CATV}*:6
+       =kde-frameworks/kwindowsystem-${KDE_CATV}*:6[X?]
+       gpg? ( app-crypt/gpgme:=[qt6(-)] )
+       legacy-kwallet? ( app-crypt/libsecret )
+"
+RDEPEND="${DEPEND}
+       !<kde-frameworks/kwallet-5.116.0-r2:5[-kf6compat(-)]
+       !<kde-frameworks/kwallet-6.14.0:6
+"
+BDEPEND="man? ( >=kde-frameworks/kdoctools-${KDE_CATV}:6 )"
+
+PATCHES=(
+       "${FILESDIR}/${P}-stdalone.patch"
+       "${FILESDIR}/${P}-no-hang-if-disabled.patch" # KDE-bug #504014
+)
+
+src_prepare() {
+       ecm_src_prepare
+       cmake_run_in src cmake_comment_add_subdirectory api
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DBUILD_KWALLET_QUERY=ON # could be split easily together w/ 
docs
+               $(cmake_use_find_package gpg Gpgmepp)
+               -DBUILD_KSECRETD=$(usex keyring)
+               -DBUILD_KWALLETD=$(usex legacy-kwallet)
+               $(cmake_use_find_package man KF6DocTools)
+               -DWITH_X11=$(usex X)
+       )
+
+       ecm_src_configure
+}
+
+pkg_postinst() {
+       if [[ -z "${REPLACING_VERSIONS}" ]]; then
+               optfeature "Auto-unlocking after Plasma login" 
"kde-plasma/kwallet-pam"
+               optfeature "KWallet management" "kde-apps/kwalletmanager"
+               elog "For more information, read 
https://wiki.gentoo.org/wiki/KDE#KWallet";
+       fi
+}

Reply via email to