Packaging a big stack like the software from the KDE community – Frameworks, Plasma, and all the applications and libraries and tools from the KDE Release Service – takes a fair bit of time and energy. The KDE-FreeBSD team works on both packaging and porting – making sure that KDE applications behave well on FreeBSD just like on other operating systems.

The majority of the work of compatibility happens in Qt, which is also maintained by the KDE-FreeBSD team. Then the KDE frameworks – 80 or so libraries that are small, lightweight, tiered-so-you-know-about-dependencies and LGPL-licensed – pile a bunch of compatibility on top of that for desktop purposes.

But sometimes, an application needs to dig into the system itself. A text editor edits text regardless of the underlying system, but a memory-usage monitor needs to know how to ask the OS about memory-usage.

So this week I spent a fair bit of time in the KSysGuard codebase, because there’s a FreeBSD bug report that says that the memory-usage monitor shows nothing, and another report that says the graph and the status bar don’t match.

This isn’t the first time: apparently in 2009 I did some work on KSysGuard for OpenSolaris. Different times.

Something that has vaguely bugging me since 2017 is the display of micro-kibibytes in KSysGuard. A micro-kibibyte is one one-hundred-and-twenty-secondth of a single bit – let’s call it a centibit – and that is not useful as a measure of memory usage.

It turns out that in 2016, when porting from KLocale (a kdelibs4-era class) to QLocale, some edge cases were missed. Porting is rarely simple. So today I reintroduced the relevant bits, and in the spirit of modern C++ replaced some magic numbers by static constexpr const int values. As a result, KSysGuard tooltips no longer annoy me (assuming the MRs are accepted over on KDE invent).

And then I looked at the upstream bug list, and fixed a buffer overflow if you have implausibly long disk-device names (I suspect this is only relevant with the old Solaris naming scheme).

Once the bug list is open, it’s natural to click around a bit, and I tracked down another bug to a typo in an entirely different repository, which causes translated rich-text markup to break.

The next bug is about column alignment, and I ended up with 10 commits to illustrate the thinking behind what was a relatively simple refactoring, but a single change would be a lot harder to justify.

.. and then it was 2am. What was I trying to fix? I forget.