Skip to content

Welcome to Planet KDE

This is a feed aggregator that collects what the contributors to the KDE community are writing on their respective blogs, in different languages

Saturday, 28 May 2022

A week ago I attended the KDE Eco Sprint in Berlin for some experiments around power consumption measurements and tools for that. It has been the first in-person KDE sprint for me since the start of the pandemic, and even happened to be in exactly the same place as the last pre-pandemic one I have been to.

External energy measurement

I have previously written about what we are looking for in terms of measuring energy consumption of a device, and an experiment to re-purpose a cheap 8€ WiFi power plug for that. While this works, it left some doubts about the precision (or lack thereof) of that solution.

Plot of an example measurement showing power over time.
Gosund SP111 power measurement (200ms sample interval, no filter): mouse cursor being moved between samples 100 and 150, with a peak while hovering a task bar entry.

The sprint provided the opportunity to compare these results with those of a proper power measuring device, in form of a development board with a Microchip MCP39F511N measurement chip.

While still cheap compared to other equipment on the market it’s significantly more expensive than the WiFi plugs (~180$ pre-pandemic, ~260$ now) and isn’t sufficiently encased for safe operations outside of a lab setup and/or by untrained users. With a 5ms sampling interval it has a significantly higher time resolution though, and being properly calibrated means the results are a lot more trustworthy.

Photo of the MCP39F511N and Gosund SP111 devices in action.
MCP39F511N on the bottom left, Gosund SP111 on the top right. (photo by Joseph P. De Veaugh-Geiss)

And here’s the surprising result: The WiFi plugs are actually reasonably accurate, the jagged signal we see isn’t caused by noise or imprecision in their sensors, it’s primarily the effect of considerable undersampling.

When measured with the 40x higher sampling rate of the MCP39F511N we see that the source signal actually has much higher amplitude variations than we see on the WiFi plugs (10-15W on top of an average of 4-5W baseline), but in the form of very short peaks (10-20ms).

This is most likely an effect of how switching power supplies work (with linear resistive loads we get the same nearly perfectly flat line with both). Unfortunately I didn’t capture screenshots of this during the sprint.

The undersampling is purely an effect of the update rate on the external interface, internally the power use is measured correctly during one interval, so accumulated or averaged values match quite closely.

Future Work

Overall this is good news, and shows it’s worth exploring this path further. There’s a few things to look into:

  • Can we modify the Tasmota firmware to report the power readings with a higher update frequency? This seems to be available internally, and is mainly aggregated for human consumption.
  • The necessary software setup for any of the measurement devices is complex, error prone and cumbersome at best. And that’s even without live plotting.
  • We had serious issues with finding a working solution for realtime plotting. Things crashed on startup, didn’t manage to keep up with the 200 samples per second, added random delays or just randomly stopped. And that’s just for the basics and not even looking at other useful things like realtime low-pass/averaging filters.

The good part is that all of those are software problems, something we know how to deal with :)

Internal energy measurement

Another tool to look into further is using built-in power sensors such as those of Intel’s Running Average Power Limit (RAPL). The advantage of those is the wide and continuous availability, and the ability to measure certain system components (CPU, RAM) separately.

Measuring in-place however is only really meaningful if there’s actual system activity, as due to the measurement process itself the system will never fully be idle.

Reading out RAPL measurements isn’t particularly hard, so adding those to e.g. KSystemStats would be an obvious first step to get a feeling for how energy consumption varies under regular system use.

Unfortunately there’s an obstacle, reading those measurements requires elevated privileges. And that’s for good reasons, they are so fine-grained that this opens a potential side-channel attack vector.

So this still needs a bit more thinking about how to make this easily accessible, be it by asking for elevated privileges or by only allowing access to a sufficiently reduced resolution for example.

Contribute!

If you are interested in these topics and want to collaborate or contribute to this, check out KDE Eco’s get involved page.

With in-person meetings slowly and carefully resuming, it also becomes possible to contribute towards that again, by providing a venue (like KDAB did in this case), or by donating to KDE e.V. to support contributors with travel expenses.

We are busy working on the bug reports folks are filing about the Plasma 5.25 beta, and as of right now, we’re down to 15. Working on these is a great way to make a difference quickly!

In addition, features that didn’t make it into Plasma 5.25 are starting to land in 5.26. There’s some very cool stuff this week, so let’s jump in:

15-Minute Bugs Resolved

