Hello community, here is the log from the commit of package sddm for openSUSE:Factory checked in at 2020-07-10 14:12:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sddm (Old) and /work/SRC/openSUSE:Factory/.sddm.new.3060 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sddm" Fri Jul 10 14:12:33 2020 rev:50 rq:819685 version:0.18.1 Changes: -------- --- /work/SRC/openSUSE:Factory/sddm/sddm.changes 2020-06-11 14:43:53.189239959 +0200 +++ /work/SRC/openSUSE:Factory/.sddm.new.3060/sddm.changes 2020-07-10 14:12:46.879509730 +0200 @@ -1,0 +2,21 @@ +Tue Jul 7 09:52:20 UTC 2020 - Callum Farmer <callumjfarme...@gmail.com> + +- Fixes for %_libexecdir changing to /usr/libexec + +------------------------------------------------------------------- +Sat Jul 4 12:29:26 UTC 2020 - Fabian Vogt <fab...@ritter-vogt.de> + +- Use pending upstream solution for hostname changes: + * Add 0001-Redesign-Xauth-handling.patch + * Drop sddm-relaxed-auth.patch + * A known issue with the redesigned Xauth handling is that it + leaks the tiny xauth file in XDG_RUNTIME_DIR on session end. + It's on a temporary tmpfs mount though and so shouldn't cause + any visible issues. +- Add patches to fix FD leak: + * 0001-FreeBSD-Link-to-libutil.patch + * 0001-FreeBSD-Split-implementation-of-VT-switching.patch + * 0002-Only-allocate-VTs-for-seat0.patch + * 0003-Move-VT-setup-to-sddm-helper.patch + +------------------------------------------------------------------- Old: ---- sddm-relaxed-auth.patch New: ---- 0001-FreeBSD-Link-to-libutil.patch 0001-FreeBSD-Split-implementation-of-VT-switching.patch 0001-Redesign-Xauth-handling.patch 0002-Only-allocate-VTs-for-seat0.patch 0003-Move-VT-setup-to-sddm-helper.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sddm.spec ++++++ --- /var/tmp/diff_new_pack.B3yXEq/_old 2020-07-10 14:12:47.703512437 +0200 +++ /var/tmp/diff_new_pack.B3yXEq/_new 2020-07-10 14:12:47.703512437 +0200 @@ -1,7 +1,7 @@ # # spec file for package sddm # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,9 +20,9 @@ Version: 0.18.1 Release: 0 Summary: QML-based display manager -License: GPL-2.0+ +License: GPL-2.0-or-later Group: System/GUI/KDE -Url: https://github.com/sddm/sddm +URL: https://github.com/sddm/sddm Source: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.xz Source1: X11-displaymanagers-%{name} Source2: 00-general.conf @@ -31,6 +31,10 @@ # Patch0-100: PATCH-FIX-UPSTREAM # Merged: https://github.com/sddm/sddm/pull/1062 Patch0: 0001-Session-reuse-Only-consider-online-sessions.patch +# Needed by some of the later patches +Patch1: 0001-FreeBSD-Link-to-libutil.patch +Patch2: 0001-FreeBSD-Split-implementation-of-VT-switching.patch +Patch3: 0002-Only-allocate-VTs-for-seat0.patch # Not merged yet: https://github.com/sddm/sddm/pull/997 Patch50: 0001-Remove-suffix-for-Wayland-session.patch # Not merged yet: https://github.com/sddm/sddm/pull/1017 @@ -39,13 +43,14 @@ Patch52: 0001-Revert-Adds-sourcing-of-etc-profile-to-fish.patch # Not merged yet: https://github.com/sddm/sddm/pull/1117 Patch53: 0001-Destroy-the-QLocalServer-in-Auth-on-shutdown.patch +# Not merged yet: https://github.com/sddm/sddm/pull/1230 +Patch55: 0001-Redesign-Xauth-handling.patch +# Not merged yet: https://github.com/sddm/sddm/pull/1273 +Patch56: 0003-Move-VT-setup-to-sddm-helper.patch # Patch100-?: PATCH-FIX-OPENSUSE # Use openSUSE pam config Patch100: proper_pam.diff Patch101: 0001-Write-the-daemon-s-PID-to-a-file-on-startup.patch -# Insert XAUTHLOCALHOSTNAME into users enviroment, so the session handles hostname changes with a single X instance/run -# related patches: libxcb/bug-262309_xcb-xauthlocalhostname.diff, xauth/xauth-tolerant-hostname-changes.diff, kdebase4-workspace/kdm-relaxed-auth.diff -Patch102: sddm-relaxed-auth.patch Patch103: 0001-Read-the-DISPLAYMANAGER_AUTOLOGIN-value-from-sysconf.patch # sddm has some rudimentary support for plymouth handling, which only works with plymouth-quit.service # (the servce is not enabled on openSUSE). For users of sddm.service, we need to issue plymouth quit command by hand in this case @@ -95,8 +100,8 @@ %package branding-openSUSE Summary: openSUSE branding for SDDM, a QML-based display manager Group: System/GUI/KDE -Requires: sddm-theme-openSUSE Requires: %{name} = %{version} +Requires: sddm-theme-openSUSE Requires(post): %{name} Requires(post): diffutils Supplements: packageand(plasma5-workspace:branding-openSUSE) @@ -158,14 +163,14 @@ mv org.freedesktop.DisplayManager.conf sddm_org.freedesktop.DisplayManager.conf popd - install -Dm 0644 %{SOURCE1} %{buildroot}%{_libexecdir}/X11/displaymanagers/%{name} + install -Dm 0644 %{SOURCE1} %{buildroot}%{_prefix}/lib/X11/displaymanagers/%{name} install -Dm 0644 %{SOURCE2} %{buildroot}%{_prefix}/lib/sddm/sddm.conf.d/00-general.conf install -Dm 0644 %{SOURCE3} %{buildroot}%{_prefix}/lib/sddm/sddm.conf.d/10-theme.conf install -Dm 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/sddm.conf mkdir -p %{buildroot}%{_sysconfdir}/alternatives touch %{buildroot}%{_sysconfdir}/alternatives/default-displaymanager - ln -s %{_sysconfdir}/alternatives/default-displaymanager %{buildroot}%{_libexecdir}/X11/displaymanagers/default-displaymanager + ln -s %{_sysconfdir}/alternatives/default-displaymanager %{buildroot}%{_prefix}/lib/X11/displaymanagers/default-displaymanager install -d %{buildroot}%{_rundir}/sddm install -d %{buildroot}%{_localstatedir}/lib/sddm @@ -202,8 +207,8 @@ cmp -s "${tempconf}" "%{_sysconfdir}/sddm.conf" || cp "${tempconf}" "%{_sysconfdir}/sddm.conf" rm "${tempconf}" fi -%{_sbindir}/update-alternatives --install %{_libexecdir}/X11/displaymanagers/default-displaymanager \ - default-displaymanager %{_libexecdir}/X11/displaymanagers/sddm 25 +%{_sbindir}/update-alternatives --install %{_prefix}/lib/X11/displaymanagers/default-displaymanager \ + default-displaymanager %{_prefix}/lib/X11/displaymanagers/sddm 25 %preun %service_del_preun sddm.service @@ -211,8 +216,8 @@ %postun # Don't restart on upgrades (boo#1161826) %service_del_postun -n sddm.service -[ -f %{_libexecdir}/X11/displaymanagers/sddm ] || %{_sbindir}/update-alternatives \ - --remove default-displaymanager %{_libexecdir}/X11/displaymanagers/sddm +[ -f %{_prefix}/lib/X11/displaymanagers/sddm ] || %{_sbindir}/update-alternatives \ + --remove default-displaymanager %{_prefix}/lib/X11/displaymanagers/sddm %post branding-upstream if [ $1 -eq 2 -a -f %{_sysconfdir}/sddm.conf ]; then @@ -255,9 +260,9 @@ %config %{_sysconfdir}/pam.d/sddm-autologin %config %{_sysconfdir}/pam.d/sddm-greeter %config(noreplace) %{_sysconfdir}/dbus-1/system.d/sddm_org.freedesktop.DisplayManager.conf -%dir %{_libexecdir}/X11/displaymanagers/ -%{_libexecdir}/X11/displaymanagers/%{name} -%{_libexecdir}/X11/displaymanagers/default-displaymanager +%dir %{_prefix}/lib/X11/displaymanagers/ +%{_prefix}/lib/X11/displaymanagers/%{name} +%{_prefix}/lib/X11/displaymanagers/default-displaymanager %ghost %{_sysconfdir}/alternatives/default-displaymanager %{_bindir}/sddm %{_bindir}/sddm-greeter @@ -267,6 +272,7 @@ %dir %{_prefix}/lib/sddm/ %dir %{_prefix}/lib/sddm/sddm.conf.d/ %{_prefix}/lib/sddm/sddm.conf.d/00-general.conf +%dir %{_libexecdir}/sddm %{_libexecdir}/sddm/sddm-helper %{_datadir}/sddm/faces/ %{_datadir}/sddm/flags/ ++++++ 0001-FreeBSD-Link-to-libutil.patch ++++++ >From 91854b1db39e29db1d6668fbb807b1f7c0a09c2b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot <gr...@kde.org> Date: Sat, 9 Mar 2019 13:59:00 -0500 Subject: [PATCH] (FreeBSD) Link to libutil This is preparatory work: the sddm-helper is going to need libutil for setusercontext(), which handles integration with login.conf and per-user configurations (e.g. language settings, CPU affinity and resource limits). --- src/helper/CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt index ebf4a6e..9fe9278 100644 --- a/src/helper/CMakeLists.txt +++ b/src/helper/CMakeLists.txt @@ -1,3 +1,5 @@ +include(CheckLibraryExists) + include_directories( "${CMAKE_SOURCE_DIR}/src/common" "${CMAKE_SOURCE_DIR}/src/auth" @@ -32,6 +34,18 @@ endif() add_executable(sddm-helper ${HELPER_SOURCES}) target_link_libraries(sddm-helper Qt5::Network Qt5::DBus Qt5::Qml) +if("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") + # On FreeBSD (possibly other BSDs as well), we want to use + # setusercontext() to set up the login configuration from login.conf + find_library(_have_libutil util) + if(_have_libutil) + check_library_exists(${_have_libutil} setusercontext "" _have_setusercontext) + endif() + if(_have_libutil AND _have_setusercontext) + target_link_libraries(sddm-helper ${_have_libutil}) + endif() +endif() + if(PAM_FOUND) target_link_libraries(sddm-helper ${PAM_LIBRARIES}) else() -- 2.23.0 ++++++ 0001-FreeBSD-Split-implementation-of-VT-switching.patch ++++++ >From 026d6682815e09311a1b7b0410b56e5ccce5f705 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot <gr...@kde.org> Date: Mon, 10 Sep 2018 13:52:50 +0200 Subject: [PATCH 1/3] (FreeBSD) Split implementation of VT switching - FreeBSD (obviously) doesn't have linux/vt.h, so it needs a different VT-switching implementation. Add a stub-file to do that -- the current implementation does nothing, which is what downstream patches effectively do by commenting out the relevant calls. --- src/daemon/CMakeLists.txt | 9 ++++++- src/daemon/VirtualTerminal_FreeBSD.cpp | 37 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/daemon/VirtualTerminal_FreeBSD.cpp diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt index 09abc79..a175176 100644 --- a/src/daemon/CMakeLists.txt +++ b/src/daemon/CMakeLists.txt @@ -31,9 +31,16 @@ set(DAEMON_SOURCES SeatManager.cpp SignalHandler.cpp SocketServer.cpp - VirtualTerminal.cpp ) +# Different implementations of the VT switching code +# (where the FreeBSD version does nothing). +if(${CMAKE_SYSTEM} MATCHES "FreeBSD") + list(APPEND DAEMON_SOURCES VirtualTerminal_FreeBSD.cpp) +else() + list(APPEND DAEMON_SOURCES VirtualTerminal.cpp) +endif() + qt5_add_dbus_adaptor(DAEMON_SOURCES "${CMAKE_SOURCE_DIR}/data/interfaces/org.freedesktop.DisplayManager.xml" "DisplayManager.h" SDDM::DisplayManager) qt5_add_dbus_adaptor(DAEMON_SOURCES "${CMAKE_SOURCE_DIR}/data/interfaces/org.freedesktop.DisplayManager.Seat.xml" "DisplayManager.h" SDDM::DisplayManagerSeat) qt5_add_dbus_adaptor(DAEMON_SOURCES "${CMAKE_SOURCE_DIR}/data/interfaces/org.freedesktop.DisplayManager.Session.xml" "DisplayManager.h" SDDM::DisplayManagerSession) diff --git a/src/daemon/VirtualTerminal_FreeBSD.cpp b/src/daemon/VirtualTerminal_FreeBSD.cpp new file mode 100644 index 0000000..aaf1b61 --- /dev/null +++ b/src/daemon/VirtualTerminal_FreeBSD.cpp @@ -0,0 +1,37 @@ +/*************************************************************************** +* Copyright (c) 2015 Pier Luigi Fiorini <pierluigi.fior...@gmail.com> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the +* Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +***************************************************************************/ + +#include <QDebug> +#include <QString> + +#include "VirtualTerminal.h" + + +namespace SDDM { + namespace VirtualTerminal { + int setUpNewVt() { + qDebug() << "New VT is unsupported on FreeBSD"; + return -1; + } + + void jumpToVt(int vt, bool vt_auto) { + qDebug() << "Jumping to VT" << vt << "is unsupported on FreeBSD"; + } + } +} -- 2.25.1 ++++++ 0001-Redesign-Xauth-handling.patch ++++++ ++++ 609 lines (skipped) ++++++ 0002-Only-allocate-VTs-for-seat0.patch ++++++ >From ec310cbe342ee492b78578db846ca18ef288b0a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= <laercioso...@sme-mogidascruzes.sp.gov.br> Date: Tue, 23 Jul 2019 16:27:17 -0300 Subject: [PATCH 2/3] Only allocate VTs for seat0 --- src/daemon/Display.cpp | 26 ++++++++++++++------------ src/daemon/Greeter.cpp | 3 ++- src/daemon/Seat.cpp | 28 +++++++++++++++++----------- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp index c2ea728..6cd8fd6 100644 --- a/src/daemon/Display.cpp +++ b/src/daemon/Display.cpp @@ -308,13 +308,17 @@ namespace SDDM { // some information qDebug() << "Session" << m_sessionName << "selected, command:" << session.exec(); + QProcessEnvironment env; + // create new VT for Wayland sessions otherwise use greeter vt - int vt = terminalId(); - if (session.xdgSessionType() == QLatin1String("wayland")) - vt = VirtualTerminal::setUpNewVt(); - m_lastSession.setVt(vt); + if (seat()->name() == QLatin1String("seat0")) { + int vt = terminalId(); + if (session.xdgSessionType() == QLatin1String("wayland")) + vt = VirtualTerminal::setUpNewVt(); + m_lastSession.setVt(vt); + env.insert(QStringLiteral("XDG_VTNR"), QString::number(vt)); + } - QProcessEnvironment env; env.insert(QStringLiteral("PATH"), mainConfig.Users.DefaultPath.get()); if (session.xdgSessionType() == QLatin1String("x11")) env.insert(QStringLiteral("DISPLAY"), name()); @@ -325,11 +329,7 @@ namespace SDDM { env.insert(QStringLiteral("XDG_SESSION_CLASS"), QStringLiteral("user")); env.insert(QStringLiteral("XDG_SESSION_TYPE"), session.xdgSessionType()); env.insert(QStringLiteral("XDG_SEAT"), seat()->name()); - env.insert(QStringLiteral("XDG_SESSION_DESKTOP"), session.desktopNames()); - if (seat()->name() == QLatin1String("seat0")) { - env.insert(QStringLiteral("XDG_VTNR"), QString::number(vt)); - } m_auth->insertEnvironment(env); @@ -364,9 +364,11 @@ namespace SDDM { stateConfig.save(); // switch to the new VT for Wayland sessions - if (m_lastSession.xdgSessionType() == QLatin1String("wayland")) - // set vt_auto to false, so handle the vt switch yourself (VT_PROCESS) - VirtualTerminal::jumpToVt(m_lastSession.vt(), false); + if (seat()->name() == QLatin1String("seat0")) { + if (m_lastSession.xdgSessionType() == QLatin1String("wayland")) + // set vt_auto to false, so handle the vt switch yourself (VT_PROCESS) + VirtualTerminal::jumpToVt(m_lastSession.vt(), false); + } if (m_socket) emit loginSucceeded(m_socket); diff --git a/src/daemon/Greeter.cpp b/src/daemon/Greeter.cpp index 11ec19d..ed7983e 100644 --- a/src/daemon/Greeter.cpp +++ b/src/daemon/Greeter.cpp @@ -179,7 +179,8 @@ namespace SDDM { env.insert(QStringLiteral("XDG_SEAT"), m_display->seat()->name()); env.insert(QStringLiteral("XDG_SEAT_PATH"), daemonApp->displayManager()->seatPath(m_display->seat()->name())); env.insert(QStringLiteral("XDG_SESSION_PATH"), daemonApp->displayManager()->sessionPath(QStringLiteral("Session%1").arg(daemonApp->newSessionId()))); - env.insert(QStringLiteral("XDG_VTNR"), QString::number(m_display->terminalId())); + if (m_display->seat()->name() == QLatin1String("seat0")) + env.insert(QStringLiteral("XDG_VTNR"), QString::number(m_display->terminalId())); env.insert(QStringLiteral("XDG_SESSION_CLASS"), QStringLiteral("greeter")); env.insert(QStringLiteral("XDG_SESSION_TYPE"), m_display->sessionType()); env.insert(QStringLiteral("QT_IM_MODULE"), mainConfig.InputMethod.get()); diff --git a/src/daemon/Seat.cpp b/src/daemon/Seat.cpp index 8aef2cd..d0e9dde 100644 --- a/src/daemon/Seat.cpp +++ b/src/daemon/Seat.cpp @@ -55,19 +55,24 @@ namespace SDDM { void Seat::createDisplay(int terminalId) { //reload config if needed mainConfig.load(); - - if (terminalId == -1) { + + if (m_name == QLatin1String("seat0")) { + if (terminalId == -1) { // find unused terminal - terminalId = findUnused(mainConfig.X11.MinimumVT.get(), [&](const int number) { - return m_terminalIds.contains(number); - }); - } + terminalId = findUnused(mainConfig.X11.MinimumVT.get(), [&](const int number) { + return m_terminalIds.contains(number); + }); + } - // mark terminal as used - m_terminalIds << terminalId; + // mark terminal as used + m_terminalIds << terminalId; - // log message - qDebug() << "Adding new display" << "on vt" << terminalId << "..."; + // log message + qDebug() << "Adding new display" << "on vt" << terminalId << "..."; + } + else { + qDebug() << "Adding new VT-less display..."; + } // create a new display Display *display = new Display(terminalId, this); @@ -117,7 +122,8 @@ namespace SDDM { // vt switch automatically (VT_AUTO). else { int disp = m_displays.last()->terminalId(); - VirtualTerminal::jumpToVt(disp, true); + if (disp != -1) + VirtualTerminal::jumpToVt(disp, true); } } } -- 2.25.1 ++++++ 0003-Move-VT-setup-to-sddm-helper.patch ++++++ >From 44de02bcf7ab3dfe385f2bf531285e4927e38ac1 Mon Sep 17 00:00:00 2001 From: Fabian Vogt <fab...@ritter-vogt.de> Date: Sun, 5 Jul 2020 17:45:35 +0200 Subject: [PATCH 3/3] Move VT setup to sddm-helper Previously, sddm set up the virtual terminal and jumped to it and after that, sddm-helper opens it again and takes control of it. This only worked because sddm leaked the terminal fd into sddm-helper. The right way is to set up the virtual terminal and take control of it before jumping to it. This is achieved by moving this responsibility to sddm-helper. As the race is now fixed, also avoid leaking FDs in jumpToVt now. Fixes #1078 Fixes #1083 --- src/common/Session.cpp | 10 ---------- src/common/Session.h | 4 ---- src/{daemon => common}/VirtualTerminal.cpp | 2 ++ src/{daemon => common}/VirtualTerminal.h | 0 .../VirtualTerminal_FreeBSD.cpp | 0 src/daemon/CMakeLists.txt | 4 ++-- src/daemon/Display.cpp | 18 +++--------------- src/helper/CMakeLists.txt | 8 ++++++++ src/helper/HelperApp.cpp | 6 ++++++ src/helper/UserSession.cpp | 6 +++++- 10 files changed, 26 insertions(+), 32 deletions(-) rename src/{daemon => common}/VirtualTerminal.cpp (99%) rename src/{daemon => common}/VirtualTerminal.h (100%) rename src/{daemon => common}/VirtualTerminal_FreeBSD.cpp (100%) diff --git a/src/common/Session.cpp b/src/common/Session.cpp index aa4dad3..2d49430 100644 --- a/src/common/Session.cpp +++ b/src/common/Session.cpp @@ -52,16 +52,6 @@ namespace SDDM { return m_type; } - int Session::vt() const - { - return m_vt; - } - - void Session::setVt(int vt) - { - m_vt = vt; - } - QString Session::xdgSessionType() const { return m_xdgSessionType; diff --git a/src/common/Session.h b/src/common/Session.h index d285a3f..9fd86cd 100644 --- a/src/common/Session.h +++ b/src/common/Session.h @@ -42,9 +42,6 @@ namespace SDDM { Type type() const; - int vt() const; - void setVt(int vt); - QString xdgSessionType() const; QDir directory() const; @@ -69,7 +66,6 @@ namespace SDDM { private: bool m_valid; Type m_type; - int m_vt; QDir m_dir; QString m_name; QString m_fileName; diff --git a/src/daemon/VirtualTerminal.cpp b/src/common/VirtualTerminal.cpp similarity index 99% rename from src/daemon/VirtualTerminal.cpp rename to src/common/VirtualTerminal.cpp index 196e387..4607c50 100644 --- a/src/daemon/VirtualTerminal.cpp +++ b/src/common/VirtualTerminal.cpp @@ -187,6 +187,8 @@ out: qWarning("Couldn't finalize jump to VT %d: %s", vt, strerror(errno)); close(activeVtFd); + if (fd != activeVtFd) + close(fd); } } } diff --git a/src/daemon/VirtualTerminal.h b/src/common/VirtualTerminal.h similarity index 100% rename from src/daemon/VirtualTerminal.h rename to src/common/VirtualTerminal.h diff --git a/src/daemon/VirtualTerminal_FreeBSD.cpp b/src/common/VirtualTerminal_FreeBSD.cpp similarity index 100% rename from src/daemon/VirtualTerminal_FreeBSD.cpp rename to src/common/VirtualTerminal_FreeBSD.cpp diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt index a175176..9145607 100644 --- a/src/daemon/CMakeLists.txt +++ b/src/daemon/CMakeLists.txt @@ -36,9 +36,9 @@ set(DAEMON_SOURCES # Different implementations of the VT switching code # (where the FreeBSD version does nothing). if(${CMAKE_SYSTEM} MATCHES "FreeBSD") - list(APPEND DAEMON_SOURCES VirtualTerminal_FreeBSD.cpp) + list(APPEND DAEMON_SOURCES ${CMAKE_SOURCE_DIR}/src/common/VirtualTerminal_FreeBSD.cpp) else() - list(APPEND DAEMON_SOURCES VirtualTerminal.cpp) + list(APPEND DAEMON_SOURCES ${CMAKE_SOURCE_DIR}/src/common/VirtualTerminal.cpp) endif() qt5_add_dbus_adaptor(DAEMON_SOURCES "${CMAKE_SOURCE_DIR}/data/interfaces/org.freedesktop.DisplayManager.xml" "DisplayManager.h" SDDM::DisplayManager) diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp index 6cd8fd6..6a2c9a6 100644 --- a/src/daemon/Display.cpp +++ b/src/daemon/Display.cpp @@ -30,7 +30,6 @@ #include "Greeter.h" #include "Utils.h" #include "SignalHandler.h" -#include "VirtualTerminal.h" #include <QDebug> #include <QFile> @@ -310,14 +309,10 @@ namespace SDDM { QProcessEnvironment env; - // create new VT for Wayland sessions otherwise use greeter vt if (seat()->name() == QLatin1String("seat0")) { - int vt = terminalId(); - if (session.xdgSessionType() == QLatin1String("wayland")) - vt = VirtualTerminal::setUpNewVt(); - m_lastSession.setVt(vt); - env.insert(QStringLiteral("XDG_VTNR"), QString::number(vt)); - } + // Use the greeter VT, for wayland sessions the helper overwrites this + env.insert(QStringLiteral("XDG_VTNR"), QString::number(terminalId())); + } env.insert(QStringLiteral("PATH"), mainConfig.Users.DefaultPath.get()); if (session.xdgSessionType() == QLatin1String("x11")) @@ -363,13 +358,6 @@ namespace SDDM { stateConfig.Last.Session.setDefault(); stateConfig.save(); - // switch to the new VT for Wayland sessions - if (seat()->name() == QLatin1String("seat0")) { - if (m_lastSession.xdgSessionType() == QLatin1String("wayland")) - // set vt_auto to false, so handle the vt switch yourself (VT_PROCESS) - VirtualTerminal::jumpToVt(m_lastSession.vt(), false); - } - if (m_socket) emit loginSucceeded(m_socket); } else if (m_socket) { diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt index 3dce2ab..81b939b 100644 --- a/src/helper/CMakeLists.txt +++ b/src/helper/CMakeLists.txt @@ -17,6 +17,14 @@ set(HELPER_SOURCES UserSession.cpp ) +# Different implementations of the VT switching code +# (where the FreeBSD version does nothing). +if(${CMAKE_SYSTEM} MATCHES "FreeBSD") + list(APPEND HELPER_SOURCES ${CMAKE_SOURCE_DIR}/src/common/VirtualTerminal_FreeBSD.cpp) +else() + list(APPEND HELPER_SOURCES ${CMAKE_SOURCE_DIR}/src/common/VirtualTerminal.cpp) +endif() + if(PAM_FOUND) set(HELPER_SOURCES ${HELPER_SOURCES} diff --git a/src/helper/HelperApp.cpp b/src/helper/HelperApp.cpp index 13ccdfa..33853f5 100644 --- a/src/helper/HelperApp.cpp +++ b/src/helper/HelperApp.cpp @@ -24,6 +24,7 @@ #include "SafeDataStream.h" #include "MessageHandler.h" +#include "VirtualTerminal.h" #include <QtCore/QTimer> #include <QtCore/QFile> @@ -148,6 +149,11 @@ namespace SDDM { if (!m_session->path().isEmpty()) { env.insert(m_session->processEnvironment()); + // Allocate a new VT for the wayland session + if(env.value(QStringLiteral("XDG_SESSION_TYPE")) == QLatin1String("wayland")) { + int vtNumber = VirtualTerminal::setUpNewVt(); + env.insert(QStringLiteral("XDG_VTNR"), QString::number(vtNumber)); + } m_session->setProcessEnvironment(env); if (!m_backend->openSession()) { diff --git a/src/helper/UserSession.cpp b/src/helper/UserSession.cpp index 5e9ac6a..89d659f 100644 --- a/src/helper/UserSession.cpp +++ b/src/helper/UserSession.cpp @@ -23,6 +23,7 @@ #include "UserSession.h" #include "HelperApp.h" #include "XauthUtils.h" +#include "VirtualTerminal.h" #include <sys/types.h> #include <sys/ioctl.h> @@ -82,7 +83,8 @@ namespace SDDM { // that it stays open without races if (sessionType == QLatin1String("wayland")) { // open VT and get the fd - QString ttyString = QStringLiteral("/dev/tty%1").arg(processEnvironment().value(QStringLiteral("XDG_VTNR"))); + int vtNumber = processEnvironment().value(QStringLiteral("XDG_VTNR")).toInt(); + QString ttyString = QStringLiteral("/dev/tty%1").arg(vtNumber); int vtFd = ::open(qPrintable(ttyString), O_RDWR | O_NOCTTY); // when this is true we'll take control of the tty @@ -112,6 +114,8 @@ namespace SDDM { exit(Auth::HELPER_OTHER_ERROR); } } + + VirtualTerminal::jumpToVt(vtNumber, false); } #ifdef Q_OS_LINUX -- 2.25.1