Older blog entries for Stevey (starting at number 577)

Failing to debug a crash with epiphany-browser and webkit

Today I'm in bed, because I have le sniffles, and a painful headache. I'm using epiphany to write this post, via VNC to my main desktop, but I'm hating it as I've somehow evolved into a state where the following crashes my browser:

  • Open browser.
  • Navigate to gmail.com
  • Login.
  • Wait for page to complete loading, showing my empty inbox.
  • Click "signout".

Running under GDB shows nothing terribly helpful:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff51a0a46 in ?? () from /usr/lib/libwebkit-1.0.so.2
#2  0x00007ffff3d8f79d in ?? () from /usr/lib/libsoup-2.4.so.1
#3  0x00007ffff2a4947e in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#4  0x00007ffff2a5f7f4 in ?? () from /usr/lib/libgobject-2.0.so.0
...

To get more detail I ran "apt-get install epiphany-browser-dbg" - this narrows down the crash, but not in a useful way:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff51a0a46 in finishedCallback (session=<value optimized out>, msg=0x7fffd801d9c0, data=) at ../WebCore/platform/network/soup/ResourceHandleSoup.cpp:329
#2  0x00007ffff3d8f79d in ?? () from /usr/lib/libsoup-2.4.so.1
#3  0x00007ffff2a4947e in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#4  0x00007ffff2a5f7f4 in ?? () from /usr/lib/libgobject-2.0.so.0
..

So this crash happens in ResourceHandleSoup.cpp. Slowly I realized that this came from the webkit package.

We see that the last call by name is to the function in line ResourceHandleSoup.cpp:329, that puts us at the last line of this function:

// Called at the end of the message, with all the necessary about the last informations.
// Doesn't get called for redirects.
static void finishedCallback(SoupSession *session, SoupMessage* msg, gpointer data)
{
    RefPtr<ResourceHandle> handle = adoptRef(static_cast<ResourceHandle*>(data));

    // TODO: maybe we should run this code even if there's no client?
    if (!handle)
        return;

    ResourceHandleInternal* d = handle->getInternal();

    ResourceHandleClient* client = handle->client();
    if (!client)
       return;

..
..
    client->didFinishLoading(handle.get());
}

So we see there is some validation that happens, then a call to "didFinishLoading" and somewhere shortly after that it dies. didFinishLoading looks trivial:

void WebCoreSynchronousLoader::didFinishLoading(ResourceHandle*)
{
      g_main_loop_quit(m_mainLoop);
      m_finished = true;
}

So my mental-debugging is stymied. I blame my headache. It looks like there is no obvious NULL-pointer deference, if we pretend client cannot be NULL. So the next step is to get the source, the build-dependencies and then build a debug version of webkit. I ran "apt-get source webkit", then editted the file ./debian/rules to add --enable-debug and rebuilt it:

skx@precious:~/Debian/epiphany/webkit-1.2.7$ DEB_BUILD_OPTIONS="nostrip noopt" debuild -sa

*time passes*

The build fails:

  CXX    WebCore/svg/libwebkit_1_0_la-SVGUseElement.lo
../WebCore/svg/SVGUseElement.cpp: In member function ‘virtual void WebCore::SVGUseElement::insertedIntoDocument()’:
../WebCore/svg/SVGUseElement.cpp:125: error: ‘class WebCore::Document’ has no member named ‘isXHTMLDocument’
../WebCore/svg/SVGUseElement.cpp:125: error: ‘class WebCore::Document’ has no member named ‘parser’
make[2]: *** [WebCore/svg/libwebkit_1_0_la-SVGUseElement.lo] Error 1

Ugh. So I guess we disable that "--enable-debug", and hope that "nostrip noopt" helps instead.

*Thorin sits down and starts singing about gold*

Finally the debugging build has finished and I've woken up again. Let us do this thing. I'd looked over the webkit tracker and the crashing bugs list in the meantime, but nothing jumped out at me as being similar to my issue.

Anyway without the --enable-debug flag present in the call to ../configure the Debian webkit packages were built, eventually, and installed:

