Commit 4485c8ca authored by Fabian Vogt's avatar Fabian Vogt
Browse files

Add fallback to the absolute path to kscreenlocker_greet

KLibexec doesn't work on usr-merged distros as libraries can be loaded
through a different path (/lib*) than they are installed to (/usr/lib*).

BUG: 452817
parent 84b2cf3c
Pipeline #175006 passed with stage
in 4 minutes and 10 seconds
...@@ -204,10 +204,12 @@ else() ...@@ -204,10 +204,12 @@ else()
target_link_libraries(KScreenLocker PRIVATE Qt::GuiPrivate) target_link_libraries(KScreenLocker PRIVATE Qt::GuiPrivate)
endif() endif()
set(kscreenlocker_greet_bin_abs ${CMAKE_INSTALL_FULL_LIBEXECDIR}/kscreenlocker_greet)
# The file path of kscreenlocker_greet must be relative to the KScreenLocker library. # The file path of kscreenlocker_greet must be relative to the KScreenLocker library.
file(RELATIVE_PATH kscreenlocker_greeter_bin ${CMAKE_INSTALL_FULL_LIBDIR} ${CMAKE_INSTALL_FULL_LIBEXECDIR}/kscreenlocker_greet) file(RELATIVE_PATH kscreenlocker_greet_bin_rel ${CMAKE_INSTALL_FULL_LIBDIR} ${kscreenlocker_greet_bin_abs})
target_compile_definitions(KScreenLocker PRIVATE target_compile_definitions(KScreenLocker PRIVATE
KSCREENLOCKER_GREET_BIN="${kscreenlocker_greeter_bin}" KSCREENLOCKER_GREET_BIN_ABS="${kscreenlocker_greet_bin_abs}"
KSCREENLOCKER_GREET_BIN_REL="${kscreenlocker_greet_bin_rel}"
) )
if (X11_Xinput_FOUND) if (X11_Xinput_FOUND)
......
...@@ -4,7 +4,7 @@ include(ECMMarkAsTest) ...@@ -4,7 +4,7 @@ include(ECMMarkAsTest)
# KillTest # KillTest
####################################### #######################################
add_executable(killTest killtest.cpp) add_executable(killTest killtest.cpp)
target_compile_definitions(killTest PRIVATE KSCREENLOCKER_GREET_BIN="kscreenlocker_greet") target_compile_definitions(killTest PRIVATE KSCREENLOCKER_GREET_BIN_REL="kscreenlocker_greet")
add_test(NAME kscreenlocker-killTest COMMAND killTest) add_test(NAME kscreenlocker-killTest COMMAND killTest)
ecm_mark_as_test(killTest) ecm_mark_as_test(killTest)
target_link_libraries(killTest KF5::CoreAddons Qt::Test) target_link_libraries(killTest KF5::CoreAddons Qt::Test)
...@@ -90,7 +90,7 @@ void KillTest::testKill() ...@@ -90,7 +90,7 @@ void KillTest::testKill()
{ {
QProcess greeter(this); QProcess greeter(this);
greeter.setReadChannel(QProcess::StandardOutput); greeter.setReadChannel(QProcess::StandardOutput);
greeter.start(KLibexec::path(KSCREENLOCKER_GREET_BIN), QStringList({QStringLiteral("--testing")})); greeter.start(KLibexec::path(KSCREENLOCKER_GREET_BIN_REL), QStringList({QStringLiteral("--testing")}));
QVERIFY(greeter.waitForStarted()); QVERIFY(greeter.waitForStarted());
// wait some time till it's really set up // wait some time till it's really set up
...@@ -167,7 +167,7 @@ void KillTest::testImmediateKill() ...@@ -167,7 +167,7 @@ void KillTest::testImmediateKill()
// this test ensures that the greeter indicates crashexit when a signal is sent to the greeter // this test ensures that the greeter indicates crashexit when a signal is sent to the greeter
// before it had time to properly setup // before it had time to properly setup
QProcess greeter(this); QProcess greeter(this);
greeter.start(KLibexec::path(KSCREENLOCKER_GREET_BIN), QStringList({QStringLiteral("--testing")})); greeter.start(KLibexec::path(KSCREENLOCKER_GREET_BIN_REL), QStringList({QStringLiteral("--testing")}));
QVERIFY(greeter.waitForStarted()); QVERIFY(greeter.waitForStarted());
// now kill // now kill
......
...@@ -617,8 +617,13 @@ void KSldApp::startLockProcess(EstablishLock establishLock) ...@@ -617,8 +617,13 @@ void KSldApp::startLockProcess(EstablishLock establishLock)
args << QStringLiteral("--ksldfd"); args << QStringLiteral("--ksldfd");
args << QString::number(fd); args << QString::number(fd);
auto greeterPath = KLibexec::path(QStringLiteral(KSCREENLOCKER_GREET_BIN_REL));
if (!QFile::exists(greeterPath)) {
greeterPath = KSCREENLOCKER_GREET_BIN_ABS;
}
m_lockProcess->setProcessEnvironment(env); m_lockProcess->setProcessEnvironment(env);
m_lockProcess->start(KLibexec::path(QStringLiteral(KSCREENLOCKER_GREET_BIN)), args); m_lockProcess->start(greeterPath, args);
close(fd); close(fd);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment