https://bugs.kde.org/show_bug.cgi?id=523640

            Bug ID: 523640
           Summary: powermanagement dataengine's `Inhibitions` source is
                    permanently empty: `ListInhibitions` is demarshalled
                    as a type that matches neither introspection nor the
                    wire
    Classification: Plasma
           Product: plasmashell
      Version First 6.7.3
       Reported In:
          Platform: EndeavourOS
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: DataEngines
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: 1.0

SUMMARY

The powermanagement dataengine's "Inhibitions" source is permanently empty.
The engine demarshals PolicyAgent.ListInhibitions into a type that matches
neither what introspection advertises nor what actually crosses the bus, so
the conversion always fails, the callback never runs, and no consumer of the
source ever receives any data. The failure is completely silent.

Found while diagnosing bug 523605 (fixed by MR !57); mentioned there under
"possibly related" — this is the separate report offered there.


MECHANISM

src/dataengines/powermanagement/powermanagementengine.cpp:304 requests the
inhibition list:

    createAsyncDBusMethodCallAndCallback<QList<InhibitionInfo>>(this,
        ...
        QStringLiteral("ListInhibitions"),
        [this](const QList<InhibitionInfo> &replyValue) { ... });

with InhibitionInfo = QPair<QString, QString> (powermanagementengine.h:21),
i.e. expected D-Bus signature a(ss).

Three descriptions of that reply exist, and no two agree:

    engine code expects:      QList<QPair<QString,QString>>  ->  a(ss)
    introspection XML says:   (dict)                         ->  a{ss}
    actual wire payload:      QList<QStringList>             ->  aas

Live introspection on Plasma 6.7.3:

    <method name="ListInhibitions">
      <annotation value="true" name="org.freedesktop.DBus.Deprecated"/>
      <annotation value="QList&lt;QStringList&gt;"
name="org.qtproject.QtDBus.QtTypeName.Out0"/>
      <arg direction="out" type="a{ss}" name="inhibited"/>
    </method>

Actual reply, dbus-send --print-reply with one inhibition held (this is aas):

    array [
       array [
          string "plasmashell"
          string "Wakeup is preventing sleep"
       ]
    ]

The aas reply cannot demarshal into a(ss), so QDBusPendingReply carries an
error, and the helper at powermanagementengine.cpp:53-58 skips the callback
on error without logging anything:

    QDBusPendingReply<ReplyType> reply = *watcher;
    if (!reply.isError()) {
        callback(reply.value());
    }

The change-notification path is equally dead: the InhibitionsChanged
connection (powermanagementengine.cpp:96-98) targets a slot taking the same
QList<InhibitionInfo>, while the signal carries aas + as (and has the same
Deprecated and QtTypeName.Out0 annotations).

Net effect: the Inhibitions source never delivers data to any consumer, and
never surfaces an error.

Verified by connecting a plasmoid to the source while two inhibitions were
held and cycling them: nothing was ever delivered.


STEPS TO REPRODUCE

    Plasma5Support.DataSource {
        engine: "powermanagement"
        connectedSources: ["Inhibitions"]
        onDataChanged: console.warn("Inhibitions:",
JSON.stringify(data["Inhibitions"]))
    }

1. Hold any inhibition (e.g. the battery applet's "Manually block sleep and
   screen locking"). Confirm PowerDevil sees it:

    dbus-send --session --print-reply \
      --dest=org.kde.Solid.PowerManagement \
      /org/kde/Solid/PowerManagement/PolicyAgent \
      org.kde.Solid.PowerManagement.PolicyAgent.ListInhibitions

   -> returns the entry.

2. Load the plasmoid, toggle inhibitions on and off.

EXPECTED: the source publishes one {Name, Icon, Reason} entry per inhibiting
application.

ACTUAL: the source stays empty forever; the data handler never fires.


SOFTWARE/OS VERSIONS

Arch Linux, Plasma 6, plasma5support 6.7.3. Present in plasma5support master
as of 2026-07-29 (post-5d9f76c0).


POSSIBLE FIXES — needs a maintainer decision, hence no patch attached

1. Minimal: demarshal what is actually on the wire (QList<QStringList>) and
   adapt inhibitionsChanged(). Small, but doubles down on an API PowerDevil
   already annotates org.freedesktop.DBus.Deprecated=true (both
   ListInhibitions and InhibitionsChanged).

2. Port the source to the ActiveInhibitions / RequestedInhibitions properties
   that supersede them — signature a(ssssu),
   PolicyAgentInhibition{what, who, why, mode, flags}. Richer than the
   source's current {Name, Icon, Reason} shape, so it changes what the source
   publishes, not just how it reads.

Either way, PowerDevil's introspection XML for ListInhibitions /
InhibitionsChanged advertises a{ss} while the payload is aas — the same
XML-vs-reality mismatch fixed for kactivitymanagerd in bug 507653 — so the
XML deserves a correction too, wherever the engine ends up.

Happy to prepare an MR for whichever direction is preferred.


RELATED, NOT DUPLICATES (checked before filing)

- Bug 449635 (2022), final comment: after the applet-side regression was
  fixed, the reporter noted "Applets work but Plasma Engine Explorer still
  shows nothing if the Inhibitions data source is selected... Separate
  issues, yeah?" — the question was never answered and the bug closed FIXED
  for the applet issue. That appears to be an earlier sighting of this
  defect, which would date it to at least Plasma 5.24 (February 2022).
- Bug 288802 (2011): same engine, same class of defect — wrong QDBusReply
  type for batteryRemainingTime made remaining time silently 0. Different
  method, fixed in 2011.
- Bug 507653 (2025): introspection XML advertising wrong result types, in
  kactivitymanagerd. Same theme, different daemon; fixed 6.5.0 by
  correcting the XML.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to