Something completely different

I will take part in a little experiment with a couple of friends, trying this newfangled technology thingy with games and stuff. So tonight, Feb 14th, 2017, 20:15 CET, we will try to release our inner Bernhard Langer and amaze you with our virtual golfing skills!
Come and watch LIVE, in color and whatnot at https://twitch.tv/phako78 (that’s with a camera pointing at me) or https://twitch.tv/fallenbeck (that’s with a camera pointing at someone else) – Unfortunately, except for some swearing, it’ll be German language only.

Updates

Quiztime

First, a wrap-up of the last Quiztime. For an excellent explanation of the issue, read this comment. Also note that this is not the most nice way to do plugins with C++, it’s a boiled down piece of code I debugged.

Shotwell

I’m not sure if there is some confusion about the current development model of Shotwell. I noticed that some distributions seem to try to pick up the current development branch (0.25.x). I strongly advise against that at this point in time. It has just seen a major change in the Menu handling code and might still have severe usability regressions.
While I appreciate any testing of the code, I would really not have the current unstable version of Shotwell stuck in a released distribution. If you want to try those releases on Ubuntu, there is an unstable PPA available.
So to sum up: Shotwell follows the “traditional” version scheme of “Odd is unstable, even is stable” and roughly tries to stick to the GNOME release schedule.

Quiztime II

So, following up from the last quiztime which was about the importance of explicit linking, another case from the wonderful world of shared libraries.
This time we study the implications of dlopen, its parameters and C++. Consider the program and module below. If you run that, it will crash somewhat obscurely in libstdc++. Why?

#0  0x00007f687b2eb126 in std::ostream::sentry::sentry(std::ostream&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x00007f687b2eb889 in std::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2  0x00007f687b2ebd57 in std::basic_ostream >& std::operator< <  >(std::basic_ostream >&, char const*) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007f687a6f01a0 in Impl::print (this=0x558a9bc1f2e0, str="Hello") at module.cc:24
#4  0x0000558a99de3d1b in main (argc=1, argv=0x7ffca28cf538) at main.cc:31
#ifndef INTERFACE_H
#define INTERFACE_H
#include 
class IInterface {
    public:
        virtual ~IInterface() {};
        virtual void print(const std::string& str) = 0;
};
#endif // INTERFACE_H
#include "interface.h"
#include 
class Impl : public IInterface {
    public:
        Impl();
        virtual ~Impl();
        void print(const std::string& str);
};
extern "C" {
void *entry_point(void)
{
    return new Impl;
}
};
Impl::Impl() {};
Impl::~Impl() {};
void Impl::print(const std::string& str)
{
    std::cerr < <"Some text to print\n";
    std::cerr << "Got passed this: " << str << "\n";
    std::cerr << "=====\n";
}
#include 
#include 
#include "interface.h"
extern "C" {
typedef void *(*EntryFunction)(void);
};
int main(int argc, char *argv[])
{
    IInterface *iface;
    EntryFunction f;
    void *lib = dlopen("./module.so", RTLD_NOW | RTLD_DEEPBIND);
    if (lib == nullptr) {
        std::cerr < < dlerror () << "\n";
        return 1;
    }
    f = (EntryFunction) dlsym (lib, "entry_point");
    if (f == nullptr) {
        std::cerr << dlerror () << "\n";
        return 1;
    }
    iface = reinterpret_cast(f());
    while (true) {
        iface->print ("Hello");
    }
}
.PHONY: all clean
all: main module.so
clean:
	rm -f main
	rm -f module.so
main: main.cc
	g++ -g -o $@ $< -ldl
module.so: module.cc
	g++ -g -o $@ -shared $< -fPIC

Shotwell moving along

I have released 0.25.0 on Monday.

Contrast Tool

contrast-toolA new feature that was included is a contrast slider in the enhancement tool, moving on with integrating patches hanging around on Bugzilla for quite some time.

SSL certificate handlingcertificate-warning

A second enhancement that was introduced is the option to override invalid SSL certificates. This is currenly only available in the Piwigo publisher and might be added to Gallery3 in future, i.e. all services that might be self-hosted on self-signed cerfificates.

 

Enhanced ACDSEE support

0.25 introduces the support of reading ACDSEE’s proprietary image tags such as titles, categories and hierarchical tags!
If you want to try it, there’s a new, unstable, PPA for Shotwell at https://launchpad.net/~yg-jensge/+archive/ubuntu/shotwell-unstable
 

Quiztime!

Say you have a shared library with versioned symbols that has the function init(int *param) defined in two versions, where new_init is made the default for init (that’s what the  @@ means):

#include "shared1.h"
void new_init (int *param)
{
    *param = 0;
}
void old_init (int *param)
{
    *param = -1;
}
__asm__(".symver new_init,init@@VERS_2");
__asm__(".symver old_init,init@VERS_1");

Say you have a second shared library that provides a function do_something() uses that init from the first shared library:

#include "shared1.h"
int do_something ()
{
    int var;
    init (&var);
    return var;
}

