Bug 442064 - the `powermanagement` data engine calling the `UnInhibit` method with incorrect signature
Summary: the `powermanagement` data engine calling the `UnInhibit` method with incorre...
Status: RESOLVED DUPLICATE of bug 433675
Alias: None
Product: plasmashell
Classification: Plasma
Component: DataEngines (show other bugs)
Version: master
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-06 05:19 UTC by Peifeng Yu
Modified: 2021-09-07 16:15 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peifeng Yu 2021-09-06 05:19:41 UTC
SUMMARY
I noticed the Battery and Brightness applet always ends up in a confusing state after using its "Inhibit automatic sleep and screen locking" feature. I tracked it down to the `powermanagement` data engine calling the `UnInhibit` method with incorrect signature:

- [when un-inhibit sleep](https://invent.kde.org/plasma/plasma-workspace/-/blob/master/dataengines/powermanagement/powermanagementjob.cpp#L107)
- [when un-inhibit screen locking](https://invent.kde.org/plasma/plasma-workspace/-/blob/master/dataengines/powermanagement/powermanagementjob.cpp#L126)

The correct signature should take an unsigned int: 
- [`org.freedesktop.PowerManagement.UnInhibit`](https://invent.kde.org/plasma/powerdevil/-/blob/master/daemon/org.freedesktop.PowerManagement.Inhibit.xml#L10)
- [`org.freedesktop.ScreenSaver.UnInhibit`](https://invent.kde.org/plasma/powerdevil/-/blob/master/daemon/org.freedesktop.ScreenSaver.xml#L30)


STEPS TO REPRODUCE
1. Make sure nothing is inhibiting
```
qdbus --literal org.kde.Solid.PowerManagement.PolicyAgent \
    /org/kde/Solid/PowerManagement/PolicyAgent \
    org.kde.Solid.PowerManagement.PolicyAgent.ListInhibitions
```
2. Check the "Inhibit automatic sleep and screen locking" box in the Battery and Brightness applet
3. Wait 5 seconds for the inhibition to engage and verify the list of inhibitions. There should be 2 items.
4. Uncheck the "Inhibit automatic sleep and screen locking" box in the Battery and Brightness applet


OBSERVED RESULT
Inhibitions are **not** released. And if you toggle the checkbox multiple times, there will be many duplicated items in the list.

If you run

```
dbus-monitor "destination=org.freedesktop.PowerManagement.Inhibit" "sender=org.freedesktop.PowerManagement.Inhibit"
```

during step 4, the error reply will be captured (something similar to the following):

```
error time=1630903644.048537 sender=:1.414 -> destination=:1.57 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=7813
   string "No such method 'UnInhibit' in interface 'org.freedesktop.PowerManagement.Inhibit' at object path '/org/freedesktop/PowerManagement/Inhibit' (signature 'i')"
```

EXPECTED RESULT
Inhibitions are released.


SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Kernel Version: 5.13.13-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 12 × Intel® Core™ i7-10750H CPU @ 2.60GHz
Memory: 31.1 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics
Comment 1 Bug Janitor Service 2021-09-06 05:33:48 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1041
Comment 2 Nate Graham 2021-09-07 16:15:55 UTC

*** This bug has been marked as a duplicate of bug 433675 ***