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 over 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

Also available in: Atom PDF