diff --git a/abi_used_symbols b/abi_used_symbols --- a/abi_used_symbols +++ b/abi_used_symbols @@ -147,6 +147,7 @@ libQt5Core.so.5:_ZN6QEventC2ENS_4TypeE libQt5Core.so.5:_ZN6QEventD2Ev libQt5Core.so.5:_ZN6QTimer10singleShotEiPK7QObjectPKc +libQt5Core.so.5:_ZN6QTimer14singleShotImplEiN2Qt9TimerTypeEPK7QObjectPN9QtPrivate15QSlotObjectBaseE libQt5Core.so.5:_ZN7QLocale6systemEv libQt5Core.so.5:_ZN7QLocaleD1Ev libQt5Core.so.5:_ZN7QObject10childEventEP11QChildEvent @@ -189,8 +190,10 @@ libQt5Core.so.5:_ZN7QString7replaceERKS_S1_N2Qt15CaseSensitivityE libQt5Core.so.5:_ZN7QStringaSE13QLatin1String libQt5Core.so.5:_ZN7QStringaSERKS_ +libQt5Core.so.5:_ZN8QProcess10setProgramERK7QString libQt5Core.so.5:_ZN8QProcess11qt_metacallEN11QMetaObject4CallEiPPv libQt5Core.so.5:_ZN8QProcess11qt_metacastEPKc +libQt5Core.so.5:_ZN8QProcess12setArgumentsERK11QStringList libQt5Core.so.5:_ZN8QProcess14waitForStartedEi libQt5Core.so.5:_ZN8QProcess15waitForFinishedEi libQt5Core.so.5:_ZN8QProcess16staticMetaObjectE @@ -206,6 +209,7 @@ libQt5Core.so.5:_ZN8QProcess4openE6QFlagsIN9QIODevice12OpenModeFlagEE libQt5Core.so.5:_ZN8QProcess5closeEv libQt5Core.so.5:_ZN8QProcess5errorENS_12ProcessErrorE +libQt5Core.so.5:_ZN8QProcess5startE6QFlagsIN9QIODevice12OpenModeFlagEE libQt5Core.so.5:_ZN8QProcess5startERK7QString6QFlagsIN9QIODevice12OpenModeFlagEE libQt5Core.so.5:_ZN8QProcess5startERK7QStringRK11QStringList6QFlagsIN9QIODevice12OpenModeFlagEE libQt5Core.so.5:_ZN8QProcess7executeERK7QString @@ -361,6 +365,8 @@ libQt5Core.so.5:_ZNK8QProcess18processEnvironmentEv libQt5Core.so.5:_ZNK8QProcess5atEndEv libQt5Core.so.5:_ZNK8QProcess5stateEv +libQt5Core.so.5:_ZNK8QProcess7programEv +libQt5Core.so.5:_ZNK8QProcess9argumentsEv libQt5Core.so.5:_ZNK8QProcess9processIdEv libQt5Core.so.5:_ZNK8QVariant5toIntEPb libQt5Core.so.5:_ZNK8QVariant6toBoolEv @@ -549,6 +555,7 @@ libc.so.6:__errno_location libc.so.6:__fprintf_chk libc.so.6:__libc_current_sigrtmax +libc.so.6:__libc_single_threaded libc.so.6:__libc_start_main libc.so.6:__printf_chk libc.so.6:__snprintf_chk @@ -637,7 +644,6 @@ libstdc++.so.6:__cxa_guard_abort libstdc++.so.6:__cxa_guard_acquire libstdc++.so.6:__cxa_guard_release -libstdc++.so.6:__cxa_pure_virtual libstdc++.so.6:__cxa_rethrow libstdc++.so.6:__cxa_throw_bad_array_new_length libstdc++.so.6:__gxx_personality_v0 diff --git a/files/merge-paths-in-xorgdisplayserver.patch b/files/merge-paths-in-xorgdisplayserver.patch new file mode 100644 --- /dev/null +++ b/files/merge-paths-in-xorgdisplayserver.patch @@ -0,0 +1,171 @@ +From 68cc9e31d1a4c4609f42114782fc485cb07353a4 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Fri, 9 Oct 2020 21:06:01 +0200 +Subject: [PATCH] Merge normal and testing paths in XorgDisplayServer::start + +They have much in common and this means that Xephyr can also make use use +of -displayfd now. +--- + src/daemon/XorgDisplayServer.cpp | 132 ++++++++++++++----------------- + 1 file changed, 60 insertions(+), 72 deletions(-) + +diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp +index d5f29a94..e60c0221 100644 +--- a/src/daemon/XorgDisplayServer.cpp ++++ b/src/daemon/XorgDisplayServer.cpp +@@ -136,95 +136,83 @@ namespace SDDM { + return false; + } + +- if (daemonApp->testing()) { +- QStringList args; +- QDir x11socketDir(QStringLiteral("/tmp/.X11-unix")); +- int display = 100; +- while (x11socketDir.exists(QStringLiteral("X%1").arg(display))) { +- ++display; +- } +- m_display = QStringLiteral(":%1").arg(display); +- args << m_display << QStringLiteral("-auth") << m_authPath << QStringLiteral("-br") << QStringLiteral("-noreset") << QStringLiteral("-screen") << QStringLiteral("800x600"); +- process->start(mainConfig.X11.XephyrPath.get(), args); +- +- +- // wait for display server to start +- if (!process->waitForStarted()) { +- // log message +- qCritical() << "Failed to start display server process."; ++ // set process environment ++ QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); ++ env.insert(QStringLiteral("XCURSOR_THEME"), mainConfig.Theme.CursorTheme.get()); ++ process->setProcessEnvironment(env); + +- // return fail +- return false; +- } +- emit started(); +- } else { +- // set process environment +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert(QStringLiteral("XCURSOR_THEME"), mainConfig.Theme.CursorTheme.get()); +- process->setProcessEnvironment(env); +- +- //create pipe for communicating with X server +- //0 == read from X, 1== write to from X +- int pipeFds[2]; +- if (pipe(pipeFds) != 0) { +- qCritical("Could not create pipe to start X server"); +- } ++ //create pipe for communicating with X server ++ //0 == read from X, 1== write to from X ++ int pipeFds[2]; ++ if (pipe(pipeFds) != 0) { ++ qCritical("Could not create pipe to start X server"); ++ } + +- // start display server +- QStringList args = mainConfig.X11.ServerArguments.get().split(QLatin1Char(' '), QString::SkipEmptyParts); +- args << QStringLiteral("-auth") << m_authPath ++ // start display server ++ QStringList args; ++ if (!daemonApp->testing()) { ++ process->setProgram(mainConfig.X11.ServerPath.get()); ++ args << mainConfig.X11.ServerArguments.get().split(QLatin1Char(' '), QString::SkipEmptyParts) + << QStringLiteral("-background") << QStringLiteral("none") +- << QStringLiteral("-noreset") +- << QStringLiteral("-displayfd") << QString::number(pipeFds[1]) + << QStringLiteral("-seat") << displayPtr()->seat()->name(); + + if (displayPtr()->seat()->name() == QLatin1String("seat0")) { + args << QStringLiteral("vt%1").arg(displayPtr()->terminalId()); + } +- qDebug() << "Running:" +- << qPrintable(mainConfig.X11.ServerPath.get()) +- << qPrintable(args.join(QLatin1Char(' '))); +- process->start(mainConfig.X11.ServerPath.get(), args); +- +- // wait for display server to start +- if (!process->waitForStarted()) { +- // log message +- qCritical() << "Failed to start display server process."; +- +- // return fail +- close(pipeFds[0]); +- return false; +- } ++ } else { ++ process->setProgram(mainConfig.X11.XephyrPath.get()); ++ args << QStringLiteral("-br") ++ << QStringLiteral("-screen") << QStringLiteral("800x600"); ++ } + +- // close the other side of pipe in our process, otherwise reading +- // from it may stuck even X server exit. +- close(pipeFds[1]); ++ args << QStringLiteral("-auth") << m_authPath ++ << QStringLiteral("-noreset") ++ << QStringLiteral("-displayfd") << QString::number(pipeFds[1]); + +- QFile readPipe; ++ process->setArguments(args); ++ qDebug() << "Running:" ++ << qPrintable(process->program()) ++ << qPrintable(process->arguments().join(QLatin1Char(' '))); ++ process->start(); + +- if (!readPipe.open(pipeFds[0], QIODevice::ReadOnly)) { +- qCritical("Failed to open pipe to start X Server"); ++ // wait for display server to start ++ if (!process->waitForStarted()) { ++ // log message ++ qCritical() << "Failed to start display server process."; + +- close(pipeFds[0]); +- return false; +- } +- QByteArray displayNumber = readPipe.readLine(); +- if (displayNumber.size() < 2) { +- // X server gave nothing (or a whitespace). +- qCritical("Failed to read display number from pipe"); ++ // return fail ++ close(pipeFds[0]); ++ return false; ++ } + +- close(pipeFds[0]); +- return false; +- } +- displayNumber.prepend(QByteArray(":")); +- displayNumber.remove(displayNumber.size() -1, 1); // trim trailing whitespace +- m_display = QString::fromLocal8Bit(displayNumber); ++ // close the other side of pipe in our process, otherwise reading ++ // from it may stuck even X server exit. ++ close(pipeFds[1]); ++ ++ QFile readPipe; ++ ++ if (!readPipe.open(pipeFds[0], QIODevice::ReadOnly)) { ++ qCritical("Failed to open pipe to start X Server"); + +- // close our pipe + close(pipeFds[0]); ++ return false; ++ } ++ QByteArray displayNumber = readPipe.readLine(); ++ if (displayNumber.size() < 2) { ++ // X server gave nothing (or a whitespace). ++ qCritical("Failed to read display number from pipe"); + +- emit started(); ++ close(pipeFds[0]); ++ return false; + } ++ displayNumber.prepend(QByteArray(":")); ++ displayNumber.remove(displayNumber.size() -1, 1); // trim trailing whitespace ++ m_display = QString::fromLocal8Bit(displayNumber); ++ ++ // close our pipe ++ close(pipeFds[0]); ++ ++ emit started(); + + // The file is also used by the greeter, which does care about the + // display number. Write the proper entry, if it's different. diff --git a/files/retry-starting-display-server.patch b/files/retry-starting-display-server.patch new file mode 100644 --- /dev/null +++ b/files/retry-starting-display-server.patch @@ -0,0 +1,212 @@ +From adfaa222fdfa6115ea2b320b0bbc2126db9270a5 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Thu, 12 Nov 2020 20:30:55 +0100 +Subject: [PATCH 1/3] Retry starting the display server + +Even if the CanGraphical property of a Seat is true, it's possible that it's +still too early for X to start, as it might need some driver or device which +isn't present yet. + +Fixes #1316 +--- + src/daemon/Seat.cpp | 23 ++++++++++++++++++----- + src/daemon/Seat.h | 4 +++- + src/daemon/XorgDisplayServer.cpp | 10 ++++++---- + 3 files changed, 27 insertions(+), 10 deletions(-) + +diff --git a/src/daemon/Seat.cpp b/src/daemon/Seat.cpp +index eef26da4..838c2221 100644 +--- a/src/daemon/Seat.cpp ++++ b/src/daemon/Seat.cpp +@@ -28,6 +28,7 @@ + + #include + #include ++#include + + #include + +@@ -52,7 +53,7 @@ namespace SDDM { + return m_name; + } + +- bool Seat::createDisplay(int terminalId) { ++ void Seat::createDisplay(int terminalId) { + //reload config if needed + mainConfig.load(); + +@@ -84,12 +85,24 @@ namespace SDDM { + m_displays << display; + + // start the display +- if (!display->start()) { +- qCritical() << "Could not start Display server on vt" << terminalId; +- return false; ++ startDisplay(display); ++ } ++ ++ void Seat::startDisplay(Display *display, int tryNr) { ++ if (display->start()) ++ return; ++ ++ // It's possible that the system isn't ready yet (driver not loaded, ++ // device not enumerated, ...). It's not possible to tell when that changes, ++ // so try a few times with a delay in between. ++ qWarning() << "Attempt" << tryNr << "starting the Display server on vt" << display->terminalId() << "failed"; ++ ++ if(tryNr >= 3) { ++ qCritical() << "Could not start Display server on vt" << display->terminalId(); ++ return; + } + +- return true; ++ QTimer::singleShot(2000, display, [=] { startDisplay(display, tryNr + 1); }); + } + + void Seat::removeDisplay(Display* display) { +diff --git a/src/daemon/Seat.h b/src/daemon/Seat.h +index bf22566b..f9fe7331 100644 +--- a/src/daemon/Seat.h ++++ b/src/daemon/Seat.h +@@ -35,13 +35,15 @@ namespace SDDM { + const QString &name() const; + + public slots: +- bool createDisplay(int terminalId = -1); ++ void createDisplay(int terminalId = -1); + void removeDisplay(SDDM::Display* display); + + private slots: + void displayStopped(); + + private: ++ void startDisplay(SDDM::Display *display, int tryNr = 1); ++ + QString m_name; + + QVector m_displays; +diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp +index e60c0221..5f40fe8c 100644 +--- a/src/daemon/XorgDisplayServer.cpp ++++ b/src/daemon/XorgDisplayServer.cpp +@@ -248,6 +248,12 @@ namespace SDDM { + } + + void XorgDisplayServer::finished() { ++ // clean up ++ if (process) { ++ process->deleteLater(); ++ process = nullptr; ++ } ++ + // check flag + if (!m_started) + return; +@@ -283,10 +289,6 @@ namespace SDDM { + displayStopScript->deleteLater(); + displayStopScript = nullptr; + +- // clean up +- process->deleteLater(); +- process = nullptr; +- + // remove authority file + QFile::remove(m_authPath); + + +From d11e1e987b440fa1aaa741719b92472eeee79b17 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 9 Dec 2020 19:28:41 +0100 +Subject: [PATCH 2/3] Explicitly stop Xorg when starting fails + +When Xorg starts but there is an error, stop it explicitly instead of assuming +that X exits itself. This avoids a possibly lingering Xorg process in the +XorgDisplayServer instance. Add a check and warning message if Xorg is +restarted too early (shouldn't happen). +--- + src/daemon/XorgDisplayServer.cpp | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp +index 5f40fe8c..3a7bee0d 100644 +--- a/src/daemon/XorgDisplayServer.cpp ++++ b/src/daemon/XorgDisplayServer.cpp +@@ -118,6 +118,11 @@ namespace SDDM { + if (m_started) + return false; + ++ if (process) { ++ qCritical() << "Tried to start Xorg before previous instance exited"; ++ return false; ++ } ++ + // create process + process = new QProcess(this); + +@@ -195,6 +200,7 @@ namespace SDDM { + qCritical("Failed to open pipe to start X Server"); + + close(pipeFds[0]); ++ stop(); + return false; + } + QByteArray displayNumber = readPipe.readLine(); +@@ -203,6 +209,7 @@ namespace SDDM { + qCritical("Failed to read display number from pipe"); + + close(pipeFds[0]); ++ stop(); + return false; + } + displayNumber.prepend(QByteArray(":")); +@@ -219,6 +226,7 @@ namespace SDDM { + if(m_display != QStringLiteral(":0")) { + if(!addCookie(m_authPath)) { + qCritical() << "Failed to write xauth file"; ++ stop(); + return false; + } + } +@@ -232,8 +240,7 @@ namespace SDDM { + } + + void XorgDisplayServer::stop() { +- // check flag +- if (!m_started) ++ if (!process) + return; + + // log message + +From 78048b22e3988d3daec9c271883fa114abc114dc Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 9 Dec 2020 19:33:08 +0100 +Subject: [PATCH 3/3] Emit XorgDisplayServer::started only when the auth file + is ready + +--- + src/daemon/XorgDisplayServer.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp +index 3a7bee0d..331adcda 100644 +--- a/src/daemon/XorgDisplayServer.cpp ++++ b/src/daemon/XorgDisplayServer.cpp +@@ -219,8 +219,6 @@ namespace SDDM { + // close our pipe + close(pipeFds[0]); + +- emit started(); +- + // The file is also used by the greeter, which does care about the + // display number. Write the proper entry, if it's different. + if(m_display != QStringLiteral(":0")) { +@@ -232,6 +230,8 @@ namespace SDDM { + } + changeOwner(m_authPath); + ++ emit started(); ++ + // set flag + m_started = true; + diff --git a/files/sddm-fix-build.patch b/files/sddm-fix-build.patch new file mode 100644 --- /dev/null +++ b/files/sddm-fix-build.patch @@ -0,0 +1,13 @@ +diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp +index 5f93a1b..d5f29a9 100644 +--- a/src/daemon/XorgDisplayServer.cpp ++++ b/src/daemon/XorgDisplayServer.cpp +@@ -65,7 +65,7 @@ namespace SDDM { + // create a random hexadecimal number + const char *digits = "0123456789abcdef"; + for (int i = 0; i < 32; ++i) +- m_cookie[i] = digits[dis(gen)]; ++ m_cookie[i] = QLatin1Char(digits[dis(gen)]); + } + + XorgDisplayServer::~XorgDisplayServer() { diff --git a/files/series b/files/series --- a/files/series +++ b/files/series @@ -2,3 +2,6 @@ 0001-Use-Solus-defaults.patch 0002-Fix-session-started-as-the-wrong-type-on-autologin.patch 0002-Fix-zsh-for-solus.patch +merge-paths-in-xorgdisplayserver.patch +retry-starting-display-server.patch +sddm-fix-build.patch diff --git a/package.yml b/package.yml --- a/package.yml +++ b/package.yml @@ -1,6 +1,6 @@ name : sddm version : 0.19.0 -release : 28 +release : 29 source : - https://github.com/sddm/sddm/archive/refs/tags/v0.19.0.tar.gz : e76da1f13d5ad5e0179e3fec57543126044339405ef19c397e105e0807bd4e41 license : diff --git a/pspec_x86_64.xml b/pspec_x86_64.xml --- a/pspec_x86_64.xml +++ b/pspec_x86_64.xml @@ -2,8 +2,8 @@ sddm - F. von Gellhorn - flinux@vongellhorn.ch + Troy Harvey + harveydevel@gmail.com CC-BY-3.0 GPL-2.0-or-later @@ -230,12 +230,12 @@ - - 2021-04-20 + + 2021-11-09 0.19.0 Packaging update - F. von Gellhorn - flinux@vongellhorn.ch + Troy Harvey + harveydevel@gmail.com \ No newline at end of file