parent
550e017164
commit
3fbded9ba1
@ -1,68 +0,0 @@
|
||||
From 10780187f57ab6e68fa08386321f2d0274b951df Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Lundholm Bertelsen <drixi.b@gmail.com>
|
||||
Date: Wed, 13 Jan 2021 01:29:44 +0100
|
||||
Subject: [PATCH 416/419] [libkworkspace] Only update env vars with
|
||||
alphanumeric_ names
|
||||
|
||||
It gives issues with systemd to try and pass it env var names with eg.
|
||||
'%' in them. That to such a degree that if invalid names are passed,
|
||||
none are set [1]. This change ensures compatibility by skipping any
|
||||
non-alphanumerical (and _) variable names.
|
||||
|
||||
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1754395
|
||||
---
|
||||
libkworkspace/updatelaunchenvjob.cpp | 24 ++++++++++++++++++++++++
|
||||
1 file changed, 24 insertions(+)
|
||||
|
||||
diff --git a/libkworkspace/updatelaunchenvjob.cpp b/libkworkspace/updatelaunchenvjob.cpp
|
||||
index f01a4c144..b7e124c71 100644
|
||||
--- a/libkworkspace/updatelaunchenvjob.cpp
|
||||
+++ b/libkworkspace/updatelaunchenvjob.cpp
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
explicit Private(UpdateLaunchEnvJob *q);
|
||||
void monitorReply(const QDBusPendingReply<> &reply);
|
||||
|
||||
+ static bool isPosixName(const QString &name);
|
||||
static bool isSystemdApprovedValue(const QString &value);
|
||||
|
||||
UpdateLaunchEnvJob *q;
|
||||
@@ -82,6 +83,10 @@ void UpdateLaunchEnvJob::start()
|
||||
QStringList systemdUpdates;
|
||||
|
||||
for (const auto &varName : d->environment.keys()) {
|
||||
+ if (!Private::isPosixName(varName)){
|
||||
+ qWarning() << "Skipping syncing of environment variable " << varName << "as name contains unsupported characters";
|
||||
+ continue;
|
||||
+ }
|
||||
const QString value = d->environment.value(varName);
|
||||
|
||||
// KLauncher
|
||||
@@ -136,6 +141,25 @@ void UpdateLaunchEnvJob::start()
|
||||
d->monitorReply(systemdActivationReply);
|
||||
}
|
||||
|
||||
+bool UpdateLaunchEnvJob::Private::isPosixName(const QString &name)
|
||||
+{
|
||||
+ // Posix says characters like % should be 'tolerated', but it gives issues in practice.
|
||||
+ // https://bugzilla.redhat.com/show_bug.cgi?id=1754395
|
||||
+ // https://bugzilla.redhat.com/show_bug.cgi?id=1879216
|
||||
+ // Ensure systemd compat by only allowing alphanumerics and _ in names.
|
||||
+ bool first = true;
|
||||
+ for (const QChar c : name) {
|
||||
+ if (first && !c.isLetter() && c != QChar('_')) {
|
||||
+ return false;
|
||||
+ } else if (first) {
|
||||
+ first = false;
|
||||
+ } else if (!c.isLetterOrNumber() && c != QChar('_')) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ return !first;
|
||||
+}
|
||||
+
|
||||
bool UpdateLaunchEnvJob::Private::isSystemdApprovedValue(const QString &value)
|
||||
{
|
||||
// systemd code checks that a value contains no control characters except \n \t
|
||||
--
|
||||
2.29.2
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA512 (breeze-fedora-0.2.tar.gz) = ff800e686b0dcb498f321bb94d3a8274c89c092f5408ef1ec3fc65333f046aea43444144ecaf166792f807014383af87b1180dc7540905fc10dc375309f8b2a8
|
||||
SHA512 (plasma-workspace-5.20.5.tar.xz) = bd63502fdaa79deb380d254a3649a2810e4b2c6e748e9a38606f561cc46573a6e75631584a340a220742135f4682f9deea28c78b7fe4ad88ee6491f190b3212f
|
||||
SHA512 (plasma-workspace-5.20.90.tar.xz) = 06c75637600053a8329791c58d2500f9f29f539e9b54a430f3ac7d81d8515a5ef412f972a0b564b46081da558b8facbce4d3f713ebd658e0e66350b409425b87
|
||||
|
Loading…
Reference in new issue