Current number of bugs: 64, up from 63. 3 added and 2 resolved:

In the Plasma X11 session, Plasma notifications, OSDs, and widget pop-ups are no longer inappropriately minimizable, maximizable, and tilable (Luca Carlon, Plasma 5.26)

Fixed another way that KWin could crash when plugging in or unplugging an HDMI monitor (Xaver Hugl, Plasma 5.24.6)

Current list of bugs

New Features

You can now change the color scheme used by Okular independently of the system color scheme (George Florea Bănuș, Okular 22.08):

Elisa now allows you to disable the automatic music scan on startup, and only do it manually (Jerome Guidon, Elisa 22.08):

The pop-ups of Plasma widgets in the panel are now resizable from their edges and corners just like normal windows, and they remember the sizes you set, too! (Luca Carlon, Plasma 5.26):

The Dictionary widget can now be configured to show results from more than one dictionary at once, but not necessarily all of them (Fushan Wen, Plasma 5.26):

Bugfixes & Performance Improvements

Uninstalling service menu items from Dolphin now works for services menus that have any symlinks in their sets of installed files (Christian Hartmann, Dolphin 22.08)

In the Plasma Wayland session, Plasma no longer immediately crashes right after login when you have an external screen connected in “switch to external screen” mode (someone amazing but probably Vlad, Xaver, or Marco; Plasma 5.25)

The System Tray popup no longer sometimes fails to open after you click on the Notifications icon in the hidden view (Kai Uwe Broulik, Plasma 5.25)

KWin’s “Zoom” effect now works while you’re in the Overview effect and no longer causes glitches when you zoom into a part of the screen that contains a Plasma widget with a blurred background (Vlad Zahorodnii, Plasma 5.25)

Closing the password prompt without entering a password on System Settings’ “Login Screen (SDDM)” page no longer shows a blank error message (Someone going by the pseudonym “oioi 555”, Plasma 5.25)

Multi-line inline messages throughout QtQuick-based software no longer fail to display their text properly under certain circumstances (Ismael Asensio, Frameworks 5.95)

When viewing files in the trash, the process of generating previews for the ones that don’t already have previews no longer results in the files being copied to /tmp (Méven Car, Frameworks 5.95)

In Konsole, the “Get new Color Schemes” window once again works properly (David Edmundson and Alexander Lohnau, Frameworks 5.95, but distros should be backporting it sooner)

User Interface Improvements

In Dolphin’s Details view, when you right-click on an empty part of the view, the row under the cursor will visibly become unselected and pasting files will now paste into the currently visible view, rather than the folder for the row that was right-clicked (Felix Ernst, Dolphin 22.04.2)

The “Eject” button next to mounted disks in Dolphin’s Places panel no longer appears for internal disks and those manually added to your etc/fstab file (Kai Uwe Broulik, Dolphin 22.08)

When you use Spectacle to copy an image to the clipboard, the notification it sends no longer confusingly talks about saving things (Felipe Kinoshita, Spectacle 22.08)

When Okteta (a KDE hex editor app) is installed, previewing files with Ark no longer opens Okteta unless they are actually binary files (Nicolas Fella, Ark 22.08)

Discover now displays a more actionable and relevant error message when you launch it without any app backends available, including a special message tailored specifically for Arch Linux (me: Nate Graham, Plasma 5.25):

The “None” entry in System Settings’ Splash Screen page is now always listed last (Alexander Lohnau, Plasma 5.25)

You can now close Discover while software is being installed, removed, or updates, and it will turn into a system progress notification (Aleix Pol Gonzalez, Plasma 5.26):

Description text in the “Get new [thing]” windows is now selectable and copyable (Fushan Wen, Frameworks 5.95)

You can now convert from teaspoons and tablespoons if you only need to know the equivalent of a single one, and also to and from “sq m”, “sq km” and other common abbreviations (Ahmad Samir, and me: Nate Graham Frameworks 5.95)

…And everything else

This blog only covers the tip of the iceberg! Tons of KDE apps whose development I don’t have time to follow aren’t represented here, and I also don’t mention backend refactoring, improved test coverage, and other changes that are generally not user-facing. If you’re hungry for more, check out https://planet.kde.org, where you can find more news from other KDE contributors.

How You Can Help

If you’re a developer, check out our 15-Minute Bug Initiative. Working on these issues makes a big difference quickly! Also, check out the list of Plasma 5.25 beta bugs; those are also important.

