From 667b1e908ec6463534e916563b3356239df978d6 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 13 Apr 2021 16:45:11 -0700 Subject: [PATCH] Add another commit from PR #1371, re-rediff patches for order --- 0001-Redesign-Xauth-handling.patch | 2 +- ...d0df2583b02251f0d80c397ccbf9fa7a9e04.patch | 2 +- ...e9206dc2e17fa5dc13f37be2926e9131ce94.patch | 163 ++++++++++++++++++ sddm.spec | 6 +- 4 files changed, 169 insertions(+), 4 deletions(-) create mode 100644 3c92e9206dc2e17fa5dc13f37be2926e9131ce94.patch diff --git a/0001-Redesign-Xauth-handling.patch b/0001-Redesign-Xauth-handling.patch index daadb5d..088e736 100644 --- a/0001-Redesign-Xauth-handling.patch +++ b/0001-Redesign-Xauth-handling.patch @@ -153,7 +153,7 @@ index cf44a62..a7e0585 100644 - Entry(UserAuthFile, QString, _S(".Xauthority"), _S("Path to the Xauthority file")); Entry(DisplayCommand, QString, _S(DATA_INSTALL_DIR "/scripts/Xsetup"), _S("Path to a script to execute when starting the display server")); Entry(DisplayStopCommand, QString, _S(DATA_INSTALL_DIR "/scripts/Xstop"), _S("Path to a script to execute when stopping the display server")); - Entry(EnableHiDPI, bool, false, _S("Enable Qt's automatic high-DPI scaling")); + Entry(MinimumVT, int, MINIMUM_VT, _S("The lowest virtual terminal number that will be used.")); diff --git a/src/common/XauthUtils.cpp b/src/common/XauthUtils.cpp new file mode 100644 index 0000000..da1c691 diff --git a/308fd0df2583b02251f0d80c397ccbf9fa7a9e04.patch b/308fd0df2583b02251f0d80c397ccbf9fa7a9e04.patch index 5372fe4..1bef47c 100644 --- a/308fd0df2583b02251f0d80c397ccbf9fa7a9e04.patch +++ b/308fd0df2583b02251f0d80c397ccbf9fa7a9e04.patch @@ -67,7 +67,7 @@ index cf44a629..b7987198 100644 --- a/src/common/Configuration.h +++ b/src/common/Configuration.h @@ -70,7 +70,6 @@ namespace SDDM { - Entry(UserAuthFile, QString, _S(".Xauthority"), _S("Path to the Xauthority file")); + Entry(SessionLogFile, QString, _S(".local/share/sddm/xorg-session.log"), _S("Path to the user session log file")); Entry(DisplayCommand, QString, _S(DATA_INSTALL_DIR "/scripts/Xsetup"), _S("Path to a script to execute when starting the display server")); Entry(DisplayStopCommand, QString, _S(DATA_INSTALL_DIR "/scripts/Xstop"), _S("Path to a script to execute when stopping the display server")); - Entry(MinimumVT, int, MINIMUM_VT, _S("The lowest virtual terminal number that will be used.")); diff --git a/3c92e9206dc2e17fa5dc13f37be2926e9131ce94.patch b/3c92e9206dc2e17fa5dc13f37be2926e9131ce94.patch new file mode 100644 index 0000000..b94a535 --- /dev/null +++ b/3c92e9206dc2e17fa5dc13f37be2926e9131ce94.patch @@ -0,0 +1,163 @@ +From 3c92e9206dc2e17fa5dc13f37be2926e9131ce94 Mon Sep 17 00:00:00 2001 +From: Pier Luigi Fiorini +Date: Sun, 7 Mar 2021 17:36:11 +0100 +Subject: [PATCH] Stop the helper process + +Make sure the helper process is stopped when shutting down. +--- + src/auth/Auth.cpp | 9 +++++++++ + src/auth/Auth.h | 5 +++++ + src/{daemon => common}/SignalHandler.cpp | 0 + src/{daemon => common}/SignalHandler.h | 0 + src/daemon/CMakeLists.txt | 3 ++- + src/daemon/Greeter.cpp | 2 ++ + src/helper/CMakeLists.txt | 2 ++ + src/helper/HelperApp.cpp | 14 +++++++++++++- + src/helper/HelperApp.h | 2 ++ + 9 files changed, 35 insertions(+), 2 deletions(-) + rename src/{daemon => common}/SignalHandler.cpp (100%) + rename src/{daemon => common}/SignalHandler.h (100%) + +diff --git a/src/auth/Auth.cpp b/src/auth/Auth.cpp +index caca3146..042d938b 100644 +--- a/src/auth/Auth.cpp ++++ b/src/auth/Auth.cpp +@@ -358,6 +358,15 @@ namespace SDDM { + args << QStringLiteral("--greeter"); + d->child->start(QStringLiteral("%1/sddm-helper").arg(QStringLiteral(LIBEXEC_INSTALL_DIR)), args); + } ++ ++ void Auth::stop() ++ { ++ if (d->child->state() != QProcess::NotRunning) { ++ d->child->terminate(); ++ if (!d->child->waitForFinished(5000)) ++ d->child->kill(); ++ } ++ } + } + + #include "Auth.moc" +diff --git a/src/auth/Auth.h b/src/auth/Auth.h +index 87f5f440..c3ce1a62 100644 +--- a/src/auth/Auth.h ++++ b/src/auth/Auth.h +@@ -157,6 +157,11 @@ namespace SDDM { + */ + void start(); + ++ /** ++ * Stops the process. ++ */ ++ void stop(); ++ + Q_SIGNALS: + void autologinChanged(); + void greeterChanged(); +diff --git a/src/daemon/SignalHandler.cpp b/src/common/SignalHandler.cpp +similarity index 100% +rename from src/daemon/SignalHandler.cpp +rename to src/common/SignalHandler.cpp +diff --git a/src/daemon/SignalHandler.h b/src/common/SignalHandler.h +similarity index 100% +rename from src/daemon/SignalHandler.h +rename to src/common/SignalHandler.h +diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt +index 86d014be..4660a2f2 100644 +--- a/src/daemon/CMakeLists.txt ++++ b/src/daemon/CMakeLists.txt +@@ -13,6 +13,8 @@ set(DAEMON_SOURCES + ${CMAKE_SOURCE_DIR}/src/common/Session.cpp + ${CMAKE_SOURCE_DIR}/src/common/SocketWriter.cpp ++ ${CMAKE_SOURCE_DIR}/src/common/SignalHandler.cpp ++ ${CMAKE_SOURCE_DIR}/src/common/SignalHandler.h + ${CMAKE_SOURCE_DIR}/src/common/XauthUtils.cpp + ${CMAKE_SOURCE_DIR}/src/auth/Auth.cpp + ${CMAKE_SOURCE_DIR}/src/auth/AuthPrompt.cpp + ${CMAKE_SOURCE_DIR}/src/auth/AuthRequest.cpp +@@ -27,7 +29,6 @@ set(DAEMON_SOURCES + PowerManager.cpp + Seat.cpp + SeatManager.cpp +- SignalHandler.cpp + SocketServer.cpp + ) + +diff --git a/src/daemon/Greeter.cpp b/src/daemon/Greeter.cpp +index 436ecc3d..3b0ab2c3 100644 +--- a/src/daemon/Greeter.cpp ++++ b/src/daemon/Greeter.cpp +@@ -225,6 +225,8 @@ namespace SDDM { + // wait for finished + if (!m_process->waitForFinished(5000)) + m_process->kill(); ++ } else { ++ m_auth->stop(); + } + } + +diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt +index 8914ea75..f63dcc92 100644 +--- a/src/helper/CMakeLists.txt ++++ b/src/helper/CMakeLists.txt +@@ -10,6 +10,8 @@ set(HELPER_SOURCES + ${CMAKE_SOURCE_DIR}/src/common/ConfigReader.cpp + ${CMAKE_SOURCE_DIR}/src/common/SafeDataStream.cpp ++ ${CMAKE_SOURCE_DIR}/src/common/SignalHandler.cpp ++ ${CMAKE_SOURCE_DIR}/src/common/SignalHandler.h + ${CMAKE_SOURCE_DIR}/src/common/XauthUtils.cpp + Backend.cpp + HelperApp.cpp + UserSession.cpp +diff --git a/src/helper/HelperApp.cpp b/src/helper/HelperApp.cpp +index 672359ae..12c3206e 100644 +--- a/src/helper/HelperApp.cpp ++++ b/src/helper/HelperApp.cpp +@@ -22,7 +22,7 @@ + #include "Backend.h" + #include "UserSession.h" + #include "SafeDataStream.h" +- ++#include "SignalHandler.h" + #include "MessageHandler.h" + #include "VirtualTerminal.h" + +@@ -50,6 +50,18 @@ namespace SDDM { + , m_socket(new QLocalSocket(this)) { + qInstallMessageHandler(HelperMessageHandler); + ++ m_signalHandler = new SignalHandler(this); ++ m_signalHandler->initialize(); ++ connect(m_signalHandler, &SignalHandler::sigintReceived, this, &HelperApp::quit); ++ connect(m_signalHandler, &SignalHandler::sigtermReceived, this, &HelperApp::quit); ++ ++ connect(this, &QCoreApplication::aboutToQuit, this, [this] { ++ m_session->terminate(); ++ if (!m_session->waitForFinished(5000)) ++ m_session->kill(); ++ m_backend->closeSession(); ++ }); ++ + QTimer::singleShot(0, this, SLOT(setUp())); + } + +diff --git a/src/helper/HelperApp.h b/src/helper/HelperApp.h +index 3742df12..d08fd37b 100644 +--- a/src/helper/HelperApp.h ++++ b/src/helper/HelperApp.h +@@ -31,6 +31,7 @@ class QLocalSocket; + namespace SDDM { + class Backend; + class UserSession; ++ class SignalHandler; + class HelperApp : public QCoreApplication + { + Q_OBJECT +@@ -63,6 +64,7 @@ namespace SDDM { + QString m_user { }; + // TODO: get rid of this in a nice clean way along the way with moving to user session X server + QByteArray m_cookie { }; ++ SignalHandler *m_signalHandler = nullptr; + + /*! + \brief Write utmp/wtmp/btmp records when a user logs in diff --git a/sddm.spec b/sddm.spec index cef1f26..0728953 100644 --- a/sddm.spec +++ b/sddm.spec @@ -31,12 +31,14 @@ Patch052: 0001-Redesign-Xauth-handling.patch # newer(?) pristine one from upstream PR has xauth locking issues wrt RUNTIME_DIR #Patch52: 0001-Redesign-Xauth-handling-1.patch -# First two commits from: +# https://github.com/sddm/sddm/commit/42c5176 plus the first two +# commits from: # https://github.com/sddm/sddm/pull/1371 # Fixes several (but not all) issues with session switching: # https://bugzilla.redhat.com/show_bug.cgi?id=1929643 Patch053: 0001-Retry-starting-the-display-server.patch -Patch054: 308fd0df2583b02251f0d80c397ccbf9fa7a9e04.patch +Patch054: 3c92e9206dc2e17fa5dc13f37be2926e9131ce94.patch +Patch055: 308fd0df2583b02251f0d80c397ccbf9fa7a9e04.patch ## downstream patches Patch101: sddm-0.19.0-fedora_config.patch