Michal Čihař - Archive for June 17, 2008

Code of the day

Why the hell do I have to hit various obscure pieces of code today? Current winner is part of system-config-printer:

def monitor_session (*args):

    bus = dbus.SessionBus()
    bus.add_signal_receiver (monitor_session)
    print >> sys.stderr, "%s: failed to connect to session D-Bus" % \
    sys.exit (1)

If you don't know D-Bus or Python: It listens to all signals on session bus and does nothing with them. All this code causes is eating up memory and CPU cycles when there is some higher load on session bus.

PS: Maybe I miss some nice idea behind this code, please enlighten me.