Otherwise, have a look at https://community.kde.org/Get_Involved to discover ways to be part of a project that really matters. Each contributor makes a huge difference in KDE; you are not a number or a cog in a machine! You don’t have to already be a programmer, either. I wasn’t when I got started. Try it, you’ll like it! We don’t bite!

Finally, consider making a tax-deductible donation to the KDE e.V. foundation.

Friday, 27 May 2022

Let’s go for my web review for the week 2022-21.


The EU Commission is planning automatic CSAM scanning of your private communication – or total surveillance in the name of child protection.

Tags: tech, politics, surveillance

The EU Commission is going down a very dangerous path. Clearly pushing the agenda of global surveillance behind false pretenses, not terrorism this time but “protecting children”. It’s usually one of those two excuses being used to justify such attack on privacy.

https://tutanota.com/blog/posts/eu-surveillance-csam/


Google has been DDoSing SourceHut for over a year

Tags: tech, google, go, performance, complexity

Debatable “feature”, bad implementation, dubious community handling… Clearly not a good example to follow from the Go space.

https://drewdevault.com/2022/05/25/Google-has-been-DDoSing-sourcehut.html


CrateDepression | Rust Supply-Chain Attack Infects Cloud CI Pipelines with Go Malware

Tags: tech, security, supply-chain, rust, ci

Interesting forensic of a supply chain attack targetting crates.io. Especially fascinating to me is how it then tries to target CI build environments as preparation for larger attacks.

https://www.sentinelone.com/labs/cratedepression-rust-supply-chain-attack-infects-cloud-ci-pipelines-with-go-malware/


The mindless tyranny of ‘what if it changes?’ as a software design principle - Blogomatano

Tags: tech, craftsmanship, architecture

A bit on the sarcastic side but there’s definitely some truth to it. This definitely goes against the YAGNI principle.

https://chriskiehl.com/article/the-tyranny-of-what-if-it-changes


Proper use of Git tags | Dan Aloni

Tags: tech, git

Good advices on using tags properly for versioning.

https://blog.aloni.org/posts/proper-use-of-git-tags/


The balance has shifted away from SPAs | Read the Tea Leaves

Tags: tech, web, browser, frontend, complexity

Interesting opinion. Indeed, as the browsers are packing more features they can deal with more frontend complexity themselves. This is an opportunity to reduce the amount of code in the frontend code at least for some use cases.

https://nolanlawson.com/2022/05/21/the-balance-has-shifted-away-from-spas/


The forgotten benefits of “low tech” user interfaces

Tags: tech, usability, low-tech, ux, complexity

An excellent reminder that usability wise, high-tech is not always the best path. It’s good to also evaluate low-tech options at every turn. This is important to know the pros and cons of all the options you can pick. There’s also an interesting point in there about how those more constrained technologies in fact force and help designers to focus on the most important user features.

https://uxdesign.cc/the-forgotten-benefits-of-low-tech-user-interfaces-57fdbb6ac83?gi=20c9b889b409


Pong

Tags: tech, electronics, gaming

Very cool reverse engineering of the schematics of the infamous Pong game. It had no software and no CPU either. Quite a feat.

https://www.falstad.com/pong/



Bye for now!

Thursday, 26 May 2022

KStars v3.5.9 is released on 2022.05.26 for MacOS, Linux, and Windows. It's a bi-monthly bugfix release with a couple of exciting features.

DSS Offline HiPS

HiPS (Hierarchical Progressive Surveys) is a technology that provides progressive high resolution images of the sky at different zoom levels. KStars fully supports online HiPS where data is downloaded from online servers and cached to display on the Sky Map.


One of the most popular catalogs in KStars is the DSS Colored progressive survey. With v3.5.9, you can now specify directory where the offline DSS catalog is located. You can download the data from various HiPS services online. For best experience, it's recommended to download 3rd, 4th, and 5th (Norder3, Norder4, and Norder5) order directories which would take around 1GB of storage space. You may download further orders (i.e. higher zoom levels) at the expense of more storage space.

The following shows a sample of downloaded order directories, at minimum you need Norder3 folder for this functionality to work.


Revamped Mosaic Planner

New simplified and powerful Mosaic Planner directly integrated in the Sky Map. It greatly benefits from HiPS overlay to make your target framing spot on. Toggle the Mosaic View from the tool bar, and select your equipment and the mosaic configuration. You can also use it as a very simple tool to frame a single 1x1 tile.



Adjust the tile center either by manually specifying the J2000 center or by dragging the tiles across the sky map. Once done, you can command the mount to go to the target and solve. Alternatively, you can proceed to create jobs for the Ekos Scheduler. After the jobs are added, you may start the scheduler at any time to plan the mosaic session accordingly.

Refocus After Meridian Flip


Dušan Poizl
 added the ability to refocus after a meridian flip is complete. This is very useful for some optical train setups where the focuser might shift duration the flip.

New Index Files


Robert Lancaster added the new 5200 astrometry index files. The difference is just which star surveys were used to build which indexes. The 4200 Series was made from 2MASS and covers all the image scales. The 4100 series was made from Tycho2 but only covers wide image scales. The 5200 series was just recently added, was made by blending Tycho2 and Gaia, and complements the 4100 series to give it the smaller scales.

Internal Plumbing: Introducing Device Adapter

Wolfgang Reissenberger continues his outstanding work refactoring Ekos state machine by introducing the device adapter. Next step extracting state handling from Capture into a dedicated state machine. In this step devices are managed by a dedicated device adapter (successor of the command processor). With this refactoring it is no longer necessary to route device events from Capture through SequenceJob to the state machine, the device adapter sends the events directly to the state machine.

Capture Progress face lift


Wolfgang Reissenberger streamlined the capture progress section of Capture:

  • Remaining time for frame and sequence displayed as hh:mm:ss
  • Display of average download time (in calculation, all download times are taken into account and not only those > 1)
  • New status widget with a color LED displaying the capture status (and no longer using the seconds text for this)
  • Using the same widget on the Master tab 

Greedy Scheduler Speeds up


Fans of Greedy Scheduler rejoice! Hy Murveit made significant speedups to the Greedy Scheduler, especially for very large scheduler. 


By Johnny Jazeix



Google Summer of Code (GSoC) is a global, online program focused on bringing new contributors into open source software development. Like every year, KDE applies and aims to integrate more and more developers. This year, KDE's participation in GSoC kicks off with nine fascinating projects.


NeoChat will get support for Spaces.

Snehit Sah will be adding support for Spaces in NeoChat. Spaces is a Matrix tool that allows you to discover new rooms and also a way of organizing your rooms into categories. Snehit already successfully contributed to the Season of KDE 2022 where he improved the packaging of several applications of KDE for Flathub.

Suhaas Joshi will work on permission management for Flatpak and Snap applications in Discover. This will allow you to change the permissions granted to an application (e.g. file system, network, and so on) and also make it easier to review them. It is the continuation of his work during the Season of KDE where he implemented the display of Flatpak applications permissions on Discover.

This year we have two projects to improve digiKam. The first one is from Quoc Hung Tran who will work on a new plugin to process Optical Character Recognition (OCR). This will allow to extract text from images and store the output inside the EXIF data or within a separate file. The plugin will also be used to organize scanned text images with contents.

The second project is from Phuoc Khanh LE who will work on improving the Image Quality Sorter algorithms. This will improve sorting images by quality using multiple criteria, for example, noise, exposure and compression.

This is the second stage of the original project from GSoC 2021 and aims to classify photos by quality (e.g. global exposure, blur, compression, noise, etc.). The first stage was an algorithm based on computer vision classic, as well as image metadata (such as focus point). The second stage involves studying and implementing a more generic algorithm based on Deep Learning. This project will help simplify significantly the complexity of code and improve performance especially when running on a GPU, and will also pave the way for more generic usage in other KDE software. For instance, it can be useful to inspect the image and spot out where to enhance it, or how much it can be enhanced.

Smit Patil will work on Plasma System Settings, redesigning the different modules by porting them to QtQuick. This will help with the transition to Qt6 and clean some technical debts by better splitting the UI code from the core logic.

This year we have two projects working on the education software suite GCompris. Both Aastha Chauhan and Samarth Raj will work on adding new activities to GCompris. Aastha Chauhan will work on adding a programmable Tux, a comparator activity and the Guess 24 game in GCompris.


Mockups of Programmable Tux, Comparator and Guess 24 for GCompris.

Samarth Raj will work on an activity for grammatical analysis and another one for using the 10's complements to add numbers.

Two students will work on the painting application Krita. Xu Che will add pixel-perfect ellipses in Krita. This will allow to make it possible for pixel artists to use Krita effectively.

Meanwhile, Reinold Rojas will work on exporting an image to SVG in Krita; a project that will provide more options to share files with Inkscape, and will help create translatable images with text for Krita Manual without knowledge of Inkscape.

There is more about Krita's GSoC projects in their blog.

We would like to welcome the new contributors and hope they will have a wonderful summer within KDE and become part of the community.

Follow their progress through their blog posts on KDE's Planet.

Every sizable project has a ‘utils’ file or folder that contains functionality that is needed more than once but too small to be a library. KDE is no different, except we want to share our ‘utils’ folder across hundreds of projects. This is where the KCoreAddons framework comes into play. The name comes from the fact that it consists of addons to QtCore, extending existing functionality from it or implementing things that are missing. Let’s look at what it offers.

Plugin Support

Plugins are a common architectural element in applications that, for example, allow for third-party extensions. Qt offers a cross-platform means of building binary plugins, QPluginLoader. KCoreAddons offers some additional functionality for loading plugins based on QPluginLoader.

We often want to list all available plugins to, for example, provide a UI for configuring them. To list all plugins in $QT_PLUGIN_PATH/myplugins, we would write code like this:

QSet<QString> plugins;

QStringList dirs = QCoreApplication::libraryPaths();

for (QString dir : dirs) {
    QDirIterator it(dir + “/myplugins”, QDir::Files);

    while (it.hasNext()) {
        it.next();

        if (!plugins.contains(it->fileName())) {
            plugins << it->fileName();
        }
    }
}

Not too bad, albeit a bit verbose. However, if we want it to work properly on Android, we’d need extra code; plugin naming and loading work differently there. The handling of static plugins would require extra code, too.

KCoreAddons offers a convenient function that abstracts away all of the boring details and edge-cases:

QVector<KPluginMetaData> plugins = KPluginMetaData::findPlugins("myplugins");

KPluginMetaData contains a parsed version of the plugin’s JSON metadata (QPluginLoader::metaData()). It offers convenient support for common metadata keys, such as information about the plugin’s author and license, but can be used to read arbitrary metadata.

The plugins can then be loaded using the familiar QPluginLoader:

for (const KPluginMetaData &plugin : plugins) {
    QPluginLoader loader(plugin.fileName());
    MyInterface *iface = qobject_cast<MyInterface *>(plugin.instance());
}

This works great for many use-cases. However, sometimes you want to create multiple instances of MyInterface. This is something that QPluginLoader does not allow. KPluginFactory comes to the rescue, here.

To use it, we need to define our interface and implementation in a particular way:

// myinterface.h

class MyInterface : public QObject
{
    MyInterface(QObject *parent, const KPluginMetaData &metaData, const QVariantList &args);
}


// myimpl1.cpp

#include “myinterface.h”

#include <KPluginFactory>

class MyImpl1 : public MyInterface {

MyImpl1(QObject *parent, const KPluginMetaData &metaData, const QVariantList &args)
    : MyInterface(parent, metadata, args)
{
}

}

K_PLUGIN_CLASS_WITH_JSON(MyImpl1, “metadata.json”)

#include “myplugin.moc”

metaData gives access to the plugin’s JSON metadata from within the instance.
args allows passing additional arguments while creating the instance, which is useful for per-instance configuration.

Now, an instance can be created using the following:

KPluginMetaData metaData(“myinterface/myimpl1”);
QObject *parent = …;
QVariantList args = …;
KPluginFactory::Result result = KPluginFactory::instantiatePlugin<MyInterface>(metaData, parent, args);

if (result) {
    MyInterface *instance = result.plugin
} else {
    qDebug() << “could not load plugin” << result.errorText
}

instantiatePlugin returns a result object that contains the instantiated plugin (if successful) and information about what went wrong otherwise.

KUser

Sometimes, you want to query some information about the user of your software to, for example, greet them with their full name. KUser provides a cross-platform way to query information about user accounts that are on the system.

KUser user; // The current user

qDebug() << “Hello” << user.fullName();

KFormat

Displaying data to the user is the bread-and-butter of many applications. The way the data is formatted and presented can make or break the overall user experience. The KFormat class helps with formatting values, date and time information, and durations in a visually-appealing way.

