[utilities/kate] addons/lspclient: only add processId if we are not sandboxed
Christoph Cullmann <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 7a95750d9668910be24ed24df1a9c6c73aed41ef by Christoph Cullmann.
Committed on 16/07/2026 at 16:31.
Pushed by cullmann into branch 'master'.
only add processId if we are not sandboxed
with pid namespaces that will otherwise lead to issues,
like existing LSP servers in Flatpak
BUG: 522883
M +11 -2 addons/lspclient/lspclientserver.cpp
https://invent.kde.org/utilities/kate/-/commit/7a95750d9668910be24ed24df1a9c6c73aed41ef
diff --git a/addons/lspclient/lspclientserver.cpp b/addons/lspclient/lspclientserver.cpp
index 8ae721df1d..a995699cd1 100644
--- a/addons/lspclient/lspclientserver.cpp
+++ b/addons/lspclient/lspclientserver.cpp
@@ -11,6 +11,8 @@
#include "ktexteditor_utils.h"
+#include <KSandbox>
+
#include <QCoreApplication>
#include <QFileInfo>
#include <QJsonArray>
@@ -1853,15 +1855,22 @@ private:
// NOTE a typical server does not use root all that much,
// other than for some corner case (in) requests
auto root = mapPath(m_root, true);
- QJsonObject params{{QLatin1String("processId"), QCoreApplication::applicationPid()},
- {QLatin1String("rootPath"), root.isValid() ? root.toLocalFile() : QJsonValue()},
+ QJsonObject params{{QLatin1String("rootPath"), root.isValid() ? root.toLocalFile() : QJsonValue()},
{QLatin1String("rootUri"), root.isValid() ? QJsonValue(QString::fromUtf8(root.toEncoded())) : QJsonValue()},
{QLatin1String("capabilities"), capabilities},
{QLatin1String("initializationOptions"), m_init}};
+
+ // only add processId if we are not sandboxed, with pid namespaces that
+ // will otherwise lead to issues, like existing LSP servers in Flatpak, see bug 522883
+ if (!KSandbox::isInside()) {
+ params[QLatin1String("processId")] = QCoreApplication::applicationPid();
+ }
+
// only add new style workspaces init if so specified
if (folders) {
params[QLatin1String("workspaceFolders")] = to_json(*folders);
}
+
write(init_request(QStringLiteral("initialize"), params), utils::mem_fun(&self_type::onInitializeReply, this));
}