Bug 475722

Summary: On Wayland, Total Memory Column incorrectly shows CGroup instead
Product: [Unmaintained] ksysguard Reporter: Dashon <dashonwwIII>
Component: libksysguardAssignee: fanzhuyifan
Status: RESOLVED FIXED    
Severity: normal CC: dashonwwIII, fanzhuyifan, plasma-bugs-null
Priority: NOR Keywords: wayland-only
Version First Reported In: 5.27.8   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: On wayland, ksysguard incorrectly displays cgroup in the total memory column.
On x11, total memory is correctly displayed

Description Dashon 2023-10-17 00:26:34 UTC
SUMMARY
If you open ksysguard on wayland and enable the column "Total Memory" It seems to give you the path to some file or maybe dbus service rather than a number.


STEPS TO REPRODUCE
1. Login to a plasma wayland session
2. Open ksysguard
3. Right click on any column, such as name, memory, cpu and, look for total memory. Click to show total memory.

OBSERVED RESULT
I get something that looks like a path or dbus call.

EXPECTED RESULT
Should return a number like it does on X11

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 fanzhuyifan 2023-10-17 04:27:17 UTC
Created attachment 162365 [details]
On wayland, ksysguard incorrectly displays cgroup in the total memory column.
Comment 2 fanzhuyifan 2023-10-17 04:27:48 UTC
Created attachment 162366 [details]
On x11, total memory is correctly displayed
Comment 3 fanzhuyifan 2023-10-17 04:30:36 UTC
See attachments. On wayland, total Memory Column incorrectly shows CGroup instead. The behavior on X11 is correct.
Comment 4 fanzhuyifan 2023-10-22 04:45:00 UTC
The code causing the bug is located at https://invent.kde.org/plasma/libksysguard/-/blob/23a1e84e9ea3de460c41e57ee072fd5459712b6e/processui/ProcessModel.cpp#L2360

```
#if HAVE_X11
    if (d->mIsX11) {
        headings << i18nc("process heading", "X11 Memory");
        headings << i18nc("process heading", "Window Title");
    }
#endif
```

where the headings "must be in the same order that they are in the header file".

When the program is launched under wayland, these two headings would be absent.
Thus, the meaning of the headings and the text will be offset by two in the remaining headings, which makes the text "Total Memory" actually refer to the cgroup column.
Comment 5 Bug Janitor Service 2023-10-22 06:01:10 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/libksysguard/-/merge_requests/301
Comment 6 fanzhuyifan 2023-10-31 08:44:55 UTC
Git commit 557c7a7e3506d7fa699eae038c0688d973014186 by Yifan Zhu.
Committed on 31/10/2023 at 02:18.
Pushed by ahiemstra into branch 'master'.

Make headings correspond to their strings.

Always insert all heading strings.

Previously on wayland some heading strings are not inserted.
This creates a discrepancy between heading strings and actual headings,
leading to values being displayed under the wrong column names in
systemmonitor.

M  +2    -6    processui/ProcessModel.cpp

https://invent.kde.org/plasma/libksysguard/-/commit/557c7a7e3506d7fa699eae038c0688d973014186