Skip to content

Entries from May 2011.

Better debugging of QT warnings

When a QT warning is issued you might not know what code is causing activation of this warning. Warnings are not fatal, application is not stopped with proper backtrace.

QT creators added very useful option for that purpose: QT_FATAL_WARNINGS. If you set:

export QT_FATAL_WARNINGS

You will be correct backtrace under gdb that allow to locate the problem. Application will abort as soon as first QT warning is located.

Kill whole tree of processes on Linux

Since few months I'm responsible for managing build server that perfrorms regular builds for testing purposes. Sometimes I need to stop whole build job on server (probably composed of many processes). On Linux when parent process is killed all childen are not affected and are reallocated to init (PID=1) process. I'd like to stop them as well.

You can of course list process with hierarchy and kill processes manually:

ps xf
kill ... ...

But there's faster, automated, metod.

In order to kill process (given by $PID) and all subprocesses easilly you can use the following command:

kill $(ps -o pid= -s $(ps -o sess --no-heading --pid $PID))

Update 2011-12-17: there's alternative way to kill whole subtree that might be more accurate and depends on "ps xf" output:

ps xf | awk -v PID=$PID '
    $1 == PID { P = $1; next }
    P && /_/ { P = P " " $1; K=P }
    P && !/_/ { P="" }
    END { print "kill " K }'\
    | sh -x

Google Calendar Sync Stopped to Work on Android

Yesterday I observed all calendar events dissapeared from my Android Phone :-(. It seems there's a problem with syncing engine. More details here.

An update [26.05]: seems that clearing phone calendar data will do the trick.

"No recommends" on Debian/Ubuntu by default

Sometimes you want to install some packages quickly and you know exactly what components you need. Then installing uneccessary 20 MB (recommended/suggested packages) when you need just 200 kB package is just waste of your time and disk space. Here's good news: you can easily tell apt not to install recommend (and/or suggested) packages to make installation faster:

echo 'APT::Install-Recommends "0"; APT::Install-Suggests "0";' \
    > /etc/apt/apt.conf.d/no-recommends

Easily install public SSH keys on remote Linux server

Almost every remote server I'm using has password login disabled. Only SSH public key login is allowed. Thus installing new public keys on server to authorize access is very frequent operation. Here's small script that allows to install public key on desired server:

#!/bin/sh

test "$2" || {
    echo "usage: $0 public_key_filename host"
    exit 1
}
KEY="$1"
HOST="$2"
cat $KEY | ssh $HOST "mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys"

Small bit of scripting, but makes life much easier.