skx@precious:~/Debian/epiphany$ mv libwebkit-dev_1.2.7-0+squeeze2_amd64.deb x.deb
skx@precious:~/Debian/epiphany$ sudo dpkg --install libweb*deb
[sudo] password for skx:
(Reading database ... 173767 files and directories currently installed.)
Preparing to replace libwebkit-1.0-2 1.2.7-0+squeeze2 (using libwebkit-1.0-2_1.2.7-0+squeeze2_amd64.deb) ...
Unpacking replacement libwebkit-1.0-2 ...
Preparing to replace libwebkit-1.0-2-dbg 1.2.7-0+squeeze2 (using libwebkit-1.0-2-dbg_1.2.7-0+squeeze2_amd64.deb) ...
Unpacking replacement libwebkit-1.0-2-dbg ...
Preparing to replace libwebkit-1.0-common 1.2.7-0+squeeze2 (using libwebkit-1.0-common_1.2.7-0+squeeze2_all.deb) ...
Unpacking replacement libwebkit-1.0-common ...
Setting up libwebkit-1.0-common (1.2.7-0+squeeze2) ...
Setting up libwebkit-1.0-2 (1.2.7-0+squeeze2) ...
Setting up libwebkit-1.0-2-dbg (1.2.7-0+squeeze2) ...
skx@precious:~/Debian/epiphany$

Good news everybody: The crash still happens!

Firing up GDB should hopefully reveal more details - but sadly it didn't.

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff51a0a46 in finishedCallback (session=, msg=0xb03420, data=) at ../WebCore/platform/network/soup/ResourceHandleSoup.cpp:329
..
(gdb) up
#1  0x00007ffff51a0a46 in finishedCallback (session=, msg=0xb03420, data=) at ../WebCore/platform/network/soup/ResourceHandleSoup.cpp:329
329     client->didFinishLoading(handle.get());
(gdb) p client
$1 = <value optimized out>

At this point my head hurts too much, and I'm stuck. No quote today, I cannot be bothered.

Syndicated 2012-08-20 11:43:24 from Steve Kemp's Blog

minidlna is now packaged

So in my previous entry I talked about streaming audio media to my new tablet. Despite it working for others I couldn't get MPDroid to stream to my tablet from my MPD server successfully.

After looking around for alternatives I used MediaTomb to stream my content to the Android "2player" application. After a while I switched from MediaTomb to minidlna instead - that application being built from source.

To save myself effort, and be useful, I've packaged that for Squeeze here :

There's a configuration file in /etc/minidlna and a trivial init-script. Works for me.

In more fun news yesterday I endured and epic 8 hour bus trip and travelled from Edinburgh to Loch Ness.

Why go to Loch Ness? Well I fancied a swim, and wanted to capture shots of hairy cows. In addition to that I saw several interesting birds and a lot of Scottish Scenery.

All in all a good day out.

ObQuote: "It's not you. It's me... I'm completely fucked up."- Cruel Intentions

Syndicated 2012-08-05 16:00:51 from Steve Kemp's Blog

So I joined the bandwagon and bought a tablet

So this week I bought a cheap Android tablet, specifically to allow me to read books upon the move and listen to music at home.

Currently my desktop PC has a bunch of music on it, and I listen to it locally only. In my living room I have an iPOD in a dock which has identical contents.

In my bedroom? No music. This was something I wished to change.

The music on my desktop is played via mpd, and I use the sonata client to play it. I figured I could use this for my tablet, as MPD is all about remote control and similar stuff.

Unfortunately things didn't prove so easy. I found several android applications that would let me connect to my MPD server and control it, but despite several of them claiming to support streaming I couldn't make music appear upon my local tablet. (I rebuilt MPD with the lame encoder available, and used that too, to no avail).

