Bug #911: ArgumentError in Resolv#getaddress
http://redmine.ruby-lang.org/issues/show/911

Author: Federico Builes
Status: Open, Priority: Normal

Sometimes Resolv#getaddress fails with an ArgumentError when it should be raising a ResolvError:


$ ./irb
irb(main):001:0> require 'resolv'
=> true
irb(main):002:0> Resolv.getaddress("rewrq.rqweqwrw.rqww")
ArgumentError: wrong number of arguments (0 for 1)
	from /usr/local/lib/ruby/1.8/resolv.rb:600:in `initialize'
	from /usr/local/lib/ruby/1.8/resolv.rb:600:in `exception'
	from /usr/local/lib/ruby/1.8/resolv.rb:600:in `raise'
	from /usr/local/lib/ruby/1.8/resolv.rb:600:in `request'
	from /usr/local/lib/ruby/1.8/resolv.rb:474:in `each_resource'
	from /usr/local/lib/ruby/1.8/resolv.rb:919:in `resolv'
	from /usr/local/lib/ruby/1.8/resolv.rb:917:in `each'
	from /usr/local/lib/ruby/1.8/resolv.rb:917:in `resolv'
	from /usr/local/lib/ruby/1.8/resolv.rb:916:in `each'
	from /usr/local/lib/ruby/1.8/resolv.rb:916:in `resolv'
	from /usr/local/lib/ruby/1.8/resolv.rb:914:in `each'
	from /usr/local/lib/ruby/1.8/resolv.rb:914:in `resolv'
	from /usr/local/lib/ruby/1.8/resolv.rb:466:in `each_resource'
	from /usr/local/lib/ruby/1.8/resolv.rb:422:in `each_address'
	from /usr/local/lib/ruby/1.8/resolv.rb:249:in `each_address'
	from /usr/local/lib/ruby/1.8/resolv.rb:248:in `each'
	from /usr/local/lib/ruby/1.8/resolv.rb:248:in `each_address'
	from /usr/local/lib/ruby/1.8/resolv.rb:232:in `getaddress'
	from /usr/local/lib/ruby/1.8/resolv.rb:204:in `getaddress'
irb(main):003:0> Resolv.getaddress("rewrq.rqweqwrw.rqww")
Resolv::ResolvError: no address for rewrq.rqweqwrw.rqww
	from /usr/local/lib/ruby/1.8/resolv.rb:233:in `getaddress'
	from /usr/local/lib/ruby/1.8/resolv.rb:204:in `getaddress'
	from (irb)

This affects Ruby 1.8 and 1.9


----------------------------------------
http://redmine.ruby-lang.org