Bug 382458 - Exec lines in service files must not have any path prefix
Summary: Exec lines in service files must not have any path prefix
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kwallet
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.36.0
Platform: Other Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Valentin Rusu
URL:
Keywords:
Depends on:
Blocks: 380136
  Show dependency treegraph
 
Reported: 2017-07-18 08:40 UTC by Ralf Habacker
Modified: 2017-12-20 09:38 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.43.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2017-07-18 08:40:39 UTC
The following commit https://cgit.kde.org/kwallet.git/commit/?id=0ba2aeadc90823515f03a1536d2f1838aace39fe makes the exec line absolute which does not work on Windows. Service executables are located in the bin dir and relative pathes will not work in any cases. [1][2] 

Instead on Windows the resulting Exec line should be:

Exec=kwalletd5

which means the template need to have some like this 

+Exec=@SOME_PREFIX@kwalletd5

to be removable 

and ecm KDEInstallDirs.cmake needs to set this variable to empty on Windows

This topics affects any dbus service file provided in any frameworks library.

[1] https://mail.kde.org/pipermail/kde-buildsystem/2011-October/008227.html
[2] https://lists.freedesktop.org/archives/dbus/2016-June/016949.html.
Comment 1 Christophe Marin 2017-07-20 07:43:13 UTC
Well, the previous commit made the path relative. This broke autostart on linux.

Was it working a few commits ago when org.kde.kwalletd5.service.in had :
Exec=@CMAKE_INSTALL_PREFIX@/bin/kwalletd5 ?
Comment 2 Ralf Habacker 2017-07-20 09:03:30 UTC
(In reply to Christophe Giboudeaux from comment #1)
> Well, the previous commit made the path relative. This broke autostart on
> linux.
> 
> Was it working a few commits ago when org.kde.kwalletd5.service.in had :
> Exec=@CMAKE_INSTALL_PREFIX@/bin/kwalletd5 ?

The short answer is no, for the long see below:

According to dbus spawn implementation (see https://cgit.freedesktop.org/dbus/dbus/tree/dbus/dbus-spawn-win.c#n572) and CreateProcess implementation (see  https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) the search order for executables is only specified deterministic if the file name does not contain a directory path. 

Having any relative path results into having the current dir be added in front of the relative either if it would be Exec=./bin/kwalletd5 or Exec=../bin/kwalletd5 which is unreliable.
Comment 3 Christophe Marin 2017-07-20 09:49:04 UTC
mmmh... so :
- an absolute path breaks things on windows,
- @CMAKE_INSTALL_PREFIX@/bin/foo breaks things for people using something different than 'bin' for binaries and Windows 
- and a relative path breaks things for every other users.

out of curiosity, do services installed in libexec dirs work ? eg :

org.kde.kssld5.service & org.kde.kioexecd.service have Exec=@KDE_INSTALL_FULL_LIBEXECDIR@/kf5/kiod5
Comment 4 Ralf Habacker 2017-07-20 13:29:57 UTC
(In reply to Christophe Giboudeaux from comment #3)
> mmmh... so :
> - an absolute path breaks things on windows,
> - @CMAKE_INSTALL_PREFIX@/bin/foo breaks things for people using something
> different than 'bin' for binaries and Windows 
> - and a relative path breaks things for every other users.
> 
> out of curiosity, do services installed in libexec dirs work ? eg :
without source code changes no, see bug 382459 and bug 382460.

Source codes changes means if the related tool is only started under control of some library the full path to the executable in libexec needs to be calculated based on the runtime install root path of the application/library.
Comment 5 Ralf Habacker 2017-12-20 09:38:32 UTC
Review request https://phabricator.kde.org/D9383