Bug 507653 - kactivitymanagerd Activities DBus introspection metadata lists incorrect result types for some methods
Summary: kactivitymanagerd Activities DBus introspection metadata lists incorrect resu...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Activities in general (other bugs)
Version First Reported In: 6.4.3
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-29 23:28 UTC by Brian Koropoff
Modified: 2025-07-31 07:32 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Koropoff 2025-07-29 23:28:13 UTC
SUMMARY
The DBus interface for ActivityInformation and ListActivitiesWithInformation (and possibly others) advertises results consisting of 3 strings and a double:

https://invent.kde.org/plasma/kactivitymanagerd/-/blob/master/src/common/dbus/org.kde.ActivityManager.Activities.xml?ref_type=heads#L51

The actual C++ structure consists of 4 strings and an integer:

https://invent.kde.org/plasma/kactivitymanagerd/-/blob/master/src/common/dbus/org.kde.ActivityManager.Activities.h?ref_type=heads#L13

This causes DBus bindings that depend on introspection (e.g. pydbus) to fail to decode method call results.

STEPS TO REPRODUCE
The following python script demonstrates the problem:

#!/usr/bin/env python3
import pydbus
bus = pydbus.SessionBus()
activities = bus.get("org.kde.ActivityManager", "/ActivityManager/Activities")
print(activities.ListActivitiesWithInformation())

1. 
2. 
3. 

OBSERVED RESULT
Traceback (most recent call last):
  File "/var/home/bkoropoff/tablet-activity-switcher", line 5, in <module>
    print(activities.ListActivitiesWithInformation())
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/pydbus/proxy_method.py", line 102, in __call__
    raise error
  File "/usr/lib/python3.13/site-packages/pydbus/proxy_method.py", line 97, in __call__
    result = instance._bus.con.call_sync(*call_args)
gi.repository.GLib.GError: g-io-error-quark: Method “ListActivitiesWithInformation” returned type “(a(ssssi))”, but expected “(a(sssd))” (13)

EXPECTED RESULT

It works.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Kinoite 42
KDE Plasma Version: 6.4.3
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.1

ADDITIONAL INFORMATION

These methods appear to have had incorrect introspection information since they were introduced (d was used instead of i in the signature):

https://invent.kde.org/plasma/kactivitymanagerd/-/commit/4c6e1d3936e528a715df19d63b1e3a6fa1f2b808

An additional field was added later without updating the XML:

https://invent.kde.org/plasma/kactivitymanagerd/-/commit/901638dbf870cb6e7eeac529c1d30c724c2faf39
Comment 1 Bug Janitor Service 2025-07-30 12:47:09 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kactivitymanagerd/-/merge_requests/90
Comment 2 Ivan Čukić 2025-07-30 13:16:38 UTC
Git commit 81f71b15d51306c766d3a7f109e9d8b33ed545de by Ivan Čukić.
Committed on 30/07/2025 at 12:46.
Pushed by ivan into branch 'master'.

Update org.kde.ActivityManager.Activities interface XML definition

M  +2    -2    src/common/dbus/org.kde.ActivityManager.Activities.xml

https://invent.kde.org/plasma/kactivitymanagerd/-/commit/81f71b15d51306c766d3a7f109e9d8b33ed545de
Comment 3 Brian Koropoff 2025-07-30 19:08:46 UTC
Thanks!
Comment 4 Ivan Čukić 2025-07-30 20:54:12 UTC
No problem. If you're writing something that uses most of the DBus API, and you're willing to share it, we might be able to use it for auto tests to avoid XML definition breaks like this one.

(otherwise, we'll have to whip up something when we find the time ;) )
Comment 5 Brian Koropoff 2025-07-31 00:42:50 UTC
I wrote a small service that subscribes to KWin tablet mode signals and changes my 2-in-1 laptop between a tablet and non-tablet activity.  I can put it up on github, but it doesn't use all that many DBus methods, and I switched to a more modern Python DBus library that doesn't depend on introspection.
Comment 6 Ivan Čukić 2025-07-31 07:32:34 UTC
Sounds cool, though you are right that it is not going to help for this. I'll have to write python introspection tests then :)