Closed keithrbennett closed 9 years ago
Thanks for the report! I've had a quick look, and the problem seems to be the OPT record. If you add the OPT record from the additional section to the answer section, then the answer section also displays this behaviour. I'll investigate some more.
Thanks!
Alex.
Commit 9279032 should fix this problem. I've simply removed the OPT record from the comparison for equality
This addresses the use case I reported, but I fear that we are not addressing the underlying problem, which could pop up in other ways that might be difficult to diagnose and deal with. Also, if there are OPT records, shouldn't they be included in the comparison for equality?
I just ran the test script against the commit in Github whose hash is bc7d6e0 (bc7d6e082c48cbc3533604cf237b5f914de36a2b), dated 9/21/2007, labelled "Initial dnsruby code import to rubyforge" and got the same result.
It would be nice to delve more deeply into this and find the root cause of the issue. If you don't have time to do so, could you reopen this issue to remind us that it is not fully resolved?
Thanks, Keith
Well, the OPT record is not really part of the Message, but conveys metadata about the message transport - this is why it is not displayed on dig output, for example. It doesn't seem unreasonable to exclude it from message comparison, and this is the behaviour which dnsruby has traditionally displayed.
I'd be interested to hear of any issues as a result, and would also note that it's possible to compare the Message including the OPT record, if it's required by an application.
The Additional section of Dnsruby::Message sometimes returns false when compared to itself, i.e.
This results in the entire message when compared to itself returning false:
I think it has something to do with the contained RRSet's and/or RR's; the act of comparing them may return new objects who don't have an == method defined, resulting in == returning false for different instances even though they are semantically equal.
A script illustrating this is at https://gist.github.com/keithrbennett/469afd51f7fd075fdc5a , and also pasted here: