Strange libnotify (potentially ruby/autoload) bug #15

ohjames opened this Issue Jan 11, 2012 · 4 comments


None yet

2 participants


In my project catfriend I have to add the following line after the require for libnotify:

require 'libnotify'

module Libnotify
    class API ; end

Without that I get the following error 90% of the time (90%... wtf you're probably thinking just as I am):

unknown error wrong number of arguments(1 for 0)
/usr/lib/ruby/gems/1.9.1/gems/libnotify-0.7.1/lib/libnotify.rb:56:in `initialize'
/usr/lib/ruby/gems/1.9.1/gems/libnotify-0.7.1/lib/libnotify.rb:56:in `new'
/usr/lib/ruby/gems/1.9.1/gems/libnotify-0.7.1/lib/libnotify.rb:56:in `new'
/home/james/projects/catfriend/lib/catfriend/imap.rb:59:in `run'
/home/james/projects/catfriend/lib/catfriend/thread.rb:6:in `block in start'

I don't re-open Libnotify at all. It makes no sense because the autoload through API clearly gives an initialize that takes 0-2 arguments.

Now trying to break this down to a small test case by just calling with the same simple arguments I am works fine. Maybe a combination with the threading?

Hope I've made a glaring error here.


Probably this is a race condition with ruby threads and autoload, in which case modifying the libnotify library to load API directly would circumvent it; although whether you want to do that or not I have no idea, I'm happy working around it with that simple fix up there but thought you might want to be aware of it.

@splattael splattael closed this in 3574229 Jan 13, 2012

Thanks for reporting. I'm using require now :)
Could you please try the fix?

BTW, sorry for the delay :(


Sorry I was being an idiot, it works great with that fix.


I've just release 0.7.2!
Thanks for your contribution :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment