From 5374224bebbdce1eb6e76d659b6bd75c3b811aa872d355d12be4e2f6aba2d42a Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Wed, 14 Mar 2018 13:22:28 +0000 Subject: [PATCH] - Add patch to not move XAUTHORITY around if not required (boo#1084798): * 0001-Only-move-XAUTHORITY-if-it-s-temporary.patch OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kinit?expand=0&rev=156 --- ...ly-move-XAUTHORITY-if-it-s-temporary.patch | 39 +++++++++++++++++++ kinit.changes | 6 +++ kinit.spec | 4 +- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 0001-Only-move-XAUTHORITY-if-it-s-temporary.patch diff --git a/0001-Only-move-XAUTHORITY-if-it-s-temporary.patch b/0001-Only-move-XAUTHORITY-if-it-s-temporary.patch new file mode 100644 index 0000000..9d52212 --- /dev/null +++ b/0001-Only-move-XAUTHORITY-if-it-s-temporary.patch @@ -0,0 +1,39 @@ +From 8040d22c25eb950e8206af7ff20dcd958267de10 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Tue, 13 Mar 2018 18:54:26 +0100 +Subject: [PATCH] Only move XAUTHORITY if it's temporary +References: boo#1084798 + +If kdeinit is started within a session spawned by kdesu or similiar, it has +a temporary file as $XAUTHORITY. As kdeinit is persistent, the used .Xauthority +file must persist as well otherwise launched child process would have no access +to X. kdeinit works around the file's volatileness by copying it to a known +location. Unfortunately the chosen location (/tmp) gets cleared regularly which +means it's even more volatile than the source... + +Even more unfortunately, this workaround is applied WAY to broad. Even when +$XAUTHORITY points to a static file, like in a normal user session, it moves +.Xauthority around. + +Work around this issue by only applying it if $XAUTHORITY is in /tmp, where +kdesu places it. +--- + src/kdeinit/kinit.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/kdeinit/kinit.cpp b/src/kdeinit/kinit.cpp +index 0c2c35a..54a390f 100644 +--- a/src/kdeinit/kinit.cpp ++++ b/src/kdeinit/kinit.cpp +@@ -1483,7 +1483,7 @@ static void setupX() + as well, point XAUTHORITY there and never remove the file (except for possible + tmp cleanup). + */ +- if (!qEnvironmentVariableIsEmpty("XAUTHORITY")) { ++ if (!qEnvironmentVariableIsEmpty("XAUTHORITY") && qgetenv("XAUTHORITY").startsWith("/tmp/")) { + QByteArray display = qgetenv(displayEnvVarName_c()); + int i; + if ((i = display.lastIndexOf('.')) > display.lastIndexOf(':') && i >= 0) { +-- +2.16.2 + diff --git a/kinit.changes b/kinit.changes index b124ded..2bad659 100644 --- a/kinit.changes +++ b/kinit.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Mar 14 13:21:57 UTC 2018 - fabian@ritter-vogt.de + +- Add patch to not move XAUTHORITY around if not required (boo#1084798): + * 0001-Only-move-XAUTHORITY-if-it-s-temporary.patch + ------------------------------------------------------------------- Mon Mar 12 23:29:41 CET 2018 - lbeltrame@kde.org diff --git a/kinit.spec b/kinit.spec index 30de453..dfaf70a 100644 --- a/kinit.spec +++ b/kinit.spec @@ -54,6 +54,8 @@ Source: http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-% Source1: baselibs.conf # PATCH-FIX-OPENSUSE fpie.patch -- add -(f)pie link flags to start_kdeinit target Patch0: fpie.patch +# PATCH-FIX-OPENSUSE +Patch1: 0001-Only-move-XAUTHORITY-if-it-s-temporary.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -72,7 +74,7 @@ booting UNIX. Development files. %lang_package %prep %setup -q -%patch0 -p1 +%autopatch -p1 %build %cmake_kf5 -d build