Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1421056

Summary: IPAddr eql? bug still present
Product: Red Hat Enterprise Linux 6 Reporter: Neil Wilson <neil>
Component: rubyAssignee: ruby maint <ruby-maint>
Status: CLOSED WONTFIX QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.8CC: vondruch
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-10 09:48:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Neil Wilson 2017-02-10 09:11:12 UTC
Description of problem:

When comparing IPAddr values with eql? you get the wrong result


Version-Release number of selected component (if applicable):

Name        : ruby
Arch        : x86_64
Version     : 1.8.7.374
Release     : 4.el6_6


How reproducible:


Steps to Reproduce:
1. ruby -ripaddr -e 'p IPAddr.new("192.168.1.0/30").eql?(IPAddr.new("192.168.1.0/30"))'

Actual results:

false


Expected results:

true

(which is what you see with ruby on RHEL 7)

Additional info:

eql? is missing in 1.8.7

This bug breaks array difference with arrays of IP addresses. Array difference uses 'eql?' under the hood rather than '=='

Comment 1 Vít Ondruch 2017-02-10 09:48:34 UTC
Neil, thank you for your ticket.

You are right, in this case, the example you provided compares if it is actually the same object, e.g.:

~~~
$ ruby -ripaddr -e 'ip = IPAddr.new("192.168.1.0/30"); p ip == ip'
~~~

which is not very useful in most cases. And this [1] seems to be the commit which "fixed" the behavior.

However, I am not sure it is worth of the change at this point, since:

1) The behavior was changed during Ruby 1.8.7 maintenance period, but it was never backported for Ruby 1.8.7 by upstream.

2) Also, considering RHEL6 release cycle, I don't see too much options to push this fix.

I am going to CLOSE WONTFIX the issue for now, but please don't hesitate to contact Red Hat support, so we might reconsider in case this turns to be important. Thank you.


[1] https://github.com/ruby/ruby/commit/61c11677c8ee20e07dea84a5a3bf8b68ff449188

Comment 2 Vít Ondruch 2017-02-10 09:51:50 UTC
Forgot to mention, that on RHEL6, you might consider to try Red Hat Software Collections, which provides more recent versions of Ruby.

Comment 3 Neil Wilson 2017-02-10 11:20:32 UTC
The workaround on array diff is fairly straightforward.

Rather than:

source - dest

do:

source.clone.delete_if {|e| dest.include? e}


This uses '==' equality rather than 'eql?' equality and it works as expected.