ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:72559] [Ruby trunk - Bug #11910] [Open] resolv.rb - can't modify frozen String in #scan
       [not found] <redmine.issue-11910.20151228172605@ruby-lang.org>
@ 2015-12-28 17:26 ` dev
  2015-12-28 20:26   ` [ruby-core:72565] " Eric Wong
  2015-12-28 20:28 ` [ruby-core:72566] [Ruby trunk - Bug #11910] " normalperson
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 5+ messages in thread
From: dev @ 2015-12-28 17:26 UTC (permalink / raw
  To: ruby-core

Issue #11910 has been reported by Henry Helper.

----------------------------------------
Bug #11910: resolv.rb - can't modify frozen String in #scan
https://bugs.ruby-lang.org/issues/11910

* Author: Henry Helper
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.3.0
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
lib/resolv.rb contains "frozen_string_literal: true". This causes an error in a travis build from https://github.com/middleman/middleman/pull/1713.

~~~ruby
/home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:2462:in `block in create': can't modify frozen String (RuntimeError)
from /home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:2462:in `scan'
from /home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:2462:in `create'
from /home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:462:in `each_name'
~~~

The code in line lib/resolv.rb#L2462 (https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L2462) causes the error. It modifies a string.

~~~ruby
prefix.scan(/[0-9A-Fa-f]+/) {|hex| a1 << [hex.hex].pack('n')}
~~~





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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:72565] Re: [Ruby trunk - Bug #11910] [Open] resolv.rb - can't modify frozen String in #scan
  2015-12-28 17:26 ` [ruby-core:72559] [Ruby trunk - Bug #11910] [Open] resolv.rb - can't modify frozen String in #scan dev
@ 2015-12-28 20:26   ` Eric Wong
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2015-12-28 20:26 UTC (permalink / raw
  To: Ruby developers

> The code in line lib/resolv.rb#L2462 (https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L2462) causes the error. It modifies a string.

Thanks, here is my work-in-progress, but there seems to be other
problems in this file, too, around LOC::Coord creation.
I guess that's a separate bug...

I'm using "b" for binary strings here since #hex gives them.

diff --git a/lib/resolv.rb b/lib/resolv.rb
index 61bed16..9a981b9 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -2451,14 +2451,14 @@ def self.create(arg)
       when IPv6
         return arg
       when String
-        address = ''
+        address = ''.b
         if Regex_8Hex =~ arg
           arg.scan(/[0-9A-Fa-f]+/) {|hex| address << [hex.hex].pack('n')}
         elsif Regex_CompressedHex =~ arg
           prefix = $1
           suffix = $2
-          a1 = ''
-          a2 = ''
+          a1 = ''.b
+          a2 = ''.b
           prefix.scan(/[0-9A-Fa-f]+/) {|hex| a1 << [hex.hex].pack('n')}
           suffix.scan(/[0-9A-Fa-f]+/) {|hex| a2 << [hex.hex].pack('n')}
           omitlen = 16 - a1.length - a2.length
@@ -2474,8 +2474,8 @@ def self.create(arg)
         elsif Regex_CompressedHex4Dec =~ arg
           prefix, suffix, a, b, c, d = $1, $2, $3.to_i, $4.to_i, $5.to_i, $6.to_i
           if (0..255) === a && (0..255) === b && (0..255) === c && (0..255) === d
-            a1 = ''
-            a2 = ''
+            a1 = ''.b
+            a2 = ''.b
             prefix.scan(/[0-9A-Fa-f]+/) {|hex| a1 << [hex.hex].pack('n')}
             suffix.scan(/[0-9A-Fa-f]+/) {|hex| a2 << [hex.hex].pack('n')}
             omitlen = 12 - a1.length - a2.length
diff --git a/test/resolv/test_dns.rb b/test/resolv/test_dns.rb
index 338130e..d1431c1 100644
--- a/test/resolv/test_dns.rb
+++ b/test/resolv/test_dns.rb
@@ -199,6 +199,12 @@ def test_ipv6_name
     assert_equal(expected, labels)
   end
 
+  def test_ipv6_create
+    ref = '[Bug #11910] [ruby-core:72559]'
+    assert_instance_of Resolv::IPv6, Resolv::IPv6.create('::1')
+    assert_instance_of Resolv::IPv6, Resolv::IPv6.create('::1:127.0.0.1')
+  end
+
   def test_too_big_label_address
     n = 2000
     m = Resolv::DNS::Message::MessageEncoder.new {|msg|

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [ruby-core:72566] [Ruby trunk - Bug #11910] resolv.rb - can't modify frozen String in #scan
       [not found] <redmine.issue-11910.20151228172605@ruby-lang.org>
  2015-12-28 17:26 ` [ruby-core:72559] [Ruby trunk - Bug #11910] [Open] resolv.rb - can't modify frozen String in #scan dev
@ 2015-12-28 20:28 ` normalperson
  2016-02-03 11:04 ` [ruby-core:73684] [Ruby trunk Bug#11910] " usa
  2016-03-29 13:59 ` [ruby-core:74692] " naruse
  3 siblings, 0 replies; 5+ messages in thread
From: normalperson @ 2015-12-28 20:28 UTC (permalink / raw
  To: ruby-core

Issue #11910 has been updated by Eric Wong.

Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: REQUIRED

----------------------------------------
Bug #11910: resolv.rb - can't modify frozen String in #scan
https://bugs.ruby-lang.org/issues/11910#change-55822

* Author: Henry Helper
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.3.0
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: REQUIRED
----------------------------------------
lib/resolv.rb contains "frozen_string_literal: true". This causes an error in a travis build from https://github.com/middleman/middleman/pull/1713.

~~~ruby
/home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:2462:in `block in create': can't modify frozen String (RuntimeError)
from /home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:2462:in `scan'
from /home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:2462:in `create'
from /home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:462:in `each_name'
~~~

The code in line lib/resolv.rb#L2462 (https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L2462) causes the error. It modifies a string.

~~~ruby
prefix.scan(/[0-9A-Fa-f]+/) {|hex| a1 << [hex.hex].pack('n')}
~~~





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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:73684] [Ruby trunk Bug#11910] resolv.rb - can't modify frozen String in #scan
       [not found] <redmine.issue-11910.20151228172605@ruby-lang.org>
  2015-12-28 17:26 ` [ruby-core:72559] [Ruby trunk - Bug #11910] [Open] resolv.rb - can't modify frozen String in #scan dev
  2015-12-28 20:28 ` [ruby-core:72566] [Ruby trunk - Bug #11910] " normalperson
@ 2016-02-03 11:04 ` usa
  2016-03-29 13:59 ` [ruby-core:74692] " naruse
  3 siblings, 0 replies; 5+ messages in thread
From: usa @ 2016-02-03 11:04 UTC (permalink / raw
  To: ruby-core

Issue #11910 has been updated by Usaku NAKAMURA.

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

----------------------------------------
Bug #11910: resolv.rb - can't modify frozen String in #scan
https://bugs.ruby-lang.org/issues/11910#change-56879

* Author: Henry Helper
* Status: Closed
* Priority: Normal
* Assignee: 
* ruby -v: 2.3.0
* Backport: 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED
----------------------------------------
lib/resolv.rb contains "frozen_string_literal: true". This causes an error in a travis build from https://github.com/middleman/middleman/pull/1713.

~~~ruby
/home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:2462:in `block in create': can't modify frozen String (RuntimeError)
from /home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:2462:in `scan'
from /home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:2462:in `create'
from /home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:462:in `each_name'
~~~

The code in line lib/resolv.rb#L2462 (https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L2462) causes the error. It modifies a string.

~~~ruby
prefix.scan(/[0-9A-Fa-f]+/) {|hex| a1 << [hex.hex].pack('n')}
~~~





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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:74692] [Ruby trunk Bug#11910] resolv.rb - can't modify frozen String in #scan
       [not found] <redmine.issue-11910.20151228172605@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2016-02-03 11:04 ` [ruby-core:73684] [Ruby trunk Bug#11910] " usa
@ 2016-03-29 13:59 ` naruse
  3 siblings, 0 replies; 5+ messages in thread
From: naruse @ 2016-03-29 13:59 UTC (permalink / raw
  To: ruby-core

Issue #11910 has been updated by Yui NARUSE.

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

ruby_2_3 r54404 merged revision(s) 53363.

----------------------------------------
Bug #11910: resolv.rb - can't modify frozen String in #scan
https://bugs.ruby-lang.org/issues/11910#change-57821

* Author: Henry Helper
* Status: Closed
* Priority: Normal
* Assignee: 
* ruby -v: 2.3.0
* Backport: 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONE
----------------------------------------
lib/resolv.rb contains "frozen_string_literal: true". This causes an error in a travis build from https://github.com/middleman/middleman/pull/1713.

~~~ruby
/home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:2462:in `block in create': can't modify frozen String (RuntimeError)
from /home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:2462:in `scan'
from /home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:2462:in `create'
from /home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/resolv.rb:462:in `each_name'
~~~

The code in line lib/resolv.rb#L2462 (https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L2462) causes the error. It modifies a string.

~~~ruby
prefix.scan(/[0-9A-Fa-f]+/) {|hex| a1 << [hex.hex].pack('n')}
~~~





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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-03-29 13:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-11910.20151228172605@ruby-lang.org>
2015-12-28 17:26 ` [ruby-core:72559] [Ruby trunk - Bug #11910] [Open] resolv.rb - can't modify frozen String in #scan dev
2015-12-28 20:26   ` [ruby-core:72565] " Eric Wong
2015-12-28 20:28 ` [ruby-core:72566] [Ruby trunk - Bug #11910] " normalperson
2016-02-03 11:04 ` [ruby-core:73684] [Ruby trunk Bug#11910] " usa
2016-03-29 13:59 ` [ruby-core:74692] " naruse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).