Bug 412665

Summary: kdeconnect-cli cannot start kdeconnectd.exe on Windows in Chinese
Product: [Applications] kdeconnect Reporter: jingyu9575 <qw2g64>
Component: commonAssignee: Albert Vaca Cintora <albertvaka>
Status: RESOLVED FIXED    
Severity: normal CC: dianlujitao, KDE, piyushaggarwal002
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description jingyu9575 2019-10-06 11:38:12 UTC
SUMMARY

With latest kdeconnect nightly on Windows (in Chinese), starting kdeconnect-indicator.exe will not start kdeconnectd.exe, leaving the program nonfunctional.

STEPS TO REPRODUCE
1. Install kdeconnect from https://binary-factory.kde.org/job/kdeconnect-kde_Nightly_win64/
2. Launch kdeconnect-indicator.exe

OBSERVED RESULT
kdeconnect-indicator.exe hangs with no tray icon. kdeconnectd.exe is not running.

EXPECTED RESULT
kdeconnectd.exe is running and kdeconnect-indicator can be used.

SOFTWARE/OS VERSIONS
Windows: Windows 10 1903 18362.10022 zh-CN
KDE Frameworks Version: 5.62.0
Qt Version: 5.13.1

ADDITIONAL INFORMATION
Process Monitor showed that kdeconnectd.exe and dbus-daemon.exe were started but dbus-daemon immediately crashed. If `dbus-daemon --session` is started manually, launching kdeconnect-indicator will crash dbus-daemon with the following message:

> dbus-daemon[7444]: info: [session pid=7444 sid=S-1-5-21-**********-**********-**********-1001] Activating service name='org.kde.kdeconnect' requested by ':1.0' (pid=8172 comm="" sid="S-1-5-21-**********-**********-**********-1001")
> dbus-daemon[7444]: info: [session pid=7444 sid=S-1-5-21-**********-**********-**********-1001] Activated service > 'org.kde.kdeconnect' failed: Failed to execute program org.kde.kdeconnect: 系统找不到指定的文件。
> dbus-daemon[7444]: error: arguments to dbus_message_iter_append_basic() were incorrect, assertion "_dbus_check_is_valid_utf8 (*string_p)" failed in file C:\_\db7b4da\dbus-1.12.12\dbus\dbus-message.c line 2754.
> This is normally a bug in some application using the D-Bus library.

From the 2nd line, it was trying to start the 'org.kde.kdeconnect' service but failed with "file not found" message. The message was in the Chinese encoding and not valid UTF-8, which triggered the assertion in the 3rd line and crashed the daemon.

Suggested fix: comment out the `Exec=` line in bin/data/dbus-1/services/org.kde.kdeconnect.service. This avoids the error and allows kdeconnectd to run.
Comment 1 dianlujitao 2020-01-29 11:49:28 UTC
Changing to `Exec=kdeconnectd` fixes the problem as well.

The absolute path is generated at build time https://github.com/KDE/kdeconnect-kde/blob/master/daemon/org.kde.kdeconnect.service.in#L3 and won't work on MS Windows because the build and install directory are usually different on Win.
Comment 2 jingyu9575 2020-01-29 12:27:03 UTC
(In reply to dianlujitao from comment #1)
> Changing to `Exec=kdeconnectd` fixes the problem as well.

Yes, I'm also using this value now. I remember when I simply commented it out there will be a "cannot find file" error after running a long time. With `Exec=kdeconnectd` I have not seen this error yet.
Comment 3 brute4s99 2020-11-09 20:18:11 UTC
Hi! Can you please try out the latest build from https://binary-factory.kde.org/job/kdeconnect-kde_Nightly_win64/ and let us know how it went? The dbus-daemon crash has been fixed. Since I could not reproduce the `Exec=kdeconnectd` issue on my system anymore, I am not sure if it has been automatically fixed or not. Please try it out and let me know if you find it again!
Comment 4 brute4s99 2020-11-09 20:25:15 UTC
update: I just tried again. Looks like the Exec=kdeconnectd.exe issue is still around. I'll let you all know when there is progress on the status of this bug!
Comment 5 brute4s99 2020-11-10 23:16:05 UTC
Hi everyone, I have incorporated the suggested "Exec=kdeconnectd" fix into the code now. It works as expected. Expect no "Failed to spawn child" errors following build #577 at https://binary-factory.kde.org/job/kdeconnect-kde_Nightly_win64/ 🎉
Comment 6 dianlujitao 2020-11-13 18:08:28 UTC
Can confirm that the issue is fixed with the latest build