Michal Čihař - Code of the day

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):
    pass

try:
    bus = dbus.SessionBus()
    bus.add_signal_receiver (monitor_session)
except:
    print >> sys.stderr, "%s: failed to connect to session D-Bus" % \
          PROGRAM_NAME
    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.

New Comment

Due to excessive spam, new comments are disabled. If you have some feedback on this post, please send me email or followup on Twitter or Facebook.