[前][次][番号順一覧][スレッド一覧]

ruby-changes:42731

From: hsbt <ko1@a...>
Date: Thu, 28 Apr 2016 08:36:33 +0900 (JST)
Subject: [ruby-changes:42731] hsbt:r54804 (trunk): * lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.6.4.

hsbt	2016-04-28 09:33:08 +0900 (Thu, 28 Apr 2016)

  New Revision: 54804

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54804

  Log:
    * lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.6.4.
      Please see entries of 2.6.4 on
      https://github.com/rubygems/rubygems/blob/master/History.txt

  Added files:
    trunk/test/rubygems/test_remote_fetch_error.rb
  Modified files:
    trunk/ChangeLog
    trunk/lib/rubygems/commands/query_command.rb
    trunk/lib/rubygems/errors.rb
    trunk/lib/rubygems/installer.rb
    trunk/lib/rubygems/remote_fetcher.rb
    trunk/lib/rubygems/server.rb
    trunk/lib/rubygems/user_interaction.rb
    trunk/lib/rubygems.rb
    trunk/test/rubygems/rubygems_plugin.rb
    trunk/test/rubygems/test_gem_installer.rb
    trunk/test/rubygems/test_gem_source_fetch_problem.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54803)
+++ ChangeLog	(revision 54804)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Apr 28 09:33:03 2016  SHIBATA Hiroshi  <hsbt@r...>
+
+	* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.6.4.
+	  Please see entries of 2.6.4 on
+	  https://github.com/rubygems/rubygems/blob/master/History.txt
+
 Thu Apr 28 04:49:07 2016  Rei Odaira  <Rei.Odaira@g...>
 
 	* configure.in (rb_cv_lgamma_r_pm0): check if lgamma_r(+0.0)
Index: test/rubygems/test_gem_installer.rb
===================================================================
--- test/rubygems/test_gem_installer.rb	(revision 54803)
+++ test/rubygems/test_gem_installer.rb	(revision 54804)
@@ -2,6 +2,20 @@ https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L2
 require 'rubygems/installer_test_case'
 
 class TestGemInstaller < Gem::InstallerTestCase
+  @@symlink_supported = nil
+
+  def symlink_supported?
+    if @@symlink_supported.nil?
+      begin
+        File.symlink("", "")
+      rescue Errno::ENOENT, Errno::EEXIST
+        @@symlink_supported = true
+      rescue NotImplementedError, SystemCallError
+        @@symlink_supported = false
+      end
+    end
+    @@symlink_supported
+  end
 
   def setup
     super
@@ -552,7 +566,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L566
   end
 
   def test_generate_bin_symlink_update_older
-    return if win_platform? #Windows FS do not support symlinks
+    return if !symlink_supported?
 
     @installer.wrappers = false
     util_make_exec
@@ -588,7 +602,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L602
   end
 
   def test_generate_bin_symlink_update_remove_wrapper
-    return if win_platform? #Windows FS do not support symlinks
+    return if !symlink_supported?
 
     @installer.wrappers = true
     util_make_exec
@@ -639,7 +653,12 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L653
     installed_exec = File.join(util_inst_bindir, 'executable')
     assert_path_exists installed_exec
 
