Skip to main content

Bugs in "real life"

I buy a trash can with a foot-opener — not a cheap one. Three test kicks — it doesn't open anymore. Turns out to be manufacturing. It gets picked up — cool! — I buy a different model or another brand. That one opens smoothly but it doesn't stand flat on the floor which makes it quake when I kick the pedal. A hammer is needed to fix it — I risk voiding warranty from self-repair to save another return, waiting, digital paperwork. I buy an affordable DVD player with HDMI output to improve on the DVD playback on PC nightmare - copy protection trouble way too often. While the player is shiny and makes audio CD playback more fun than Audacious and a notebook, it plays one out of the four DVDs I feed to it. One out of four. OneFour. Besides other shortcomings. Another return. I browse through HDMI DVD players at noisy drive, doesn't play half my disks, bad video quality, disks don't come all out, slow in menus, sometimes reads disks or not, playback stops somewhere in the middle of a movie, replacement unit as bad as first try, off-on needed to make disk read — all over the place, no exceptions, not just foo and bar company, but Toshiba, Sony, Philips, Panasonic, LG, Pioneer — companies that at least achieved to nail their names into my head (though Sony mostly in bad ways: rootkit audio CDs, limited rights and illegalizing a run of GNU/Linux on hardware you own, dust inside a cell phone display, dust inside a display!). My recent Amazon orders prove: the only thing I can buy that really works... is a book.

Printing a backtrace from inside a C program

While digging in the latest code of htop in hunt of a resizing bug I came across calls to functions backtrace(3) and backtrace_symbols_fd(3), which I didn't know about before. htop installs a custom segfault handler which tries to shut down curses and print a stacktrace using the backtrace(3) function. Example output looks like this:

htop 0.9 aborting. Please report bug at
/lib64/ **sprintf** _chk+0x87)[0x7fbbca558237]

While that could be more helpful, it does give ahint that sprintf is involved in the crash - it actually is. Things get interesting when you deal with memory corruption so that the call to backtrace inside your segfault handler segfaults itself. In that case you get:

htop 0.9 aborting. Please report bug at
Segmentation fault

That's not helpful anymore. Still, not all segfaults are memory corruptions!

If you're interested in adding this feature to your own program or at least would like to play with it, here is some dedicated demo code:

/* Licensed as Public Domain */
#include <stdio.h>
#include <execinfo.h>
#include <signal.h>
#include <stdlib.h>

static void dump_trace() {
    void * buffer[255];
    const int calls = backtrace(buffer,
        sizeof(buffer) / sizeof(void *));
    backtrace_symbols_fd(buffer, calls, 1);

void boom() {
    int a[10];
    printf("%d", a[-100000]);

void two() { boom(); }
void one() { two(); }

int main() {
    signal(SIGSEGV, dump_trace);
    return 0;

In my Makefile I have

NUMBERS: backtrace.c
    $(CC) -o $@ $<

NAMES: backtrace.c
    $(CC) **-rdynamic** -o $@ $ <

Without -rdynamic you get numbers, only -- like this:


In contrast, with -rdynamic you get function names where available:

# ./NAMES 

The same job (and a bit more) is also done by library (and tool) stacktrace. I played with it (and put an ebuild into the betagarden overlay) but it's not working for me as expected, yet. I have contacted upstream about it and hope for some enlightening reply in the next few days.

Fwd: The Wackness (2008)

I've just been having good fun with this movie featuring Ben Kingsley:

On a side note it seems to me that faces work like grammars and languages (speaking of theoretical computer science). Again and again a face reminds me of another, Olivia Thirlby of Rachel McAdams this time. I cannot name the building blocks their faces share but it does look like use of the same grammar to me. Anyway...

svneverever 1.2.0 released

In some cases previous versions of svneverever would report too high numbers for the revision a directory was last seen on. Let me quote from Wouter Haffmans' excellent bug description (accompanied by a patch):

$ svnadmin create test
$ cd test
$ svn mkdir "file://`pwd`/parent" -m "Add parent (r1)"
$ svn mkdir "file://`pwd`/parent/child" -m "Add child (r2)"
$ svn rm "file://`pwd`/parent/child" -m "Del child (r3)"
$ svn rm "file://`pwd`/parent" -m "Del parent (r4)"

svneverever prints, for this repository:
(1; 3)  /parent
(2; 3)      /child

(1; 3)  /parent
(2; 2)      /child

So that is fixed in 1.2.0.

Fresh: Freeverb3 2.5.16

Just a quick note: Freeverb3, a reverb plug-in for Audacious (and a few other interfaces), just grew to version 2.5.16 in Gentoo. It's the first release of Freeverb3 compiling against Audacious 2.5.x: Audacious upstream has broken API-compatibility on more time. Previous users of Freeverb3 will also notice the arrival of a new effect called "Gardner Largeroom". Enjoy.

Lossless JPEG rotation preserving EXIF data

It's known that there are ways to losslessly rotate a JPEG image. One tool supporting lossless rotation is jpegtran, a free software command line app coming with the JPEG libraries. By default, jpegtran copies JPEG comments only: EXIF data is not copied. No warning is printed. Sadly I learned that only recently. To rotate image I am now using this command:

# jpegtran -rotate 90 -copy all -perfect \
    -optimize -progressive INPUT.jpg > OUTPUT.jpg

The -copy all is turn on copying of EXIF data.

Howto late-join a mail thread seamlessly technically

Say you joined a mailing list just to jump onto a specific mail thread that someone brought to your attention. To have your mail join the thread seamlessly (in a way many mail clients support) you need

  1. the mail's subject
  2. the message id of the parent to attach to
  3. a mail client allowing to add headers In-Reply-To and References.

The message ID header is easy to find once you have mail headers at hand:

Message-ID: <>

If you#re lucky you get them from a mail archive or a friend who's subscribed already. Now a child of that mail would carry these headers:

In-Reply-To: <>
References: <>

If you're using Thunderbird, you can make it show headers In-Reply-To and References for selection in the mail composition window. All you need to do is open the advanced config GUI editor (sometimes called about:config, Menu > Edit > Preferences > Advanced > Config Editor ...), select field mail.compose.other.header and set it to In-Reply-To,References. I learned about that field myself from here. If you have updates on this procedure, please comment below. Thanks!