From 1c7e3064d88d13fb4a03aba41bd6d5ac7ca832e7 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 3 Mar 2021 14:26:42 +0000 Subject: [PATCH] Fix query of StartPlasma::hasSystemdService ListUnitByNames did not quite work as the author (me) expected. Whilst a search for "adsfasf" yeilded an empty list a well-formed name like "asdfasdf.service" would return a result to say that service was not loaded. This means our runtime detection of xdg-autostart-generator failed. By using ListUnitFilesByPatterns we can filter on the status in the query, meaning this code works again. We also can query the case of it being available but explicitly disabled. BUG: 433333 --- startkde/startplasma.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/startkde/startplasma.cpp b/startkde/startplasma.cpp index 2ecb2561e..778242538 100644 --- a/startkde/startplasma.cpp +++ b/startkde/startplasma.cpp @@ -452,8 +452,8 @@ bool hasSystemdService(const QString &serviceName) auto msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.systemd1"), QStringLiteral("/org/freedesktop/systemd1"), QStringLiteral("org.freedesktop.systemd1.Manager"), - QStringLiteral("ListUnitsByNames")); - msg << QStringList({serviceName}); + QStringLiteral("ListUnitFilesByPatterns")); + msg << QStringList({QStringLiteral("enabled"), QStringLiteral("static")}) << QStringList({serviceName}); auto reply = QDBusConnection::sessionBus().call(msg); if (reply.type() == QDBusMessage::ErrorMessage) { return false; @@ -471,7 +471,7 @@ bool useSystemdBoot() return false; } - if (!hasSystemdService(QStringLiteral("plasma-workspace@ANY.target"))) { + if (!hasSystemdService(QStringLiteral("plasma-workspace@.target"))) { qWarning() << "Systemd boot requested, but plasma services were not found"; return false; }