From: matz@... Date: 2015-12-07T07:19:01+00:00 Subject: [ruby-core:71879] [Ruby trunk - Bug #11759] URI breaks with frozen strings Issue #11759 has been updated by Yukihiro Matsumoto. I prefer `String.new()` to `"".dup` because the former describes intention (of creating a buffer). In fact, my best choice is introducing `String#+` that returns a mutable copy of a string. For the size of byte code and performance, we can expect future optimization. Matz. ---------------------------------------- Bug #11759: URI breaks with frozen strings https://bugs.ruby-lang.org/issues/11759#change-55282 * Author: Mike Perham * Status: Open * Priority: Normal * Assignee: * ruby -v: 2.3.0-preview1 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- It appears URI uses String mutation and breaks frozen string mode. ~~~ $ RUBYOPT="--enable-frozen-string-literal" bundle exec rake /Users/mike/.rubies/ruby-2.3.0-preview1/lib/ruby/2.3.0/uri/generic.rb:1344:in `to_s': can't modify frozen String (RuntimeError) /Users/mike/.gem/ruby/2.3.0/gems/bundler-1.10.6/lib/bundler/source/rubygems.rb:257:in `normalize_uri' /Users/mike/.gem/ruby/2.3.0/gems/bundler-1.10.6/lib/bundler/source/rubygems.rb:198:in `add_remote' /Users/mike/.gem/ruby/2.3.0/gems/bundler-1.10.6/lib/bundler/source/rubygems.rb:25:in `block in initialize' /Users/mike/.gem/ruby/2.3.0/gems/bundler-1.10.6/lib/bundler/source/rubygems.rb:25:in `reverse_each' /Users/mike/.gem/ruby/2.3.0/gems/bundler-1.10.6/lib/bundler/source/rubygems.rb:25:in `initialize' ~~~ ---Files-------------------------------- 0001-Do-not-mutate-strings-in-URI-to_s.patch (1.76 KB) 11759.patch (610 Bytes) 11759-rev2.patch (3.21 KB) -- https://bugs.ruby-lang.org/