Still if you have music in a central location and you wish to control it then the setup is trivial. (Though there is one caveat with MPD and streaming, my understanding is that you can only stream what you're playing. You cannot configure MPD to stream music and not also play it locally..)

So although it was neat to be able to control the music on my desktop host it wasn't what I wanted. Instead I had to install mediatomb to my desktop to serve the media, and use the 2player application to browse and play it.

Once I'd configured mediatomb all my music was available to my tablet. Result. Unfortunately 2player didn't play my movies, for that purposes I needed to use bubbleupnp. But that was a trivial install too.

So? End result. I have a toy tablet for <£100 which will stream my music to the bedroom.

ObQuote: "How about this: I work for you; in exchange, you teach me how to clean. " - Léon

Syndicated 2012-08-01 08:58:55 from Steve Kemp's Blog

I will be awesome, eventually.

Earlier this year, in March, I switched to the bluetile tiling window, and it has been a great success.

So I was interested in seeing Vincent Bernats post about switching to Awesome, I myself intend to do that "eventually", now I've successfully dipped my toes into tiling-land, via bluetiles simple config and gnome-friendly setup.

One thing that puts me off is the length of my sessions:

skx@precious:~/hg/blog$ ps -ef | grep skx
skx       2237     1  0 Mar12 ?        00:00:01 /usr/bin/gnome-keyring-daemon ...

As you can see I've been logged into my desktop session for four months. I lock the screen when I wander away, but generally login once when the computer boots and never again for half a year or so. FWIW:

skx@precious:~/hg/blog$ uptime
 23:01:19 up 138 days,  4:44,  4 users,  load average: 0.02, 0.06, 0.02

ObQuote: "I'm 30 years old. I'm almost a grown man. " - Rocketman

Syndicated 2012-07-28 22:04:25 from Steve Kemp's Blog

Another day, another upgrade

Tonight I upgraded my personal machine to run the recently released 3.5[.0] kernel.

On my personal machine(s) I'm usually loathe to change a running kernel, but this one was a good step forward because it allows me to experiment with seccomp filters.

I've tested the trivial "no new privileges" pctl and I followed along with the nice seccomp tutorial which gave me simple working code which I married to my javascript interpreter.

On top of that I upgraded node.js, which meant I had to clean up a little depreciated code in my node reverse proxy - which is the public face of the websites I run upon my box. (The proxy tunnels to about 10 different thttpd instances, each running upon 127.0.0.1:xx).

Happily however my weekend was not full of code, it was brightened by the opportunity to take pictures of Aurora and her long hair - more to come as I've still got about 350 images to wade through..

ObQuote: "Don't you think I make a remarkable queen? " - St. Trinian's (2007)

Syndicated 2012-07-22 21:53:15 from Steve Kemp's Blog

Misc update.

I got a few emails about the status panel I'd both toyed with and posted. The end result is that the live load graphs now have documentation, look prettier, and contain a link to the source code.

Apart from that this week has mostly involved photographing cute cats, hairy dogs, and women in corsets.

In Debian-related news njam: Insecure usage of environmental variable was closed after about 7 months, and I reported a failure of omega-rpg to drop group(games) privileges prior to saving game-state. That leads to things like this:

skx@precious:~$ ls -l | grep games
-rw-r--r--   1 skx games   14506 Jul  8 15:20 Omega1000

Not the end of the world, but it does mean you can write to directories owned by root.games, and potentially over-write level/high-score files in other packages leading to compromises.

ObQuote: "Your suffering will be legendary, even in hell! " - Hellraiser II (Did you know there were eight HellRaiser sequels?)

Syndicated 2012-07-08 14:23:21 from Steve Kemp's Blog

Writing a status panel the modern way

So status displays are cool. Seeing what is happening in real time is cool.

As a proof of concept I put together a trivial load-graph:

This is broken down into three parts:

Load Client

The load client is a trivial script which reads /proc/loadavg, and sends the 1-minute entry to a remote server, via a single UDP packet.

Load Server

The load-server is a service which listens for UDP traffic, and when it receives a new integer records that in a redis data-store.

Load Display

This is a HTML page which has the values from the store in it, which is then plotted using javscript.

So the UDP-server which receives load will receive two things:

  • load:N - The load figure. The text "load:" is literal, and present in case I decide to extend the stats..
  • x.x.x.x - The IP address from which it received the message.

This is inserted into a Redis database as an array. This array could then be fetched via an AJAX script to update the HTML display in real-time, but at the moment I just have a shell script which updates it in near-real time.

The idea of having a UDP-server receive values from remote clients is interesting. We just need to define a mapping to redis. For me I've just done this:

receive a UDP packet with value "load:1.2" from source 1.2.3.4
append "1.2" to key "1.2.3.4-load".
append the value "1.2.3.4" to the global "known_hosts"

The values received can be truncated (i.e. keep only the most recent 60 entries) with ease, due to the available Redis primitives, and we can easily graph these using the qjplot library.

Adding more metrics just means updating the clients to send "memfree:400m", "disk-free:50%", "users:2", "uptime:12345s", or similar. The storage is wonderfully abstract - all you need to do is get the graph-drawing code to a) Know which source to display, and b) which metric.

