[ruby-core:68128] [Ruby trunk - Bug #10857] [Open] Resolv::DNS::Resource ==() method incorrectly returns false due to TTL attrib

2 views
Skip to first unread message

scla...@hotmail.com

unread,
Feb 16, 2015, 1:53:49 PM2/16/15
to ruby...@ruby-lang.org
Issue #10857 has been reported by Shayne Clausson.

----------------------------------------
Bug #10857: Resolv::DNS::Resource ==() method incorrectly returns false due to TTL attrib
https://bugs.ruby-lang.org/issues/10857

* Author: Shayne Clausson
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 1.9.3p545 (2014-02-24) [i386-mingw32]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
require 'resolv'

resolver = Resolv::DNS.new(:nameserver => ['8.8.8.8'],
:search => [],
:ndots => 1)

hosts = resolver.getresources('ruby.org', Resolv::DNS::Resource::IN::A)
returned_record = hosts.first

a = Resolv::DNS::Resource::IN::A

#create an identical record
new_record = a.new(returned_record.address)

new_record == returned_record
=>false #but should return true

#If I change this
class Resolv::DNS::Resource
def ==(other) # :nodoc:
return false unless self.class == other.class
s_ivars = self.instance_variables
s_ivars.sort!
**s_ivars.delete "@ttl"**
o_ivars = other.instance_variables
o_ivars.sort!
**o_ivars.delete "@ttl"**
return s_ivars == o_ivars &&
s_ivars.collect {|name| self.instance_variable_get name} ==
o_ivars.collect {|name| other.instance_variable_get name}
end
end

#To this
class Resolv::DNS::Resource
def ==(other) # :nodoc:
return false unless self.class == other.class
s_ivars = self.instance_variables
s_ivars.sort!
**s_ivars.delete(:@ttl)**
o_ivars = other.instance_variables
o_ivars.sort!
**o_ivars.delete(:@ttl)**
return s_ivars == o_ivars &&
s_ivars.collect {|name| self.instance_variable_get name} ==
o_ivars.collect {|name| other.instance_variable_get name}
end
end

new_record == returned_record
=>true




--
https://bugs.ruby-lang.org/

no...@ruby-lang.org

unread,
Feb 16, 2015, 9:46:58 PM2/16/15
to ruby...@ruby-lang.org
Issue #10857 has been updated by Nobuyoshi Nakada.

Description updated
Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: REQUIRED

----------------------------------------
Bug #10857: Resolv::DNS::Resource ==() method incorrectly returns false due to TTL attrib
https://bugs.ruby-lang.org/issues/10857#change-51516

* Author: Shayne Clausson
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 1.9.3p545 (2014-02-24) [i386-mingw32]
* Backport: 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: REQUIRED
----------------------------------------
~~~ruby
~~~




--
https://bugs.ruby-lang.org/

nar...@airemix.jp

unread,
Feb 17, 2015, 4:58:14 AM2/17/15
to ruby...@ruby-lang.org
Issue #10857 has been updated by Yui NARUSE.

Backport changed from 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: DONE

ruby_2_2 r49627 merged revision(s) 49620.

----------------------------------------
Bug #10857: Resolv::DNS::Resource ==() method incorrectly returns false due to TTL attrib
https://bugs.ruby-lang.org/issues/10857#change-51527

* Author: Shayne Clausson
* Status: Closed
* Priority: Normal
* Assignee:
* ruby -v: ruby 1.9.3p545 (2014-02-24) [i386-mingw32]
* Backport: 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: DONE

u...@garbagecollect.jp

unread,
Feb 17, 2015, 9:24:58 AM2/17/15
to ruby...@ruby-lang.org
Issue #10857 has been updated by Usaku NAKAMURA.

Backport changed from 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: DONE to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE

----------------------------------------
Bug #10857: Resolv::DNS::Resource ==() method incorrectly returns false due to TTL attrib
https://bugs.ruby-lang.org/issues/10857#change-51529

* Author: Shayne Clausson
* Status: Closed
* Priority: Normal
* Assignee:
* ruby -v: ruby 1.9.3p545 (2014-02-24) [i386-mingw32]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE

nagac...@gmail.com

unread,
Feb 17, 2015, 9:29:03 AM2/17/15
to ruby...@ruby-lang.org
Issue #10857 has been updated by Tomoyuki Chikanaga.

Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE to 2.0.0: REQUIRED, 2.1: DONE, 2.2: DONE

Backported into `ruby_2_1` at r49628.

----------------------------------------
Bug #10857: Resolv::DNS::Resource ==() method incorrectly returns false due to TTL attrib
https://bugs.ruby-lang.org/issues/10857#change-51530

* Author: Shayne Clausson
* Status: Closed
* Priority: Normal
* Assignee:
* ruby -v: ruby 1.9.3p545 (2014-02-24) [i386-mingw32]
* Backport: 2.0.0: REQUIRED, 2.1: DONE, 2.2: DONE
Reply all
Reply to author
Forward
0 new messages