For instance, when displaying the date of an event, we may want to show “Yesterday” or “Last Tuesday,” if the event happened recently, and the exact date, if the event happened further in the past:

QDate date = …;

KFormat format;

qDebug() << format.formatRelativeDate(date, QLocale::LongFormat);

When displaying durations, we may want to show the value in a textual way instead of e.g., raw milliseconds:

KFormat format;

qDebug() << format.formatSpelloutDuration(62005); // prints “1 minute and 2 seconds”

When showing the size of a file, we are usually not interested in full precision; an approximation is often enough. Furthermore, files come in a wide range of sizes, from bytes to gigabytes. Depending on the size, we want to choose an appropriate prefix (e.g. kB or GB). This is where formatByteSize is useful:

QFile file(…);

KFormat format;

// prints “1.4 MB
qDebug() << format.formatByteSize(file.size(), 1, KFormat::MetricBinaryDialect);

formatByteSize allows the tweaking of things like precision, prefix, and unit dialect (e.g. MiB vs MB).

KStringHandler

KStringHandler offers useful useful helper functions for string manipulation. For example, the lsqueeze/csqueeze/rsqueeze functions allow limiting a string to a specified length, adding ellipsis (“…”) where needed.

// prints “KDE is … awesome”
qDebug() << KStringHandler::csqueeze(“KDE is really awesome”, 19);

KStringHandler::capwords capitalizes every word in a sentence:

// prints “The Quick Brown Fox Jumped Over The Lazy Bridge.”
qDebug() << KStringHandler::capwords(“The quick brown fox jumped over the lazy bridge.”);

Many More Useful Features…

This is just the tip of the iceberg. KCoreAddons offers many more useful features for application developers. For the full list, please consult the API documentation.

KCoreAddons is supported on Linux, Windows, macOS, Android, and FreeBSD. You can find the source code on KDE’s Gitlab instance.

Stay tuned for the next KDE Frameworks introduction post!

If you missed parts one and two of this blog series, please take a look at those as well.

The post KDE Frameworks – Part 3 appeared first on KDAB.

In the face of a growing feature set in any project, getting started becomes harder and harder for new users. This problem is common for many software applications, and LabPlot is no exception. To overcome this problem we’re investing more resources into creating documentation in general, and introductory articles in particular.

We’re also working on a set of short videos that introduce LabPlot’s wide range of core features and aspects.

Finally, in our effort to make LabPlot more accessible for everybody, in our latest release, we added a set of example projects that are installed together with the application and that will provide you with a way to see how certain things can be implemented in LabPlot, as well as help you explore the available feature set and learn more about it.

You can reach the collection of the example projects from the main menu of the application. The dedicated dialog lets you browse the available projects:

Example Projects

Projects are grouped together into different categories:

General includes various example projects that demo LabPlot’s main features.

Analysis includes example projects that explore LabPlot’s data analysis capabilities, such as smoothing, fitting, etc.

Computing includes projects that leverage a variety of open-source computer algebra systems and programming languages used for scientific computation.

Statistics offers examples of LabPlot’s features used for the statistical analysis of data.

Upon selection and loading, the example project is ready to be explored and modified:Basic Plots Example Project

Right now the collection includes 19 projects and we plan to add more examples over time. We also invite you to contribute your ideas and projects so that we can add to this collection in the future.

Wednesday, 25 May 2022

Get some popcorn and strap in for a long one! I shall delight you with some insights into crash handling and all that unicorn sparkle material.


Since Plasma 5.24 DrKonqi, Plasma’s infamous crash reporter, has gained support to route crashes through coredumpd and it is amazing – albeit a bit unused. That is why I’m telling you about it now because it’s matured a bit and is even more amazing – albeit still unused, I hope that will change.

To explain what any of this does I have to explain some basics first, so we are on the same page…

Most applications made by KDE will generally rely on KCrash, a KDE framework that implements crash handling, to, well, handle crashes. The way this works depends a bit on the operating system but one way or another when an application encounters a fault it first stops to think for a moment, about the meaning of life and whatever else, we call that “catching the crash”, during that time frame we can apply further diagnostics to help later figure out what went wrong. On POSIX systems specifically, we generate a backtrace and send that off to our bugzilla for handling by a developer – that is in essence the job of DrKonqi.

Currently DrKonqi operates in a mode of operation generally dubbed “just-in-time debugging”. When a crash occurs: KCrash immediately starts DrKonqi, DrKonqi attaches GDB to the still running process, GDB creates a backtrace, and then DrKonqi sends the trace along with metadata to bugzilla.

Just-in-time debugging is often useful on developer machines because you can easily switch to interactive debugging and also have a more complete picture of the environmental system state. For user systems it is a bit awkward though. You may not have time to deal with the report right now, you may have no internet connection, indeed the crash may be impossible to trace because of technical complications occurring during just-in-time debugging because of how POSIX signals work (threads continue running :O), etc.

In short: just-in-time really shouldn’t be the default.

Enter coredumpd.

Coredumpd is part of systemd and acts as kernel core handler. Ah, that’s a mouthful again. Let’s backtrace (pun intended)… earlier when I was talking about KCrash I only told part of the story. When fault occurs it doesn’t necessarily mean that the application has to crash, it could also neatly exit. It is only when the application takes no further action to alleviate the problem that the Linux kernel will jump in and do some rudimentary crash handling, forcefully. Very rudimentary indeed, it simply takes the memory state of the process and dumps it into a file. This is then aptly called a core dump. It’s kind of like a snapshot of the state of the process when the fault occurred and allows for debugging after the fact. Now things get interesting, don’t they? 🙂

So… KCrash can simply do nothing and let the Linux kernel do the work, and the Linux kernel can also be lazy and delegate the work to a so called core handler, an application that handles the core dumping. Well, here we are. That core handler can be coredumpd, making it the effective crash handler.

What’s the point you ask? — We get to be lazy!

Also, core dumping has one huge advantage that also is its disadvantage (depending on how you look at it): when a core dumps, the process is no longer running. When backtracing a core dump you are looking at a snapshot of the past, not a still running process. That means you can deal with crashes now or in 5 minutes or in 10 hours. So long as the core dump is available on disk you can trace the cause of the crash. This is further improved by coredumpd also storing a whole lot of metadata in journald. All put together it allows us to run drkonqi after-the-fact, instead of just-in-time. Amazing! I’m sure you will agree.

For the user everything looks the same, but under the hood we’ve gotten rid of various race conditions and gotten crash persistence across reboots for free!

Among other things this gives us the ability to look at past crashes. A GUI for which will be included in Plasma 5.25. Future plans also include the ability to file bug reports long after the fact.

Inner Workings

The way this works behind the scenes is somewhat complicated but should be easy enough to follow:

  • The application produces a fault
  • KCrash writes KCrash-specific metadata into a file on disk and doesn’t exit
  • The kernel issues a core dump via coredumpd
  • The systemd unit coredump@ starts
  • At the same time drkonqi-coredump-processor@ starts
  • The processor@ waits for coredump@ to finishes its task of dumping the core
  • The processor@ starts drkonqi-coredump-launcher@ in user scope
  • launcher@ starts DrKonqi with the same arguments as though it had been started just-in-time
  • DrKonqi assembles all the data to produce a crash report
  • the user is greeted by a crash notification just like just-in-time debugging
  • the entire crash reporting procedure is the same

Use It!

If you are using KDE neon unstable edition you are already using coredumpd based crash reporting for months! You haven’t even noticed, have you? 😉

If not, here’s your chance to join the after-the-fact club of cool kids.

KCRASH_DUMP_ONLY=1

in your `/etc/environment` and make sure your distribution has enabled the relevant systemd units accordingly.

This year’s Google Summer of Code is different from previous editions: there are both larger and smaller projects possible, and it’s no longer limited to students. We have two participants this year: Reinold Rojas and Xu Che.

Reinold Rojas previous cleaned up and improved the recorder docker, added color sample preview to the color sampler and fixed a number of bugs. This time, he will be working on exporting a Krita image to an SVG file. You can already save a vector layer as an SVG file, but not a complete Krita image. The plan is to preserve the layer structure of the Krita image, with vector layers staying vector layers and raster layers becoming embedded PNG images. Of course, not everything you can do in a Krita image can be saved to SVG, and Krita will warn you if you will lose information.

Xu Che has already started a proof of concept of his project: implementing pixel-perfect ellipses for raster layers, making this tool suitable for pixel art. This is something many people have asked for before, as in this feature request, so it’s very exciting to see this happening now!

The post Google Summer of Code, 2022 edition! appeared first on Krita.

Tuesday, 24 May 2022

We are happy to announce the release of Qt Creator 7.0.2!