diff --git a/0001-Allow-recovering-from-tty-switching-failures.patch b/0001-Allow-recovering-from-tty-switching-failures.patch new file mode 100644 index 0000000..46cc7d6 --- /dev/null +++ b/0001-Allow-recovering-from-tty-switching-failures.patch @@ -0,0 +1,102 @@ +From b8ef20b8bc6b9636449f602e10ac49d39b2abc79 Mon Sep 17 00:00:00 2001 +From: Aleix Pol +Date: Thu, 26 Jan 2023 18:04:12 +0100 +Subject: [PATCH] Allow recovering from tty switching failures + +If we fail to switch tty when showing the greeter, exit saying so then +switch back to tty 1 and try launching the Display again. + +Fixes #1636 +--- + src/auth/Auth.h | 1 + + src/daemon/Display.cpp | 9 +++++---- + src/daemon/Greeter.cpp | 7 ++++--- + src/daemon/Greeter.h | 1 + + src/helper/UserSession.cpp | 2 +- + 5 files changed, 12 insertions(+), 8 deletions(-) + +diff --git a/src/auth/Auth.h b/src/auth/Auth.h +index 0e39f69..66a9ec9 100644 +--- a/src/auth/Auth.h ++++ b/src/auth/Auth.h +@@ -86,6 +86,7 @@ namespace SDDM { + HELPER_SESSION_ERROR, + HELPER_OTHER_ERROR, + HELPER_DISPLAYSERVER_ERROR, ++ HELPER_TTY_ERROR, + }; + Q_ENUM(HelperExitStatus) + +diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp +index c2437c7..b6b5728 100644 +--- a/src/daemon/Display.cpp ++++ b/src/daemon/Display.cpp +@@ -149,10 +149,11 @@ namespace SDDM { + connect(this, &Display::loginFailed, m_socketServer, &SocketServer::loginFailed); + connect(this, &Display::loginSucceeded, m_socketServer, &SocketServer::loginSucceeded); + +- connect(m_greeter, &Greeter::failed, +- QCoreApplication::instance(), [] { +- QCoreApplication::instance()->exit(23); +- }); ++ connect(m_greeter, &Greeter::failed, this, &Display::stop); ++ connect(m_greeter, &Greeter::ttyFailed, this, [this] { ++ VirtualTerminal::jumpToVt(1, true); ++ stop(); ++ }); + connect(m_greeter, &Greeter::displayServerFailed, this, &Display::displayServerFailed); + } + +diff --git a/src/daemon/Greeter.cpp b/src/daemon/Greeter.cpp +index eadae5a..ea9ad81 100644 +--- a/src/daemon/Greeter.cpp ++++ b/src/daemon/Greeter.cpp +@@ -32,6 +32,7 @@ + + #include + #include ++#include + + namespace SDDM { + Greeter::Greeter(Display *parent) +@@ -312,9 +313,9 @@ namespace SDDM { + + if (status == Auth::HELPER_DISPLAYSERVER_ERROR) { + Q_EMIT displayServerFailed(); +- } +- +- if (status == Auth::HELPER_SESSION_ERROR) { ++ } else if (status == Auth::HELPER_TTY_ERROR) { ++ Q_EMIT ttyFailed(); ++ } else if (status == Auth::HELPER_SESSION_ERROR) { + Q_EMIT failed(); + } + } +diff --git a/src/daemon/Greeter.h b/src/daemon/Greeter.h +index 5a69ccd..3a6295c 100644 +--- a/src/daemon/Greeter.h ++++ b/src/daemon/Greeter.h +@@ -62,6 +62,7 @@ namespace SDDM { + void authError(const QString &message, Auth::Error error); + + signals: ++ void ttyFailed(); + void failed(); + void displayServerFailed(); + +diff --git a/src/helper/UserSession.cpp b/src/helper/UserSession.cpp +index 39ff9ad..1bd9959 100644 +--- a/src/helper/UserSession.cpp ++++ b/src/helper/UserSession.cpp +@@ -180,7 +180,7 @@ namespace SDDM { + if (ioctl(STDIN_FILENO, TIOCSCTTY) < 0) { + const auto error = strerror(errno); + qCritical().nospace() << "Failed to take control of " << ttyString << " (" << QFileInfo(ttyString).owner() << "): " << error; +- exit(Auth::HELPER_OTHER_ERROR); ++ exit(Auth::HELPER_TTY_ERROR); + } + } + +-- +2.39.1 + diff --git a/sddm.spec b/sddm.spec index 90ac40a..9980aa7 100644 --- a/sddm.spec +++ b/sddm.spec @@ -20,7 +20,7 @@ Name: sddm Version: 0.19.0%{?commitdate:^git%{commitdate}.%{shortcommit}} -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ Summary: QML based desktop and login manager @@ -46,6 +46,12 @@ Patch11: 0001-Delay-for-logind-and-fallback-to-seat0.patch # Submitted: https://github.com/sddm/sddm/pull/1509 Patch12: sddm-0.20.0-support-non-default-wayland-socket-names.patch +# Allow recovering from tty switching failures +# https://bugzilla.redhat.com/show_bug.cgi?id=2110801 +# https://github.com/sddm/sddm/issues/1636 +# Submitted: https://github.com/sddm/sddm/pull/1641 +Patch13: 0001-Allow-recovering-from-tty-switching-failures.patch + ## downstream patches Patch101: sddm-0.20.0-fedora_config.patch @@ -297,6 +303,9 @@ fi %changelog +* Sun Jan 29 2023 Neal Gompa - 0.19.0^git20221123.3e48649-3 +- Add proposed patch to recover from tty switching failures (#2110801) + * Sat Jan 21 2023 Fedora Release Engineering - 0.19.0^git20221123.3e48649-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild