Bug 402323

Summary: kdeconnectd certificate generation using QCA fails on MacOS Mojave
Product: [Applications] kdeconnect Reporter: jeremija <jerko.steiner>
Component: commonAssignee: Albert Vaca Cintora <albertvaka>
Status: RESOLVED WORKSFORME    
Severity: crash    
Priority: NOR    
Version First Reported In: 1.3.3   
Target Milestone: ---   
Platform: Other   
OS: macOS   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description jeremija 2018-12-18 20:29:19 UTC
SUMMARY
After I successfully compile kdeconnect on a Mac, I the certificate in  ~/Library/Preferences/kdeconnect/certificate.pem does not generate property. Its contents are:

-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----


I've used homebrew to install the dependencies:

brew tap kde-mac/homebrew-kde
brew install kf5-extra-cmake-modules
brew install kf5-ki18n
brew install kf5-kconfigwidgets
brew install kf5-kdbusaddons
brew install kf5-kiconthemes
brew install kf5-knotifications
brew install kf5-kcmutils

I must've had qt and gettext installed beforehand, perhaps some other dependencies too.

I used the following command to build kdeconnect (commit hash b6c1528):

cd kdeconnect
mkdir build
PATHS='/usr/local/opt/qt;/usr/local/Cellar/gettext/0.19.8.1'
exec cmake $1 -DCMAKE_PREFIX_PATH="$PATHS" -DCMAKE_PROGRAM_PATH="$PATHS" -DCMAKE_INSTALL_PREFIX=$HOME/kde-connect -DCMAKE_BUILD_TYPE=Debug
make -j6

I also started dbus using "brew services start dbus" and I ensured that "launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET" returns a socket path.

STEPS TO REPRODUCE
1. remove existing certificates from ~/Library/Preferences/kdeconnect
2. start kdeconnectd
3. it will crash at kdeconnectconfig.cpp:106

$ ~/kde-connect/lib/libexec/kdeconnectd
kdeconnect.core: KdeConnect daemon starting
ASSERT failure in QList<T>::at: "index out of range", file /usr/local/opt/qt/lib/QtCore.framework/Headers/qlist.h, line 544
[2]    72129 abort      ~/kde-connect/lib/libexec/kdeconnectd

if (cert.exists() && cert.open(QIODevice::ReadOnly)) {

        d->m_certificate = QSslCertificate::fromPath(certPath).at(0);  // <------- HERE

    } else {

        // No certificate yet. Probably first run. Let's generate one!

OBSERVED RESULT
kdeconnectd crashes on startup because certificate.pem contains only:

-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----


EXPECTED RESULT
certificate.pem should be generated correctly. The daemon starts manually when using the openssl command from the comments to generate certificate.

SOFTWARE/OS VERSIONS
Windows: -
MacOS: Mojave 10.14.2
Linux/KDE Plasma: -
(available in About System)
KDE Plasma Version: -
KDE Frameworks Version: -
Qt Version: Qt 5.12.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 10.0.0 (clang-1000.11.45.5) (Apple)) on "cocoa"
OS: macOS 10.14 [darwin version 18.2.0]

ADDITIONAL INFORMATION
Comment 1 Justin Zobel 2021-01-12 02:03:35 UTC
Thank you for the crash report.

As it has been a while since this was reported, can you please test and confirm if this issue is still occurring or if this bug report can be marked as resolved.

I have set the bug status to "needsinfo" pending your response, please change back to "reported" or "resolved/worksforme" when you respond, thank you.
Comment 2 Bug Janitor Service 2021-01-27 04:33:19 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Bug Janitor Service 2021-02-11 04:33:19 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!