0

We are middle of upgrading ruby versions v2.7.3 -> v3.1.3

One of our test cases are failing related to valid ipv6 address string, check the following

# ruby 2.7.3
IPAddr.new('fe80::85e:7530:69ec:9074%en0').ipv6?
=> IPAddr::InvalidAddressError (invalid address: fe80::85e:7530:69ec:9074%en0)

# ruby 3.1.3

IPAddr.new('fe80::85e:7530:69ec:9074%en0').ipv6?
=> true

Is it really a bug or am I missing something? Please help..

Md. Farhan Memon
  • 6,055
  • 2
  • 11
  • 36

1 Answers1

1

Is it really a bug or am I missing something?

This used to be an issue in the ipaddr default gem up to version 1.2.2 which was fixed in version 1.2.3 in order to be fully compliant with RFC 4007 and RFC 6874. Version 1.2.3 of the ipaddr default gem was shipped as part of Ruby 3.1.0.

So, you are correct. This is a bug (although opinions differ on that) which was fixed in ipaddr 1.2.3 / Ruby 3.1.0.

Jörg W Mittag
  • 363,080
  • 75
  • 446
  • 653
  • which version is buggy? `1.2.2` or `1.2.3` – Md. Farhan Memon Jun 01 '23 at 13:22
  • I had raised it on ruby-lang bug tracker too, and same thing. Thanks for the clarification. https://bugs.ruby-lang.org/issues/19705 – Md. Farhan Memon Jun 02 '23 at 09:19
  • "which version is buggy? 1.2.2 or 1.2.3" – ipaddr 1.2.2 and all versions before are buggy (which means Ruby 3.0.6 and all versions before are buggy), ipaddr 1.2.3 and all versions after are fixed (which means Ruby 3.1.0 and all versions after are fixed). You can easily see that in your code example, where Ruby 2.7.3 raises an exception (which is clearly wrong) whereas Ruby 3.1.3 correctly accepts the address. I though my last sentence was pretty clear ("fixed in ipaddr 1.2.3 / Ruby 3.1.0"), but I am not a native English speaker, so if there is anything you think can be improved, go ahead. – Jörg W Mittag Jun 02 '23 at 11:33