-    assert_match(/Unable to use symlinks on Windows, installing wrapper/i,
+    if symlink_supported?
+      assert_send([File, :symlink?, installed_exec])
+      return
+    end
+
+    assert_match(/Unable to use symlinks, installing wrapper/i,
                  @ui.error)
 
     wrapper = File.read installed_exec
@@ -651,7 +670,7 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L670
   end
 
   def test_generate_bin_uses_default_shebang
-    return if win_platform? #Windows FS do not support symlinks
+    return if !symlink_supported?
 
     @installer.wrappers = true
     util_make_exec
Index: test/rubygems/rubygems_plugin.rb
===================================================================
--- test/rubygems/rubygems_plugin.rb	(revision 54803)
+++ test/rubygems/rubygems_plugin.rb	(revision 54804)
@@ -6,6 +6,10 @@ require 'rubygems/command_manager' https://github.com/ruby/ruby/blob/trunk/test/rubygems/rubygems_plugin.rb#L6
 #
 # DO NOT include code like this in your rubygems_plugin.rb
 
+module Gem::Commands
+  remove_const(:InterruptCommand) if defined?(InterruptCommand)
+end
+
 class Gem::Commands::InterruptCommand < Gem::Command
 
   def initialize
Index: test/rubygems/test_gem_source_fetch_problem.rb
===================================================================
--- test/rubygems/test_gem_source_fetch_problem.rb	(revision 54803)
+++ test/rubygems/test_gem_source_fetch_problem.rb	(revision 54804)
@@ -16,5 +16,13 @@ class TestGemSourceFetchProblem < Gem::T https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_source_fetch_problem.rb#L16
     assert_equal 'test', e.message
   end
 
+  def test_password_redacted
+    source = Gem::Source.new 'https://username:secret@g...'
+    error  = RuntimeError.new 'test'
+
+    sf = Gem::SourceFetchProblem.new source, error
+
+    refute_match sf.wordy, 'secret'
+  end
 end
 
Index: test/rubygems/test_remote_fetch_error.rb
===================================================================
--- test/rubygems/test_remote_fetch_error.rb	(revision 0)
+++ test/rubygems/test_remote_fetch_error.rb	(revision 54804)
@@ -0,0 +1,21 @@ https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_remote_fetch_error.rb#L1
+# frozen_string_literal: true
+require 'rubygems/test_case'
+
+class TestRemoteFetchError < Gem::TestCase
+
+  def test_password_redacted
+    error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://user:secret@g...')
+    refute_match error.to_s, 'secret'
+  end
+
+  def test_invalid_url
+    error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://::gemsource.org')
+    assert_equal error.to_s, 'There was an error fetching (https://::gemsource.org)'
+  end
+
+  def test_to_s
+    error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://gemsource.org')
+    assert_equal error.to_s, 'There was an error fetching (https://gemsource.org)'
+  end
+end
+
Index: lib/rubygems.rb
===================================================================
--- lib/rubygems.rb	(revision 54803)
+++ lib/rubygems.rb	(revision 54804)
@@ -10,7 +10,7 @@ require 'rbconfig' https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L10
 require 'thread'
 
 module Gem
-  VERSION = '2.6.3'
+  VERSION = '2.6.4'
 end
 
 # Must be first since it unloads the prelude from 1.9.2
Index: lib/rubygems/installer.rb
===================================================================
--- lib/rubygems/installer.rb	(revision 54803)
+++ lib/rubygems/installer.rb	(revision 54804)
@@ -509,12 +509,6 @@ class Gem::Installer https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L509
   # the symlink if the gem being installed has a newer version.
 
   def generate_bin_symlink(filename, bindir)
-    if Gem.win_platform? then
-      alert_warning "Unable to use symlinks on Windows, installing wrapper"
-      generate_bin_script filename, bindir
-      return
-    end
-
     src = File.join gem_dir, spec.bindir, filename
     dst = File.join bindir, formatted_program_filename(filename)
 
@@ -528,6 +522,9 @@ class Gem::Installer https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L522
     end
 
     FileUtils.symlink src, dst, :verbose => Gem.configuration.really_verbose
+  rescue NotImplementedError, SystemCallError
+    alert_warning "Unable to use symlinks, installing wrapper"
+    generate_bin_script filename, bindir
   end
 
   ##
Index: lib/rubygems/errors.rb
===================================================================
--- lib/rubygems/errors.rb	(revision 54803)
+++ lib/rubygems/errors.rb	(revision 54804)
@@ -170,6 +170,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/errors.rb#L170
     # An English description of the error.
 
     def wordy
+      @source.uri.password = 'REDACTED' unless @source.uri.password.nil?
       "Unable to download data from #{@source.uri} - #{@error.message}"
     end
 
Index: lib/rubygems/commands/query_command.rb
===================================================================
--- lib/rubygems/commands/query_command.rb	(revision 54803)
+++ lib/rubygems/commands/query_command.rb	(revision 54804)
@@ -259,7 +259,7 @@ is too hard to use. https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/query_command.rb#L259
             if options[:domain] == :remote || specs.all? { |spec| spec.is_a? Gem::Source }
               version
             else
-              spec = specs.select { |spec| spec.version == version }
+              spec = specs.select { |s| s.version == version }
               if spec.first.default_gem?
                 "default: #{version}"
               else
Index: lib/rubygems/server.rb
===================================================================
--- lib/rubygems/server.rb	(revision 54803)
+++ lib/rubygems/server.rb	(revision 54804)
@@ -34,7 +34,7 @@ class Gem::Server https://github.com/ruby/ruby/blob/trunk/lib/rubygems/server.rb#L34
   include ERB::Util
   include Gem::UserInteraction
 
-  SEARCH = <<-SEARCH
+  SEARCH = <<-ERB
       <form class="headerSearch" name="headerSearchForm" method="get" action="/rdoc">
         <div id="search" style="float:right">
           <label for="q">Filter/Search</label>
@@ -42,9 +42,9 @@ class Gem::Server https://github.com/ruby/ruby/blob/trunk/lib/rubygems/server.rb#L42
           <button type="submit" style="display:none"></button>
         </div>
       </form>
-  SEARCH
+  ERB
 
-  DOC_TEMPLATE = <<-'DOC_TEMPLATE'
+  DOC_TEMPLATE = <<-'ERB'
   <?xml version="1.0" encoding="iso-8859-1"?>
   <!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -68,35 +68,33 @@ class Gem::Server https://github.com/ruby/ruby/blob/trunk/lib/rubygems/server.rb#L68
         <h1>Summary</h1>
   <p>There are <%=values["gem_count"]%> gems installed:</p>
   <p>
-  <%= values["specs"].map { |v| "<a href=\"##{v["name"]}\">#{v["name"]}</a>" }.join ', ' %>.
+  <%= values["specs"].map { |v| "<a href\"##{u v["name"]}\">#{h v["name"]}</a>" }.join ', ' %>.
   <h1>Gems</h1>
 
   <dl>
   <% values["specs"].each do |spec| %>
     <dt>
     <% if spec["first_name_entry"] then %>
-      <a name="<%=spec["name"]%>"></a>
+      <a name="<%=h spec["name"]%>"></a>
     <% end %>
 
-    <b><%=spec["name"]%> <%=spec["version"]%></b>
+    <b><%=h spec["name"]%> <%=h spec["version"]%></b>
 
-    <% if spec["ri_installed"] then %>
-      <a href="<%=spec["doc_path"]%>">[rdoc]</a>
-    <% elsif spec["rdoc_installed"] then %>
-      <a href="<%=spec["doc_path"]%>">[rdoc]</a>
+    <% if spec["ri_installed"] || spec["rdoc_installed"] then %>
+      <a href="<%=u spec["doc_path"]%>">[rdoc]</a>
     <% else %>
       <span title="rdoc not installed">[rdoc]</span>
     <% end %>
 
     <% if spec["homepage"] then %>
-      <a href="<%=spec["homepage"]%>" title="<%=spec["homepage"]%>">[www]</a>
+      <a href="<%=u spec["homepage"]%>" title="<%=h spec["homepage"]%>">[www]</a>
     <% else %>
       <span title="no homepage available">[www]</span>
     <% end %>
 
     <% if spec["has_deps"] then %>
      - depends on
-      <%= spec["dependencies"].map { |v| "<a href=\"##{v["name"]}\">#{v["name"]}</a>" }.join ', ' %>.
+      <%= spec["dependencies"].map { |v| "<a href=\"##{u v["name"]}>#{h v["name"]}</a>" }.join ', ' %>.
     <% end %>
     </dt>
     <dd>
@@ -110,7 +108,7 @@ class Gem::Server https://github.com/ruby/ruby/blob/trunk/lib/rubygems/server.rb#L108
           Executables are
       <%end%>
 
-      <%= spec["executables"].map { |v| "<span class=\"context-item-name\">#{v["executable"]}</span>"}.join ', ' %>.
+      <%= spec["executables"].map { |v| "<span class=\"context-item-name\">#{h v["executable"]}</span>"}.join ', ' %>.
 
     <%end%>
     <br/>
@@ -127,10 +125,10 @@ class Gem::Server https://github.com/ruby/ruby/blob/trunk/lib/rubygems/server.rb#L125
   </div>
   </body>
   </html>
-  DOC_TEMPLATE
+  ERB
 
   # CSS is copy & paste from rdoc-style.css, RDoc V1.0.1 - 20041108
-  RDOC_CSS = <<-RDOC_CSS
+  RDOC_CSS = <<-CSS
 body {
     font-family: Verdana,Arial,Helvetica,sans-serif;
     font-size:   90%;
@@ -338,9 +336,9 @@ div.method-source-code pre { color: #ffd https://github.com/ruby/ruby/blob/trunk/lib/rubygems/server.rb#L336
 .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
 .ruby-regexp  { color: #ffa07a; background: transparent; }
 .ruby-value   { color: #7fffd4; background: transparent; }
-  RDOC_CSS
+  CSS
 
-  RDOC_NO_DOCUMENTATION = <<-'NO_DOC'
+  RDOC_NO_DOCUMENTATION = <<-'ERB'
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -372,9 +370,9 @@ div.method-source-code pre { color: #ffd https://github.com/ruby/ruby/blob/trunk/lib/rubygems/server.rb#L370
     </div>
   </body>
 </html>
-  NO_DOC
+  ERB
 
-  RDOC_SEARCH_TEMPLATE = <<-'RDOC_SEARCH'
+  RDOC_SEARCH_TEMPLATE = <<-'ERB'
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -401,10 +399,10 @@ div.method-source-code pre { color: #ffd https://github.com/ruby/ruby/blob/trunk/lib/rubygems/server.rb#L399
           <% doc_items.each do |doc_item| %>
             <dt>
               <b><%=doc_item[:name]%></b>
-              <a href="<%=doc_item[:url]%>">[rdoc]</a>
+              <a href="<%=u doc_item[:url]%>">[rdoc]</a>
             </dt>
             <dd>
-              <%=doc_item[:summary]%>
+              <%=h doc_item[:summary]%>
               <br/>
               <br/>
             </dd>
@@ -423,7 +421,7 @@ div.method-source-code pre { color: #ffd https://github.com/ruby/ruby/blob/trunk/lib/rubygems/server.rb#L421
     </div>
   </body>
 </html>
-  RDOC_SEARCH
+  ERB
 
   def self.run(options)
     new(options[:gemdir], options[:port], options[:daemon],
@@ -459,9 +457,9 @@ div.method-source-code pre { color: #ffd https://github.com/ruby/ruby/blob/trunk/lib/rubygems/server.rb#L457
 
   def doc_root gem_name
     if have_rdoc_4_plus? then
-      "/doc_root/#{gem_name}/"
+      "/doc_root/#{u gem_name}/"
     else
-      "/doc_root/#{gem_name}/rdoc/index.html"
+      "/doc_root/#{u gem_name}/rdoc/index.html"
     end
   end
 
Index: lib/rubygems/user_interaction.rb
===================================================================
--- lib/rubygems/user_interaction.rb	(revision 54803)
+++ lib/rubygems/user_interaction.rb	(revision 54804)
@@ -5,6 +5,8 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/user_interaction.rb#L5
 # See LICENSE.txt for permissions.
 #++
 
+require 'rubygems/util'
+
 begin
   require 'io/console'
 rescue LoadError
@@ -676,13 +678,8 @@ class Gem::SilentUI < Gem::StreamUI https://github.com/ruby/ruby/blob/trunk/lib/rubygems/user_interaction.rb#L678
   def initialize
     reader, writer = nil, nil
 
-    begin
-      reader = File.open('/dev/null', 'r')
-      writer = File.open('/dev/null', 'w')
-    rescue Errno::ENOENT
-      reader = File.open('nul', 'r')
-      writer = File.open('nul', 'w')
-    end
+    reader = File.open(Gem::Util::NULL_DEVICE, 'r')
+    writer = File.open(Gem::Util::NULL_DEVICE, 'w')
 
     super reader, writer, writer, false
   end
@@ -701,4 +698,3 @@ class Gem::SilentUI < Gem::StreamUI https://github.com/ruby/ruby/blob/trunk/lib/rubygems/user_interaction.rb#L698
     SilentProgressReporter.new(@outs, *args)
   end
 end
-
Index: lib/rubygems/remote_fetcher.rb
===================================================================
--- lib/rubygems/remote_fetcher.rb	(revision 54803)
+++ lib/rubygems/remote_fetcher.rb	(revision 54804)
@@ -27,7 +27,13 @@ class Gem::RemoteFetcher https://github.com/ruby/ruby/blob/trunk/lib/rubygems/remote_fetcher.rb#L27
 
     def initialize(message, uri)
       super message
-      @uri = uri
+      begin
+        uri = URI(uri)
+        uri.password = 'REDACTED' if uri.password
+        @uri = uri.to_s
+      rescue URI::InvalidURIError, ArgumentError
+        @uri = uri
+      end
     end
 
     def to_s # :nodoc:

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]