For example, if we did extend the client to send that data I could draw a graph of the memory on host foo.example.com just by selecting "memfree" against the origin "1.2.3.4".

ObQuote: "Come here, damn you, I want to touch you. " - Hellraiser

Syndicated 2012-06-19 18:38:12 from Steve Kemp's Blog

Sometimes the important things are those you don't do

Usually in life we focus upon the things we do, and not the things we don't do, or avoid.

I don't have many "rules" for the way I behave, the things I do, but there are some.

  • I refuse, point-blank, to purchase any food which includes the phrase "low fat" upon the label.
  • I eat, fry, and cook with real butter.
    • I refuse to use any of the alternatives. Especially the low-fat alternatives.
  • I have yet to view a film in 3D.
    • I suspect this is something I'm semi-seriously avoiding, but I've not yet explicitly decided to skip them.
  • I refuse to watch any film which is "supernateral".
  • I refuse to buy anything from a pound-land, pound-stretcher, or similarly low-end store which is labeled either "deluxe" or "luxury".
    • I made this mistake when I was a young student.

I could go on, but the "rules" are surprisingly hard to remember, having been in place for many years, they're just part of the way that I do (or do not do) things!

Finally: As of this year I've now lived in Edinburgh for over half my life.

ObQuote: "I don't know. We should go and like, stalk him or something. " - Megan Is Missing

Syndicated 2012-06-16 10:32:13 from Steve Kemp's Blog

I've posted my javascript stuff

I previously mentioned some work I'd done with mixing Javascript & C.

The code is now visible here:

This consists of a binary which allows you to run javascript files, those javascript files have some extra methods available to them, allowing this sample file to execute and do things:

  • Fetch a web-page with curl.
  • Connect to a locally running memcached server.
  • Parse command line arguments.

Not great work, but still a useful exercise.

ObQuote: "Please! I don't wanna go back there, you don't know what it's like to be treated as a freak!" - Shrek

Syndicated 2012-06-01 08:56:19 from Steve Kemp's Blog

29 May 2012 (updated 29 May 2012 at 16:06 UTC) »

A heady mixture of photography and programming

The past few weeks have consisted of a heady mixture of taking interesting pictures of cute people, and writing code.

I spent a while getting to grips with seccomp filters, using the facilities present in recent GNU/Linux Kernels to filter system calls binaries are allowed to make.

My initial test was to patch GNU Less to only allow it to open, read, and close files. The side-effect of this was that the built in shell-escape was closed, thus allowing me to test it.

After that I toyed around with interfacing with spidermonkey|seamonkey. In this regard I was less succesful, but I did manage to write code in C that would invoke javascript functions loaded dynamically. Similarly I could call from my (loaded) javascript code into functions defined in C.

I don't have a use for a Javascript to/from C bridge, but I'm sure that time will come.

Photography has been a constant distraction, I took some fun shots of the Edinburgh Marathon, and then distracted myself with a volunteer to take an abstract fishnet photograph. We went on to do some more fun shots begin careful to stay on the safe side of the NSFW limit. I think this is borderline NSFW, but we were both clear exactly what we wanted and we got it perfectly there.

Next week will be quieter, but providing we don't have another mini-heatwave in Edinburgh I'll be cheerful regardless.

ObQuote: One, two, Freddy's coming for you. - A Nightmare on Elm Street (original)

Syndicated 2012-05-29 14:56:16 (Updated 2012-05-29 16:06:34) from Steve Kemp's Blog

568 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!