-
Notifications
You must be signed in to change notification settings - Fork 8
ruby-xz breaks Resolv.getaddress in ruby 2.2.x #13
Comments
Weird. I just tested your script, and I can reproduce the problem. However, I don’t think it is related to #!/usr/bin/env ruby
require 'resolv'
require "io/like"
puts Resolv.getaddress('google.com')
This will require some debugging. Thanks for reporting! Vale, |
Oh yes. Such a great bug. This was the cause: class XZ::StreamReader < XZ::Stream
# ...
self.class.send(:alias_method, :open, :new)
# ...
end What this intended to do is to alias a class method. However, However, it appears I accidentally fixed the problem already in commit a4ec945, where I removed that statement and replaced it with an explicit method definition, because I wanted to add a deprecation warning for a certain use of that alias. So, could you please test with current Vale, |
After running bundle clean, I was able to verify this bug is fixed with the following Gemfile:
Thanks for the fix! Looking forward to the released gem :) |
Okay, thanks for testing. It will be included into the next release 0.2.2 then. Vale, |
Problem was already resolved with commit a4ec945.
Do you have an ETA for a 0.2.2 release? |
Thanks for reminding me. I just released 0.2.2 and pushed it to rubygems.org. Happy coding! Vale, |
Thanks! |
Due to a documentation error, I also released 0.2.3. The source code of 0.2.2 and 0.2.3 is otherwise identical. Vale, |
Reproducible pretty trivially:
Gemfile:
test.rb
Looks like what's happening is that
resolv.rb
is calling an unqualified "open", which is probably expected to call "File.open"... but instead it ends up calling "DNS.open" (which calls DNS.new), which doesn't have the same argument count.I think it may be something in the
io-like
gem that's being mixed in and monkey patching something, such that ruby's method resolution order is changed.I think it's a deeper issue here in the io-like gem that calling
include IO::Like
tends to poison the method resolution order for lots of IO stuff in newer rubies (their github page says they don't even support 1.9.x yet.) I think the fix is to get off of io-like altogether.The text was updated successfully, but these errors were encountered: