Bug 462824 - Built-from-source sessions installed via install-sessions.sh still use host system's KAuth helpers and DBus services
Summary: Built-from-source sessions installed via install-sessions.sh still use host s...
Status: CONFIRMED
Alias: None
Product: Plasma SDK
Classification: Plasma
Component: General (other bugs)
Version First Reported In: master
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 476534 477863 (view as bug list)
Depends on:
Blocks: 487792
  Show dependency treegraph
 
Reported: 2022-12-09 18:51 UTC by Paul Worrall
Modified: 2024-09-08 20:53 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Worrall 2022-12-09 18:51:15 UTC
SUMMARY
If I make a change to a KAuth helper and then log into the built-from-source session as configured by install-sessions.sh, the helper I just built isn't invoked, instead the distro-installed helper is called.  This makes it a bit difficult to develop KAuth helpers.

STEPS TO REPRODUCE
1. Make some changes to a KAuth helper (e.g. in plasma-firewall), compile and install using kdesrc-build
2. Log into a session via SDDM selecting the built-from-source session previously installed using install-sessions.sh from plasma-workspace
3. Perform whatever actions invoke the KAuth helper

OBSERVED RESULT
The stock distro-installed helper is invoked

EXPECTED RESULT
The helper compiled in step 1 is invoked

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.26.80
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7
Graphics Platform: Wayland
Comment 1 Nate Graham 2023-01-03 20:52:57 UTC
Yes, this is a known limitation. It will be fixed by https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1715.
Comment 2 Nate Graham 2023-11-08 21:24:08 UTC
*** Bug 476534 has been marked as a duplicate of this bug. ***
Comment 3 Prajna Sariputra 2023-11-09 23:57:16 UTC
In the upstream dbus-daemon session.conf file, `<standard_session_servicedirs />` is placed above all of the `<includedir>session.d</includedir>` type stuff, so the `<servicedir>/opt/kde-dbus-scripts/services</servicedir>` part that is added by `install-sessions.sh` will be below the standard (system and user) directories. This means that for a system that has KDE Plasma installed both through the distro as well as kdesrc-build dbus-daemon will pick the version installed through the distro rather than the one provided by kdesrc-build, as per the documentation (https://dbus.freedesktop.org/doc/dbus-daemon.1.html).

So, I wonder if upstream D-Bus could be convinced to change the defaults to also allow the additional config files to add service directories above the standard ones, especially for the session bus given that anything malicious can just drop stuff in ~/.local/share/dbus-1/services without needing any special privileges like what I'm doing already. They do clearly intend for the local config files to be able to override the defaults anyway, so I guess it's possible that they just didn't think of our use case when they wrote those defaults.

On the other hand, the default system bus service directories are all under /usr or /lib, which would be protected for immutable systems, so getting upstream to allow us to override those would probably be more of an uphill battle, and if that isn't resolved then we'd still need a proper solution like the linked 1715 MR. Notably the KAuth helpers fall into the system services category (and in fact all but one of the system services I see in my kdesrc-build setup are KAuth stuff).

But then again, if just fixing the problem for the session bus/services would be an improvement Jade seems to have another possible solution in the linked MR, which is to run the D-Bus session instance with a special config file that includes but also overrides the system defaults, including the directories problem.

I might bring it up with upstream D-Bus at some point, unless someone can point out any glaring problems with that proposal which I missed.
Comment 4 pixelplanetdev 2023-11-14 16:44:41 UTC
For the session bus, i prefer it to copy `~/kde/usr/share/dbus-1/services` into `$XDG_RUNTIME_DIR/dbus-1/services"`
in `startplasma-dev.sh`

This has the positive consequence of them getting updated on every login and they aren't affecting any other session of the user.

Only caveat is that according to the dbus-daemon manpage, the XDG_RUNTIME_DIR doesn't get monitored for file changes and filenames have to strictly match the well-known bus name.
This was not the case for me.
But if it's the case, the not-matching files can be renamed and the dbus ReloadConfig can be triggered after copying manually with

```
dbus-send --session --print-reply --type=method_call \
      --dest=org.freedesktop.DBus \
      / org.freedesktop.DBus.ReloadConfig > /dev/null
```
Comment 5 Nate Graham 2023-12-13 17:17:32 UTC
*** Bug 477863 has been marked as a duplicate of this bug. ***
Comment 6 Andrey 2024-01-15 15:38:44 UTC
(In reply to pixelplanetdev from comment #4)
> For the session bus, i prefer it to copy `~/kde/usr/share/dbus-1/services`
> into `$XDG_RUNTIME_DIR/dbus-1/services"`
> in `startplasma-dev.sh`
Until we didn't solve it properly, could we document this approach somewhere on the Wiki maybe?