And you have an app that just prints the result:

#include "shared2.h"
#include 
int main(int argc, char *argv[])
{
    printf ("Result: %d\n", do_something ());
    return 0;
}

And all of this is cobbled together with the following Makefile:

all: app
libshared.so: shared1.c shared1.h
    cc -o $@ $< -shared -fPIC -Wl,--version-script=version.script
libmoreshared.so: libshared.so shared2.c
    cc -o $@ shared2.c -shared -fPIC
app: libmoreshared.so app.c
    cc -o $@ -L. app.c -lmoreshared -lshared

What's the output of

LD_LIBRARY_PATH=. ./app

Update: Try to answer it without compiling and running it at first.
Update2: I forgot the version.script, sorry.

VERS_1 {
    local:
        old_init;
};
VERS_2 {
    local:
        new_init;
} VERS_1;

More updates

SystemD conf 2016

I will be giving a presentation at this year’s systemd conf in Berlin. If you ever wondered what the hell I am doing during the day, there’s your chance to get a glimpse 🙂

GUPnP going 1.0!

Parts of GUPnP (that is its core, GSSDP and GUPnP itself) will see a 1.0 release together with the next GNOME release. They are quite stable API-wise and functionality-wise now and I think it’s time to give them a proper blessing for that.
After that, master will become more unstable in regards of API, as there are some long-standing bugs and fixes that need an API change as well as new features to be added, such as proper IPv6 support, support for more recent versions of the UPnP standard (UDA 1.1, UDA 2.0), a more GIO-like async API,…

Rygel

We’ve been digging up some annoying age-old bugs or regressions deep down in Rygel for some corner-cases (Did you know that renderer unmute was broken since 2013?)

Shotwell

Some more usability fixes on their way, but the big roadblock of RAW import performance is still proving to be quite annoying. Bit like a hydra, really. You cut of one RAW developer, three new seem to disappear.

Project Lazarus: GtkTerm

I took GtkTerm and poked a bit at its source, mainly for two reasons

  • Dry-run some GTK modernisation that will be necessary in Shotwell as well (GAction etc.)
  • It’s the least worst (sic) of the graphical serial terminals I tried. At least it seems to cope way better with odd USB <-> Serial adapters than t rest of the bunch
  • I use it

Ok, that’s three reasons.
If you want to have a look, head over to its repository at https://github.com/phako/gtkterm

Rygel/Shotwell/GUADEC

  • Rygel is currently mainly receiving maintenance things because reason. This is hopefully changing soonish
  • I picked up Shotwell as maintainer and things are coming along nicely, though its architecture sometimes makes changes that sound really easy very hard (e.g. certain import performance improvements). Most annoying part, though, is that the merging of the awesome map feature is somewhat affected by the recent woes regarding MapQuest’s tile server
  • I’m going to be at GUADEC during its core days

That’s all for now.

Rygel updates

This is going to be a bit longer than usual. I’m going to present some of the changed that have gone into Rygel since the last post (Wow, over a year ago…, sorry about that)

Inner changes

After 0.24, Rygel has received a new internal resource handling that basically decouples the UPnP item from a file so that – in theory – an UPnP item can have multiple on-disk resources.
Unfortunately, this code was contributed as a big lump of code; I tried to split it up and make it more manageable, but the result was that the 0.26 series of Rygel has had several regressions, sorry about that. The 0.28.3 stable release should be as good as the 0.24 release.

New features

Access control

Rygel has gained support for a simple access control mechanism. It’s rather simple and checks whether access to an URI is allowed by a remote peer using DBus.
Unfortunately there is no “policy engine” yet. So from a user perspective, there is currently no difference. Implementing this is on the agenda for 0.32.

More robust

MediaExport’s meta-data extraction was made more robust by moving the extraction into its own process. Files that cause the extraction process to crash will be black-listed and never touched again. There is a new tool in the GIT that lets you investigate the database, the black-list and remove uris from that blacklist.

DVD support

With the upcoming stable release 0.30, Rygel’s MediaExport plugin will gain support for exposing DVD images, either as ISO files or as VIDEO_TS folders. Expect some rough edges; for example, many clients will not be able to seek in the video files as it requires some non-mandatory DLNA seeking features for now. Also DVDs with many titles are not really nice to navigate.

LightMediaScanner support

Rygel has gained support for exposing the contents of LightMediaScanner’s media index.

Request for support

The UPnP forum has been merged with the OCF. Unfortunately, this means that there is no longer a free membership available with access to the certification tools. There is a new non-profit membership which even allows for certification, but it costs $1000. While I’m willing to pay a large chunk of that myself, it would be awesome if some people would join me in making this happen for Rygel and GUPnP sooner. It would allow me to get them more compliant, tested (e.g. for IPv6 support) and maybe even UPnP certified. I would like to setup some crowd funding thing for that, but I have no clue which platform I should use. Is there any site that doesn’t upset RMS?
That’s all for now.