Bug 2547768

Summary: Opening im-chooser auto-starts org.kde.Shutdown, which then breaks the KDE Shut Down entry
Product: [Fedora] Fedora Reporter: bi1fof
Component: im-chooserAssignee: Akira TAGOH <tagoh>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 44CC: i18n-bugs, tagoh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: im-chooser-1.7.7-2.fc46 im-chooser-1.7.7-2.fc44 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2026-10-08 12:16:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description bi1fof 2026-10-08 03:37:40 UTC
**Summary:** opening the Input Method Selector auto-starts the KDE shutdown
service `org.kde.Shutdown`, which then stays resident and makes the desktop's
*Shut Down* entry stop working.

## Environment

- Fedora 44, KDE Plasma 6.7.5 on Wayland
- `im-chooser-1.7.6-1.fc44`, `im-chooser-common-1.7.6-1.fc44`

## Steps to reproduce

1. Log in to a Plasma 6 Wayland session.
2. Open the Input Method Selector (`im-chooser`) and close it again. No button
   has to be pressed, and no input method has to be changed.
3. Check the service that got activated at the same second:

   ```bash
   systemctl --user status 'dbus-:1.1-org.kde.Shutdown'
   ```

4. Click *Shut Down* in the KDE Application Launcher.

## Actual result

Step 2 silently starts `/usr/bin/plasma-shutdown`, which never exits, and step 4
then does nothing at all. The user journal shows:

```
10:23:11 systemd[1325]: Started app-im-chooser@....service - 输入法选择器.
10:23:11 systemd[1325]: Started dbus-:1.1-org.kde.Shutdown.
...
11:10:23 systemd[1325]: Started dbus-:1.1-org.kde.LogoutPrompt.
11:10:23 ksmserver-logout-greeter[496120]: org.kde.Shutdown D-Bus service is already registered; quitting
```

In that login session `im-chooser` was launched exactly once, and that is the
only time in ten days that the shutdown service was activated — while no logout
or shutdown was actually requested. The two events are causally linked by the
code below, not merely correlated in time.

The desktop only recovers after:

```bash
systemctl --user stop 'dbus-:1.1-org.kde.Shutdown'
```

## Cause

`/usr/lib64/libimchooseui.so.0.0.0` (package `im-chooser-common`) implements a
cross-desktop "log out" helper in `egg_sm_client_dbus_kde5_new()`: it builds a
proxy for the KDE session manager and pings it to see whether it exists.

```
8bb1: lea  0x12790(%rip),%r9        # "org.kde.Shutdown"
8bb8: xor  %esi,%esi                # flags = 0  → G_DBUS_PROXY_FLAGS_NONE
8bc4: lea  0x127a1(%rip),%r8        # "/Shutdown"
8bcb: push $0x0                     # cancellable = NULL
8bcd: call g_dbus_proxy_new_for_bus_sync
...
8bf3: lea  0x12739(%rip),%r8        # "Ping"
8bff: lea  0x1273e(%rip),%rcx       # "org.freedesktop.DBus.Peer"
8c1c: call g_dbus_connection_call_sync
```

String table (verified with `strings -a -t x` and the offsets above):

```
12739 Ping
1273e org.freedesktop.DBus.Peer
12790 org.kde.Shutdown
127a1 /Shutdown
```

The proxy is created with flags `0`, i.e. without
`G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START`. GDBus therefore sends
`StartServiceByName` for `org.kde.Shutdown` as part of creating the proxy, which
activates `plasma-shutdown` — the application only wanted to *check* whether the
session manager exists.

To be explicit: `im-chooser` does **not** call `logout` here. The only remote
call it makes is the harmless `Peer.Ping`. The side effect is purely the
auto-start.

## Expected result

Merely opening (or probing) the chooser must have no effect outside the
application: the KDE shutdown service must not be started unless the user
actually asks to log out.

## Suggested fix

Pass `G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START` (flag value 4) when creating the
proxy, or better, defer creating the proxy and the `Peer.Ping` probe until an
action that actually needs it is used (for example the *Log Out* button, which
is backed by `imchoose_ui_is_logout_required`). The equivalent probes for
`org.gnome.SessionManager` and `org.xfce.Session.Manager` in the same function
should be reviewed for the same pattern.

## Notes

- Because the KDE side keeps the activated service resident, the visible symptom
  is a dead *Shut Down* entry rather than anything related to input methods,
  which makes this bug hard to attribute from the user's point of view.
- A companion report against KDE (`plasmashell / Session Management`) covers the
  residency of `plasma-shutdown` and the greeter's
  `org.kde.Shutdown D-Bus service is already registered; quitting` behaviour.

Comment 1 bi1fof 2026-10-08 03:37:52 UTC
Companion report filed against the KDE side of this: bugs.kde.org bug 526801 (plasma-shutdown stays resident after being D-Bus-activated without a request, and ksmserver-logout-greeter then refuses to start with "org.kde.Shutdown D-Bus service is already registered; quitting").

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

Comment 2 Fedora Update System 2026-10-08 12:13:50 UTC
FEDORA-2026-9ccf8887f2 (im-chooser-1.7.7-2.fc46) has been submitted as an update to Fedora 46.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-9ccf8887f2

Comment 3 Fedora Update System 2026-10-08 12:16:12 UTC
FEDORA-2026-9ccf8887f2 (im-chooser-1.7.7-2.fc46) has been pushed to the Fedora 46 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 4 Fedora Update System 2026-10-08 13:20:01 UTC
FEDORA-2026-3491262dac (im-chooser-1.7.7-2.fc45) has been submitted as an update to Fedora 45.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-3491262dac

Comment 5 Fedora Update System 2026-10-08 13:20:02 UTC
FEDORA-2026-cbc732b7a8 (im-chooser-1.7.7-2.fc44) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-cbc732b7a8

Comment 6 Fedora Update System 2026-10-09 02:09:00 UTC
FEDORA-2026-3491262dac has been pushed to the Fedora 45 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-3491262dac`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-3491262dac

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2026-10-09 02:30:53 UTC
FEDORA-2026-cbc732b7a8 has been pushed to the Fedora 44 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-cbc732b7a8`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-cbc732b7a8

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2026-10-17 01:06:28 UTC
FEDORA-2026-cbc732b7a8 (im-chooser-1.7.7-2.fc44) has been pushed to the Fedora 44 stable repository.
If problem still persists, please make note of it in this bug report.