From 9c65d61b9855ae0a2e0faf642b3f066577c3962c Mon Sep 17 00:00:00 2001 From: John Zimmermann Date: Mon, 14 Feb 2022 15:50:22 +0100 Subject: [PATCH] utils/serviceutils: compare executablePath against canonical path of exec fields in .desktops /proc/%/exec always points to the canonical/real path of a binary, the exec field of a .desktop might contain a symlink and therefore differ from canonical path. Explicitely canonicalizing the path in exec prevents this mismatch. --- src/utils/serviceutils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/serviceutils.h b/src/utils/serviceutils.h index 8a70c1fad3..f0851acab9 100644 --- a/src/utils/serviceutils.h +++ b/src/utils/serviceutils.h @@ -32,7 +32,7 @@ static QStringList fetchProcessServiceField(const QString &executablePath, const static QLoggingCategory KWIN_UTILS ("KWIN_UTILS", QtWarningMsg); const auto servicesFound = KApplicationTrader::query([&executablePath] (const KService::Ptr &service) { - if (service->exec().isEmpty() || service->exec() != executablePath) + if (service->exec().isEmpty() || QFileInfo(service->exec()).canonicalFilePath() != executablePath) return false; return true;