commit:     ffcf0678eb4119b6b58aa60fcaf25a22dd8489cd
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 28 21:17:39 2024 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Mar 30 21:03:01 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ffcf0678

kde-plasma/kscreenlocker: Silence optional pam modules warnings

Also backport upstream commit 3105518ec3bc3ac88374e2c3b204f23feda91b5b
to fix a race condition.

See also:
https://invent.kde.org/plasma/kscreenlocker/-/merge_requests/150

Closes: https://bugs.gentoo.org/927032
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../{kde6-fingerprint.pam => kde-fingerprint.pam}  |  2 +-
 .../kscreenlocker/files/{kde6.pam => kde-r1.pam}   |  0
 .../{kde6-smartcard.pam => kde-smartcard.pam}      |  2 +-
 .../kscreenlocker-6.0.3-fix-lockscreen-race.patch  | 47 ++++++++++++++++++++++
 ...-6.0.3.ebuild => kscreenlocker-6.0.3-r1.ebuild} |  9 +++--
 5 files changed, 54 insertions(+), 6 deletions(-)

diff --git a/kde-plasma/kscreenlocker/files/kde6-fingerprint.pam 
b/kde-plasma/kscreenlocker/files/kde-fingerprint.pam
similarity index 88%
rename from kde-plasma/kscreenlocker/files/kde6-fingerprint.pam
rename to kde-plasma/kscreenlocker/files/kde-fingerprint.pam
index 38267de65e32..6ca0ba1f09e6 100644
--- a/kde-plasma/kscreenlocker/files/kde6-fingerprint.pam
+++ b/kde-plasma/kscreenlocker/files/kde-fingerprint.pam
@@ -3,7 +3,7 @@
 auth        required    pam_shells.so
 auth        required    pam_nologin.so
 auth        required    pam_faillock.so preauth
-auth        required    pam_fprintd.so
+-auth       required    pam_fprintd.so
 auth        required    pam_env.so
 
 account     include     system-local-login

diff --git a/kde-plasma/kscreenlocker/files/kde6.pam 
b/kde-plasma/kscreenlocker/files/kde-r1.pam
similarity index 100%
rename from kde-plasma/kscreenlocker/files/kde6.pam
rename to kde-plasma/kscreenlocker/files/kde-r1.pam

diff --git a/kde-plasma/kscreenlocker/files/kde6-smartcard.pam 
b/kde-plasma/kscreenlocker/files/kde-smartcard.pam
similarity index 83%
rename from kde-plasma/kscreenlocker/files/kde6-smartcard.pam
rename to kde-plasma/kscreenlocker/files/kde-smartcard.pam
index f887c7823432..694fc1e905b0 100644
--- a/kde-plasma/kscreenlocker/files/kde6-smartcard.pam
+++ b/kde-plasma/kscreenlocker/files/kde-smartcard.pam
@@ -3,7 +3,7 @@
 auth        required    pam_shells.so
 auth        required    pam_nologin.so
 auth        required    pam_faillock.so preauth
-auth        required    pam_pkcs11.so wait_for_card card_only
+-auth       required    pam_pkcs11.so wait_for_card card_only
 auth        required    pam_env.so
 
 account     include     system-local-login

diff --git 
a/kde-plasma/kscreenlocker/files/kscreenlocker-6.0.3-fix-lockscreen-race.patch 
b/kde-plasma/kscreenlocker/files/kscreenlocker-6.0.3-fix-lockscreen-race.patch
new file mode 100644
index 000000000000..45976e0e1a14
--- /dev/null
+++ 
b/kde-plasma/kscreenlocker/files/kscreenlocker-6.0.3-fix-lockscreen-race.patch
@@ -0,0 +1,47 @@
+From 3105518ec3bc3ac88374e2c3b204f23feda91b5b Mon Sep 17 00:00:00 2001
+From: Dmitriy Konev <[email protected]>
+Date: Sun, 18 Jun 2023 16:42:56 +0300
+Subject: [PATCH] Prevent finishing greeter by unhandled signals
+
+We have time gap between main() start and KSignalHandler registration
+in which signals will close greeter
+
+First this bug tried to fix in commit c63287ca1250d60f61c4429cbeb0215f5c3bebde
+but placing KSignalHandler registration at start of main() is bad idea
+because it broke mechanism for handling signals at all
+and this behaviour was fixed in commit 448df7517021b9c2e68de161008ebc180363abed
+by moving handlers bellow
+for this reason we have this time gap
+---
+ greeter/main.cpp | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/greeter/main.cpp b/greeter/main.cpp
+index bf95cd1e..0693646e 100644
+--- a/greeter/main.cpp
++++ b/greeter/main.cpp
+@@ -57,6 +57,12 @@ static void signalHandler(int signum)
+ 
+ int main(int argc, char *argv[])
+ {
++    sigset_t blockedSignals;
++    sigemptyset(&blockedSignals);
++    sigaddset(&blockedSignals, SIGTERM);
++    sigaddset(&blockedSignals, SIGUSR1);
++    pthread_sigmask(SIG_BLOCK, &blockedSignals, NULL);
++
+     LayerShellQt::Shell::useLayerShell();
+ 
+     // disable ptrace on the greeter
+@@ -101,6 +107,8 @@ int main(int argc, char *argv[])
+     // only connect signal handler once we can actual handle the signal 
properly
+     QObject::connect(KSignalHandler::self(), &KSignalHandler::signalReceived, 
&app, &signalHandler);
+ 
++    pthread_sigmask(SIG_UNBLOCK, &blockedSignals, NULL);
++
+     app.setQuitOnLastWindowClosed(false);
+     app.setQuitLockEnabled(false);
+     
QCoreApplication::setApplicationName(QStringLiteral("kscreenlocker_greet"));
+-- 
+GitLab
+

diff --git a/kde-plasma/kscreenlocker/kscreenlocker-6.0.3.ebuild 
b/kde-plasma/kscreenlocker/kscreenlocker-6.0.3-r1.ebuild
similarity index 89%
rename from kde-plasma/kscreenlocker/kscreenlocker-6.0.3.ebuild
rename to kde-plasma/kscreenlocker/kscreenlocker-6.0.3-r1.ebuild
index b65bf54f7c03..ba8ff49e64d2 100644
--- a/kde-plasma/kscreenlocker/kscreenlocker-6.0.3.ebuild
+++ b/kde-plasma/kscreenlocker/kscreenlocker-6.0.3-r1.ebuild
@@ -58,6 +58,8 @@ BDEPEND="
 "
 PDEPEND=">=kde-plasma/kde-cli-tools-${PVCUT}:*"
 
+PATCHES=( "${FILESDIR}/${P}-fix-lockscreen-race.patch" )
+
 src_prepare() {
        ecm_src_prepare
        use test || cmake_run_in greeter cmake_comment_add_subdirectory 
autotests
@@ -74,8 +76,7 @@ src_test() {
 src_install() {
        ecm_src_install
 
-       local config
-       for config in kde6{,-fingerprint,-smartcard} ; do
-               newpamd "${FILESDIR}/${config}.pam" ${config/6}
-       done
+       newpamd "${FILESDIR}/kde-r1.pam" kde
+       newpamd "${FILESDIR}/kde-fingerprint.pam" kde-fingerprint
+       newpamd "${FILESDIR}/kde-smartcard.pam" kde-smartcard
 }

Reply via email to