From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 7895D19E0024 for ; Sun, 6 Dec 2015 00:49:27 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 3770EB5D8C2 for ; Sun, 6 Dec 2015 01:21:01 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 0A0D218CC7B1 for ; Sun, 6 Dec 2015 01:21:00 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id D2A3C120457; Sun, 6 Dec 2015 01:20:57 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id B45B4120442 for ; Sun, 6 Dec 2015 01:20:54 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=8WP2Dpw0NzN+WVh5xbHbEP4gpCY=; b=W2NCgmaaLnPzNyGyfI ZO6STfkPaKFqMMqQpJx7CyT4MUH1VGduCq5yNf7O6G1h8hmgAd19ejs85LSvV3kR b1ubjzYI6nNN+DPT92BmHvZBkqzcVyGDDBHQLDCPwM8Z4lRyzxVT4En1X5Al5rI6 Gvn6adtUihg/BRQZyHwPJ6zhs= Received: by filter0422p1mdw1.sendgrid.net with SMTP id filter0422p1mdw1.9256.56630EE03D 2015-12-05 16:20:48.455908966 +0000 UTC Received: from herokuapp.com (ec2-54-144-250-101.compute-1.amazonaws.com [54.144.250.101]) by ismtpd0001p1iad1.sendgrid.net (SG) with ESMTP id I2sb9ovJShq5ohRPmyPJlw Sat, 05 Dec 2015 16:20:48.401 +0000 (UTC) Date: Sat, 05 Dec 2015 16:20:48 +0000 From: colin@invoca.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 46538 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11759 X-Redmine-Issue-Author: mperham X-Redmine-Sender: colindkelley X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS4knJQwVMwLmW8BLQwyxkui3PWHSPQGpQoGNf wc34nLh9uWVeQe+8yeE7RMgm+k/dYobU7AME6HAHVTb1Y/0foKCLA106I8yBV3t3mZhVTjrKRHoIk2 T91fqqY3eOMJoYb4elG0A95/T7v6FqR7a8kF X-ML-Name: ruby-core X-Mail-Count: 71846 Subject: [ruby-core:71846] [Ruby trunk - Bug #11759] URI breaks with frozen strings X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11759 has been updated by Colin Kelley. File 11759-rev2.patch added > Outputs: > 480 > 416 > 416 That is more significant than I thought. `''.dup` wins. > No, we shouldn't worry about performance with older versions of Ruby > with the stdlib. Good to have that confirmed. Then we should definitely leave the magic comment at the top for these reasons: a) It documents which files have been visited in the process of converting to immutable string literals. b) It allows us to immediately remove the clutter of `.freeze` at the end of string literals I've attached an updated patch with the above changes. > There may be code out in the wild which relies on "path" being mutable. I don't think we have to support that. Callers should not expect to be able to mutate object internals retrieved by accessors. If they try and a "can't modify frozen String" exception is raised, they can fix _their_ code to `dup` the value. ---------------------------------------- Bug #11759: URI breaks with frozen strings https://bugs.ruby-lang.org/issues/11759#change-55252 * 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/