gnome-web-photo segfaults (segment fault)! OH NOES!

We capture images from beautiful web pages all over the world by exposing the gnome-web-photo package through a simple web service. After moving the service to a new server today gnome-web-photo suddenly started segfaulting (aka segment fault).

Running the application as the same user as the web server worked (after fixing the home directory so that gconf etc was able to create its files), but when running in the web server process itself things segfaulted.

The next attempt was to run both the working and non-working version through strace and see what the difference were, and apparently things segfaulted when the working process accessed <home directory>.mozilla/. This was the first access to anything inside the home directory of the user, which provided the solution:

When the process was running under the web server, the HOME environment variable was not set, but while running under the user from the shell (through su -), it was present. gnome-web-photo (or Firefox?) apparently does not feature any sort of fallback if the HOME environment variable is missing and segfaults instead.

Maybe that could be a patch for the weekend, but hey, the Olympic Games are on!

Fixing dpkg / apt-get Problem With Python2.6

While trying to upgrade to Python 2.6 on one of my development machines tonight I was faced by an error message after running apt-get install python2.6:

After unpacking 0B of additional disk space will be used.
Setting up python2.6-minimal (2.6.4-4) ...
Linking and byte-compiling packages for runtime python2.6...
pycentral: pycentral rtinstall: installed runtime python2.6 not found
pycentral rtinstall: installed runtime python2.6 not found
dpkg: error processing python2.6-minimal (--configure):
 subprocess post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python2.6:
 python2.6 depends on python2.6-minimal (= 2.6.4-4); however:
  Package python2.6-minimal is not configured yet.
dpkg: error processing python2.6 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Attempting to install python2.6-minimal wouldn’t work, attempting to install python2.6 proved to have the same problem.

Luckily the Launchpad thread for python-central provided the answer: Upgrade python-central first!

:~# apt-get install python-central
Setting up python2.6 (2.6.4-4) ...
Setting up python-central (0.6.14+nmu2) ...

Fixing Issue With PHPs SoapClient Overwriting Duplicate Attribute and Tag Names

The setting:

An SOAP request contains an Id attribute – and an element with the exact name in the response (directly beneath the element containing the attribute – an immediate child):


The problem is that the generated result object from the SoapClient (at least of PHP 5.2.12) contains the attribute value, and not the element value. In our case we could ignore the z:Id attribute, as it was simply an Id to identify the element in the response (this might be something that ASP.NET or some other .NET component does).

Our solution is to subclass the internal SoapClient and handle the __doRequest method, stripping out the part of the request that gives the wrong value for the Id field:

class Provider_SoapClient extends SoapClient
    public function __doRequest($request, $location, $action, $version)
        $result = parent::__doRequest($request, $location, $action, $version);
        $result = preg_replace('/ z:Id="i[0-9]+"/', '', $result);
        return $result;

This removes the attribute from all the values (there is no danger that the string will be present in any other of the elements. If there is – be sure to adjust the regular expression). And voilá, it works!

Blogging Each Day For A Month – The Results Show

January has come to an end and in total I managed to blog each day except the 2nd and the 31st. I do not have a plan of continuing on that level, so I’ll probably slide back to the regular frequency of updates (1-2 a month) in the coming weeks. This spur of updates occured as I suddenly had inspiration to do five or six posts in an evening, actually making it possible to keep up the tempo for a couple of weeks. After a while things got a lot harder and I started to slide away from my regular posting time of 11am, but I got the posts out! Now it’s time to look at the stats for the previous month!

My blog is mainly search driven – I cover lots of one-off problems, attempting to include and descriptive error messages and other hints that people may use when they’re using Google to try to find an answer to a task they’re having problems with. This means that people don’t stay around to read other articles than the one they came here for, and so far this has meant that writing a new article usually has given me a small increment in traffic.

As December had the holidays – and searches for the terms I cover drop in large number during those days – I’m using the numbers from October 2009 for comparison. November is a day short.

October January
Visits 3 643 4 352 (+19%)
Pageviews 4 529 5 636 (+24%)

Time spent on the site increased with 7 seconds to 59 seconds – still nothing to write home about.