commit: 2ae47dde3340579d969739ca844544e8c645f38a Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> AuthorDate: Fri May 30 21:34:45 2025 +0000 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> CommitDate: Mon Jun 2 16:48:07 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2ae47dde
kde-plasma/powerdevil: Fix triggering an assert in KConfigGroup Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> .../files/powerdevil-6.3.5-fix-assert.patch | 108 +++++++++++++++++++++ kde-plasma/powerdevil/powerdevil-6.3.5-r2.ebuild | 96 ++++++++++++++++++ 2 files changed, 204 insertions(+) diff --git a/kde-plasma/powerdevil/files/powerdevil-6.3.5-fix-assert.patch b/kde-plasma/powerdevil/files/powerdevil-6.3.5-fix-assert.patch new file mode 100644 index 000000000000..b8c42bcfe3cf --- /dev/null +++ b/kde-plasma/powerdevil/files/powerdevil-6.3.5-fix-assert.patch @@ -0,0 +1,108 @@ +From 664ca532ed0ce583c84ecafd23e91d38b747791c Mon Sep 17 00:00:00 2001 +From: Vlad Zahorodnii <[email protected]> +Date: Mon, 26 May 2025 17:51:21 +0000 +Subject: [PATCH] daemon: Fix triggering an assert in KConfigGroup + +If there is no current activity, KActivities::Consumer::currentActivity() +can return an empty string. The problem with that is that the KConfigGroup +doesn't allow empty strings to be used as group names, it has an assert +for that. + +This change puts relevant code behind a guard to avoid triggering the +assert in KConfigGroup. + +SENTRY: POWERDEVIL-161 + + +(cherry picked from commit c8ced4c4097c1db97e1c537f7f1869c225227b09) + +Co-authored-by: Vlad Zahorodnii <[email protected]> +--- + daemon/powerdevilcore.cpp | 62 ++++++++++++++++++++------------------- + 1 file changed, 32 insertions(+), 30 deletions(-) + +diff --git a/daemon/powerdevilcore.cpp b/daemon/powerdevilcore.cpp +index 3f6801046..fc154cab4 100644 +--- a/daemon/powerdevilcore.cpp ++++ b/daemon/powerdevilcore.cpp +@@ -300,17 +300,6 @@ void Core::loadProfile(bool force) + { + QString profileId; + +- // Check the activity in which we are in +- QString activity = m_activityConsumer->currentActivity(); +- qCDebug(POWERDEVIL) << "Currently using activity " << activity; +- +- PowerDevil::ActivitySettings activitySettings(activity); +- +- qCDebug(POWERDEVIL) << "Settings for loaded activity:"; +- for (KConfigSkeletonItem *item : activitySettings.items()) { +- qCDebug(POWERDEVIL) << item->key() << "=" << item->property(); +- } +- + // let's load the current state's profile + if (m_batteriesPercent.isEmpty()) { + qCDebug(POWERDEVIL) << "No batteries found, loading AC"; +@@ -376,27 +365,40 @@ void Core::loadProfile(bool force) + Q_EMIT profileChanged(m_currentProfile); + } + +- // Now... any special behaviors we'd like to consider? +- if (activitySettings.inhibitSuspend()) { +- qCDebug(POWERDEVIL) << "Activity triggers a suspend inhibition"; // debug hence not sleep +- // Trigger a special inhibition - if we don't have one yet +- if (!m_sessionActivityInhibit.contains(activity)) { +- int cookie = PolicyAgent::instance()->AddInhibition(PolicyAgent::InterruptSession, +- i18n("Activity Manager"), +- i18n("This activity's policies prevent the system from going to sleep")); ++ // Check the activity in which we are in ++ const QString activity = m_activityConsumer->currentActivity(); ++ qCDebug(POWERDEVIL) << "Currently using activity" << activity; ++ ++ if (!activity.isEmpty()) { ++ PowerDevil::ActivitySettings activitySettings(activity); + +- m_sessionActivityInhibit.insert(activity, cookie); ++ qCDebug(POWERDEVIL) << "Settings for loaded activity:"; ++ for (KConfigSkeletonItem *item : activitySettings.items()) { ++ qCDebug(POWERDEVIL) << item->key() << "=" << item->property(); + } +- } +- if (activitySettings.inhibitScreenManagement()) { +- qCDebug(POWERDEVIL) << "Activity triggers a screen management inhibition"; +- // Trigger a special inhibition - if we don't have one yet +- if (!m_screenActivityInhibit.contains(activity)) { +- int cookie = PolicyAgent::instance()->AddInhibition(PolicyAgent::ChangeScreenSettings, +- i18n("Activity Manager"), +- i18n("This activity's policies prevent screen power management")); +- +- m_screenActivityInhibit.insert(activity, cookie); ++ ++ // Now... any special behaviors we'd like to consider? ++ if (activitySettings.inhibitSuspend()) { ++ qCDebug(POWERDEVIL) << "Activity triggers a suspend inhibition"; // debug hence not sleep ++ // Trigger a special inhibition - if we don't have one yet ++ if (!m_sessionActivityInhibit.contains(activity)) { ++ int cookie = PolicyAgent::instance()->AddInhibition(PolicyAgent::InterruptSession, ++ i18n("Activity Manager"), ++ i18n("This activity's policies prevent the system from going to sleep")); ++ ++ m_sessionActivityInhibit.insert(activity, cookie); ++ } ++ } ++ if (activitySettings.inhibitScreenManagement()) { ++ qCDebug(POWERDEVIL) << "Activity triggers a screen management inhibition"; ++ // Trigger a special inhibition - if we don't have one yet ++ if (!m_screenActivityInhibit.contains(activity)) { ++ int cookie = PolicyAgent::instance()->AddInhibition(PolicyAgent::ChangeScreenSettings, ++ i18n("Activity Manager"), ++ i18n("This activity's policies prevent screen power management")); ++ ++ m_screenActivityInhibit.insert(activity, cookie); ++ } + } + } + +-- +GitLab + diff --git a/kde-plasma/powerdevil/powerdevil-6.3.5-r2.ebuild b/kde-plasma/powerdevil/powerdevil-6.3.5-r2.ebuild new file mode 100644 index 000000000000..befa8b1f6084 --- /dev/null +++ b/kde-plasma/powerdevil/powerdevil-6.3.5-r2.ebuild @@ -0,0 +1,96 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +ECM_HANDBOOK="optional" +ECM_TEST="forceoptional" +KFMIN=6.10.0 +QTMIN=6.8.1 +inherit ecm fcaps plasma.kde.org xdg + +DESCRIPTION="Power management for KDE Plasma Shell" +HOMEPAGE="https://invent.kde.org/plasma/powerdevil" + +LICENSE="GPL-2" # TODO: CHECK +SLOT="6" +KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv ~x86" +IUSE="brightness-control" + +RESTRICT="test" # bug 926513 + +# slot op: Uses Qt::GuiPrivate for qtx11extras_p.h +COMMON_DEPEND=" + dev-libs/qcoro[dbus] + dev-libs/wayland + >=dev-qt/qtbase-${QTMIN}:6=[dbus,gui,widgets] + >=dev-qt/qtwayland-${QTMIN}:6= + >=kde-frameworks/kauth-${KFMIN}:6[policykit] + >=kde-frameworks/kconfig-${KFMIN}:6 + >=kde-frameworks/kconfigwidgets-${KFMIN}:6 + >=kde-frameworks/kcoreaddons-${KFMIN}:6 + >=kde-frameworks/kcrash-${KFMIN}:6 + >=kde-frameworks/kdbusaddons-${KFMIN}:6 + >=kde-frameworks/kglobalaccel-${KFMIN}:6 + >=kde-frameworks/ki18n-${KFMIN}:6 + >=kde-frameworks/kidletime-${KFMIN}:6 + >=kde-frameworks/kio-${KFMIN}:6 + >=kde-frameworks/kirigami-${KFMIN}:6 + >=kde-frameworks/kitemmodels-${KFMIN}:6 + >=kde-frameworks/knotifications-${KFMIN}:6 + >=kde-frameworks/krunner-${KFMIN}:6 + >=kde-frameworks/kservice-${KFMIN}:6 + >=kde-frameworks/kwindowsystem-${KFMIN}:6[X] + >=kde-frameworks/kxmlgui-${KFMIN}:6 + >=kde-frameworks/solid-${KFMIN}:6 + >=kde-plasma/libkscreen-${KDE_CATV}:6 + >=kde-plasma/libplasma-${KDE_CATV}:6 + >=kde-plasma/plasma-activities-${KDE_CATV}:6 + >=kde-plasma/plasma-workspace-${KDE_CATV}:6 + virtual/libudev:= + x11-libs/libxcb + brightness-control? ( app-misc/ddcutil:= ) +" +DEPEND="${COMMON_DEPEND} + >=dev-libs/plasma-wayland-protocols-1.16.0 +" +RDEPEND="${COMMON_DEPEND} + !<kde-plasma/plasma-workspace-6.1.90:* + >=dev-qt/qtdeclarative-${QTMIN}:6 + || ( + sys-power/power-profiles-daemon + sys-power/tlp + ) + >=sys-power/upower-0.9.23 +" +BDEPEND=" + >=dev-qt/qtwayland-${QTMIN}:6 + >=kde-frameworks/kcmutils-${KFMIN}:6 +" + +# -m 0755 to avoid suid with USE="-filecaps" +FILECAPS=( -m 0755 cap_wake_alarm=ep usr/libexec/org_kde_powerdevil ) + +PATCHES=( "${FILESDIR}/${P}-fix-assert.patch" ) + +src_configure() { + local mycmakeargs=( + -DCMAKE_DISABLE_FIND_PACKAGE_Libcap=ON + $(cmake_use_find_package brightness-control DDCUtil) + ) + use test && mycmakeargs+=( + -DCMAKE_DISABLE_FIND_PACKAGE_SeleniumWebDriverATSPI=ON # not packaged + ) + + ecm_src_configure +} + +src_test() { + # bug 926513 + ecm_src_test -j1 +} + +pkg_postinst() { + xdg_pkg_postinst + fcaps_pkg_postinst +}
