Project

General

Profile

Bug #11910

resolv.rb - can't modify frozen String in #scan

Added by henry.helper (Henry Helper) over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:72559]

Description

lib/resolv.rb contains "frozen_string_literal: true". This causes an error in a travis build from https://github.com/middleman/middleman/pull/1713.

/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.

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

Related issues

Has duplicate Ruby master - Bug #12061: DNS resolv error RuntimeError: can't modify frozen String when using IPv6 AddressesClosedActions

Updated by normalperson (Eric Wong) over 4 years ago

  • 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
#2

Updated by Anonymous over 4 years ago

  • Status changed from Open to Closed

Applied in changeset r53363.


Resolv::IPv6.create: avoid modifying frozen string literal

  • lib/resolv.rb (Resolv::IPv6.create): avoid modifying frozen
  • test/resolv/test_dns.rb (test_ipv6_create): test for above [Bug #11910] [ruby-core:72559]

Updated by usa (Usaku NAKAMURA) over 4 years ago

  • 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
#4

Updated by usa (Usaku NAKAMURA) over 4 years ago

  • Has duplicate Bug #12061: DNS resolv error RuntimeError: can't modify frozen String when using IPv6 Addresses added

Updated by naruse (Yui NARUSE) about 4 years ago

  • 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.

Also available in: Atom PDF