[前][次][番号順一覧][スレッド一覧]

ruby-changes:27371

From: knu <ko1@a...>
Date: Sat, 23 Feb 2013 13:04:09 +0900 (JST)
Subject: [ruby-changes:27371] knu:r39423 (ruby_2_0_0): merge revision(s) 39298:39300:

knu	2013-02-23 13:03:59 +0900 (Sat, 23 Feb 2013)

  New Revision: 39423

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39423

  Log:
    merge revision(s) 39298:39300:
    
    * lib/ipaddr.rb (IPAddr#in6_addr): Fix a typo with the closing
      parenthesis.
    
    * lib/ipaddr.rb (IPAddr#in6_addr): Fix the parser so that it can
      recognize IPv6 addresses with only one edge 16-bit piece
      compressed, like [::2:3:4:5:6:7:8] or [1:2:3:4:5:6:7::].
      [Bug #7477]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/lib/ipaddr.rb

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 39422)
+++ ruby_2_0_0/ChangeLog	(revision 39423)
@@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sat Feb 23 13:03:22 2013  Akinori MUSHA  <knu@i...>
+
+	* lib/ipaddr.rb (IPAddr#in6_addr): Fix a typo with the closing
+	  parenthesis.
+
+Sat Feb 23 13:03:22 2013  Akinori MUSHA  <knu@i...>
+
+	* lib/ipaddr.rb (IPAddr#in6_addr): Fix the parser so that it can
+	  recognize IPv6 addresses with only one edge 16-bit piece
+	  compressed, like [::2:3:4:5:6:7:8] or [1:2:3:4:5:6:7::].
+	  [Bug #7477]
+
 Sat Feb 23 13:00:49 2013  Akinori MUSHA  <knu@i...>
 
 	* configure.in (LIBRUBY_DLDFLAGS): Fix a bug where --with-opt-dir
Index: ruby_2_0_0/lib/ipaddr.rb
===================================================================
--- ruby_2_0_0/lib/ipaddr.rb	(revision 39422)
+++ ruby_2_0_0/lib/ipaddr.rb	(revision 39423)
@@ -549,7 +549,8 @@ class IPAddr https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/ipaddr.rb#L549
         left = $1
         right = $3 + '0:0'
       else
-        left.count(':') <= 7 or raise InvalidAddressError, "invalid address"
+        left.count(':') <= ($1.empty? || $2.empty? ? 8 : 7) or
+          raise InvalidAddressError, "invalid address"
         left = $1
         right = $2
         addr = 0
@@ -671,6 +672,8 @@ class TC_IPAddr < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/ipaddr.rb#L672
       ["0:0:0:1::"],
       ["2001:200:300::/48"],
       ["2001:200:300::192.168.1.2/48"],
+      ["1:2:3:4:5:6:7::"],
+      ["::2:3:4:5:6:7:8"],
     ].each { |args|
       assert_nothing_raised {
         IPAddr.new(*args)
@@ -727,6 +730,8 @@ class TC_IPAddr < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/ipaddr.rb#L730
     assert_equal("2001:200:300::", IPAddr.new("2001:200:300::/48").to_s)
 
     assert_equal("2001:200:300::", IPAddr.new("[2001:200:300::]/48").to_s)
+    assert_equal("1:2:3:4:5:6:7:0", IPAddr.new("1:2:3:4:5:6:7::").to_s)
+    assert_equal("0:2:3:4:5:6:7:8", IPAddr.new("::2:3:4:5:6:7:8").to_s)
 
     assert_raises(IPAddr::InvalidAddressError) { IPAddr.new("192.168.0.256") }
     assert_raises(IPAddr::InvalidAddressError) { IPAddr.new("192.168.0.011") }

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r39299-39300


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]