I’ll be at GUADEC in Almería this year, giving two talks on Sunday:
GLib: What’s new and what’s next?, which will be a general overview of recent developments in the GNOME utility library, some future plans, and some stats about what happens to contribution rates when you move to GitLab and Meson.
Download management on metered connections, which will be an overview of the Mogwai project, which I’ve worked on in recent months at Endless. Mogwai is a download scheduler, which your code can use to determine the best time to do a big download to avoid incurring bandwidth charges from your internet provider (if you’re on a metered connection).
I won’t be arriving until Sunday morning, but will be around until Thursday (12th) morning, and will be in the GTK+/GLib BoF on Monday in room 2 to plot the next GLib release.
Shout out to my coworker Matthew Leeds’ talk, on P2P Distribution of Flatpaks and OSTrees, which comes towards the culmination of a lot of work by him (and others in Endless, and upstream OSTree and flatpak) to introduce peer to peer support in OSTree and flatpak, so you can distribute OSs and apps using USB sticks and the LAN.
Automatically shutting down daemons when not in use is in vogue, and a good way of saving resources quite easily (if the service’s startup/shutdown costs are low).
libgsystemservice can do this for you automatically, if your code is based on GssService, or if you want to port over to it (which should be fairly straightforward for simple services). It supports inactivity timeouts by default; just call gss_service_hold() when you start doing some activity, and gss_service_release() when you stop.
Having written a few D-Bus system services recently, it felt like I was cargo-culting the same bits of code in all of them. I’ve split some of that out into a new library, libgsystemservice, which I hope will grow to contain all the bits people need to write D-Bus system services and other system daemons.
At the moment, it includes a way to load configuration files from multiple directories (with /etc taking priority over /usr/share, for example); tracking of D-Bus peers which have interacted with your service, and their credentials; and an equivalent of GApplication for system services. (GApplication only works on the session bus, and has various features targetting user applications which aren’t appropriate for system services.)
We’re using this code within Endless at the moment; but the more users it has, the better. Feedback and contributions are very welcome on GNOME’s GitLab.
Firstly, we’re moving to Meson, but with no regressions from autotools. The plan is to target functional compatibility with autotools for 2.58, to keep both build systems in parallel for a release or two, and then drop autotools as soon as we can be satisfied there are no regressions for any of our features or supported platforms. I’d like to encourage distributions and developers to start trying to build GLib with Meson, seeing what breaks, and filing bugs.
Secondly, we’re migrating to gitlab, slowly. The first step is to migrate from cgit to gitlab, which will allow us to set up continuous integration for GLib. This will be a big win. The second step will be to migrate Bugzilla to gitlab. That’s going to take a bit longer, since there are issues with getting the data out of Bugzilla efficiently. All open bugs will be transferred, just like with the other gitlab transitions so far.
The maintainership status of GLib was also discussed. We are short on people power, and would appreciate assistance. If your project or company relies on GLib, please consider helping out with patch review or writing patches. We have three part-time maintainers who can provide guidance and help. We’re particularly interested in finding people to help maintain the platform ports of GLib, like Windows, OS X or BSD, more officially. Find us in #gtk+ on irc.gnome.org.
We also discussed a number of other, smaller features and issues, which might get handled for 2.58 depending on time. If you would like to work on any of them, please do! We can provide guidance and patch review in Bugzilla.
Thanks to Matthias and Emmanuele for organising the hackfest, Allison for turning up and imparting sage GLib wisdom, and Purism for kindly sponsoring dinner on Friday night.
Courtesy of my employer, Endless (we’re hiring), I’m at the GTK+ hackfest in Brussels, which is acting as my warm up for FOSDEM 2018. I’m representing the assorted GLib maintainers, aiming to look at the roadmap for GLib 2.58, and what we need to do to finish off GLib 2.56. If you’ve got suggestions for new features or changes to GLib, get in touch or file a bug!
GMainLoop is a bit of a pain to use if you want to run a main context with non-trivial termination conditions, since you need to put g_main_loop_quit() calls in various places, and the logic for terminating the loop becomes quite spread out.
Instead, it’s better to iterate the underlying GMainContext directly, like this:
while (async_result == NULL)
g_main_context_iteration (context, TRUE);
where your termination condition is async_result != NULL. When changing the termination condition, call g_main_context_wakeup() to ensure the current iteration of the main context is unblocked in order to check the condition again. (This is technically only necessary if you’re changing the condition from another thread, in which case you also want to get/set the condition atomically; but it’s a good habit to get into anyway.)
This allows an easy pattern for turning an asynchronous operation into a synchronous one, which can be quite useful in unit tests:
If you have some code which uses GLib, and it emits a critical warning, for example if a g_return_if_fail() check fails or if a g_warning() message is emitted, how do you track it down and debug it?
Run your code under gdb with G_DEBUG=fatal-warnings (for g_return_if_fail() and g_warning()) or G_DEBUG=fatal-criticals (for g_return_if_fail()), and gdb will break execution when the failing precondition or warning is reached. If there are multiple warnings and you want to skip through to get to a particular one, just use the continue command in gdb until you reach the one you want.
GUADEC 2017 has ended in Manchester. It’s been great; thanks to the organisers and sponsors for a fun conference (this year’s highlight: a preponderance of Tiki bars).
We’ve had sun and heat, and we’ve had rain and more rain. Often within the same hour. On the final day of the conference, a group of us went out to Edale to do some walks to see the Peak District, a national park area near Manchester. This is an area I’ve visited many times before, so it was fun to be able to show it to GNOME people.
This year I gave a talk about the Coverity scans I’ve been running on various GNOME and freedesktop modules for the last year. The slides are online and the video will be up with the rest of the GUADEC videos. If you have a security-critical (or other) module which you’d like to be included in the scan set, let me know. Coverity’s good at finding bugs in complex control flows, but you do need to put some time into triaging its reports. I’m happy to provide guidance about using it.
I spent a fair amount of time during the unconference days reviewing Simon McVittie’s D-Bus work to add support for app-containers into the D-Bus specification and dbus-daemon. This is the first part of an effort to improve support for exposing unconfined D-Bus services to confined app-containers safely and efficiently. The rest of my time was spent working on exciting support for updating flatpak over the LAN for Endless OS. I’ll blog about this more in future.
Thanks to the GUADEC team for organising a great conference, the conference sponsors, and to my employer, Endless, for sponsoring me to go.
Speaking of Hitori, I don’t have much time to maintain it at the moment, and there are some interestingopenfeature requests. If anybody is looking for a fun little project to take on, I am happy to mentor work on them.