Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8df95d6ad785
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5ce78c480fa6
Choose a head ref
  • 3 commits
  • 97 files changed
  • 1 contributor

Commits on Nov 12, 2014

  1. Copy the full SHA
    5021eb4 View commit details
  2. Restructure argv into a single command when doing chdir.

    JRuby emulates current dir to be a good JVM citizen, since doing
    chdir could really mess up other apps/threads running in the same
    process. Unfortunately, posix_spawn does not support chdir, so we
    restructure the incoming command to use sh with a chdir prepended
    to the script. This worked fine for cases where argv only
    contained the command to run, but we missed logic to deal with
    additional args.
    
    This commit checks for chdir and argc > 1, building a new command
    line string by joining the individual argv elements with ' '.
    
    Fix was to get the update_rubygems command working, which does a
    Dir.chdir followed by a Kernel#system.
    headius committed Nov 12, 2014
    Copy the full SHA
    a467bc5 View commit details
  3. Update RubyGems to 2.4.3.

    headius committed Nov 12, 2014
    Copy the full SHA
    5ce78c4 View commit details
Showing with 2,483 additions and 702 deletions.
  1. +6 −0 core/src/main/java/org/jruby/util/io/PopenExecutor.java
  2. +1 −1 core/src/main/java/org/jruby/util/io/PosixShim.java
  3. +35 −13 lib/ruby/stdlib/rubygems.rb
  4. +1 −1 lib/ruby/stdlib/rubygems/available_set.rb
  5. +20 −10 lib/ruby/stdlib/rubygems/basic_specification.rb
  6. +4 −1 lib/ruby/stdlib/rubygems/command.rb
  7. +2 −1 lib/ruby/stdlib/rubygems/command_manager.rb
  8. +11 −13 lib/ruby/stdlib/rubygems/commands/cert_command.rb
  9. +2 −2 lib/ruby/stdlib/rubygems/commands/cleanup_command.rb
  10. +23 −2 lib/ruby/stdlib/rubygems/commands/contents_command.rb
  11. +2 −2 lib/ruby/stdlib/rubygems/commands/dependency_command.rb
  12. +5 −2 lib/ruby/stdlib/rubygems/commands/environment_command.rb
  13. +199 −20 lib/ruby/stdlib/rubygems/commands/help_command.rb
  14. +48 −10 lib/ruby/stdlib/rubygems/commands/install_command.rb
  15. +2 −2 lib/ruby/stdlib/rubygems/commands/list_command.rb
  16. +17 −15 lib/ruby/stdlib/rubygems/commands/mirror_command.rb
  17. +74 −0 lib/ruby/stdlib/rubygems/commands/open_command.rb
  18. +3 −1 lib/ruby/stdlib/rubygems/commands/owner_command.rb
  19. +5 −5 lib/ruby/stdlib/rubygems/commands/search_command.rb
  20. +1 −1 lib/ruby/stdlib/rubygems/commands/setup_command.rb
  21. +13 −1 lib/ruby/stdlib/rubygems/commands/uninstall_command.rb
  22. +15 −11 lib/ruby/stdlib/rubygems/commands/update_command.rb
  23. +8 −13 lib/ruby/stdlib/rubygems/commands/yank_command.rb
  24. +14 −3 lib/ruby/stdlib/rubygems/config_file.rb
  25. +8 −1 lib/ruby/stdlib/rubygems/core_ext/kernel_gem.rb
  26. +12 −22 lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb
  27. +19 −5 lib/ruby/stdlib/rubygems/defaults.rb
  28. +39 −18 lib/ruby/stdlib/rubygems/dependency.rb
  29. +49 −10 lib/ruby/stdlib/rubygems/dependency_installer.rb
  30. +1 −1 lib/ruby/stdlib/rubygems/doctor.rb
  31. +30 −0 lib/ruby/stdlib/rubygems/errors.rb
  32. +22 −2 lib/ruby/stdlib/rubygems/exceptions.rb
  33. +1 −1 lib/ruby/stdlib/rubygems/ext/builder.rb
  34. +13 −11 lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb
  35. +1 −1 lib/ruby/stdlib/rubygems/gemcutter_utilities.rb
  36. +17 −0 lib/ruby/stdlib/rubygems/install_update_options.rb
  37. +49 −24 lib/ruby/stdlib/rubygems/installer.rb
  38. +2 −0 lib/ruby/stdlib/rubygems/installer_test_case.rb
  39. +2 −2 lib/ruby/stdlib/rubygems/local_remote_options.rb
  40. +4 −2 lib/ruby/stdlib/rubygems/name_tuple.rb
  41. +27 −14 lib/ruby/stdlib/rubygems/package.rb
  42. +33 −0 lib/ruby/stdlib/rubygems/package/file_source.rb
  43. +45 −0 lib/ruby/stdlib/rubygems/package/io_source.rb
  44. +5 −5 lib/ruby/stdlib/rubygems/package/old.rb
  45. +3 −0 lib/ruby/stdlib/rubygems/package/source.rb
  46. +2 −0 lib/ruby/stdlib/rubygems/package/tar_reader/entry.rb
  47. +2 −1 lib/ruby/stdlib/rubygems/platform.rb
  48. +1 −2 lib/ruby/stdlib/rubygems/rdoc.rb
  49. +58 −11 lib/ruby/stdlib/rubygems/remote_fetcher.rb
  50. +71 −101 lib/ruby/stdlib/rubygems/request.rb
  51. +79 −0 lib/ruby/stdlib/rubygems/request/connection_pools.rb
  52. +38 −0 lib/ruby/stdlib/rubygems/request/http_pool.rb
  53. +10 −0 lib/ruby/stdlib/rubygems/request/https_pool.rb
  54. +134 −22 lib/ruby/stdlib/rubygems/request_set.rb
  55. +304 −24 lib/ruby/stdlib/rubygems/request_set/gem_dependency_api.rb
  56. +81 −28 lib/ruby/stdlib/rubygems/request_set/lockfile.rb
  57. +3 −0 lib/ruby/stdlib/rubygems/requirement.rb
  58. +49 −16 lib/ruby/stdlib/rubygems/resolver.rb
  59. +7 −0 lib/ruby/stdlib/rubygems/resolver/activation_request.rb
  60. +12 −2 lib/ruby/stdlib/rubygems/resolver/api_set.rb
  61. +6 −0 lib/ruby/stdlib/rubygems/resolver/api_specification.rb
  62. +28 −0 lib/ruby/stdlib/rubygems/resolver/best_set.rb
  63. +16 −0 lib/ruby/stdlib/rubygems/resolver/composed_set.rb
  64. +45 −7 lib/ruby/stdlib/rubygems/resolver/conflict.rb
  65. +20 −1 lib/ruby/stdlib/rubygems/resolver/dependency_request.rb
  66. +1 −1 lib/ruby/stdlib/rubygems/resolver/git_set.rb
  67. +25 −1 lib/ruby/stdlib/rubygems/resolver/git_specification.rb
  68. +4 −2 lib/ruby/stdlib/rubygems/resolver/index_set.rb
  69. +19 −1 lib/ruby/stdlib/rubygems/resolver/installed_specification.rb
  70. +90 −4 lib/ruby/stdlib/rubygems/resolver/installer_set.rb
  71. +25 −0 lib/ruby/stdlib/rubygems/resolver/local_specification.rb
  72. +13 −9 lib/ruby/stdlib/rubygems/resolver/lock_set.rb
  73. +27 −1 lib/ruby/stdlib/rubygems/resolver/lock_specification.rb
  74. +13 −1 lib/ruby/stdlib/rubygems/resolver/set.rb
  75. +0 −2 lib/ruby/stdlib/rubygems/resolver/spec_specification.rb
  76. +23 −2 lib/ruby/stdlib/rubygems/resolver/specification.rb
  77. +3 −1 lib/ruby/stdlib/rubygems/resolver/vendor_set.rb
  78. +1 −1 lib/ruby/stdlib/rubygems/resolver/vendor_specification.rb
  79. +1 −0 lib/ruby/stdlib/rubygems/security/policy.rb
  80. +36 −1 lib/ruby/stdlib/rubygems/server.rb
  81. +10 −2 lib/ruby/stdlib/rubygems/source.rb
  82. +12 −4 lib/ruby/stdlib/rubygems/source/git.rb
  83. +6 −1 lib/ruby/stdlib/rubygems/source/installed.rb
  84. +6 −1 lib/ruby/stdlib/rubygems/source/specific_file.rb
  85. +6 −13 lib/ruby/stdlib/rubygems/spec_fetcher.rb
  86. +122 −87 lib/ruby/stdlib/rubygems/specification.rb
  87. +30 −88 lib/ruby/stdlib/rubygems/ssl_certs/AddTrustExternalCARoot.pem
  88. +35 −0 lib/ruby/stdlib/rubygems/ssl_certs/COMODORSACertificationAuthority.pem
  89. +31 −0 lib/ruby/stdlib/rubygems/ssl_certs/COMODORSADomainValidationSecureServer.pem
  90. +14 −0 lib/ruby/stdlib/rubygems/stub_specification.rb
  91. +13 −7 lib/ruby/stdlib/rubygems/test_case.rb
  92. +2 −0 lib/ruby/stdlib/rubygems/test_utilities.rb
  93. +15 −5 lib/ruby/stdlib/rubygems/text.rb
  94. +4 −1 lib/ruby/stdlib/rubygems/uninstaller.rb
  95. +18 −0 lib/ruby/stdlib/rubygems/user_interaction.rb
  96. +14 −1 lib/ruby/stdlib/rubygems/util.rb
  97. +5 −1 lib/ruby/stdlib/rubygems/version.rb
6 changes: 6 additions & 0 deletions core/src/main/java/org/jruby/util/io/PopenExecutor.java
Original file line number Diff line number Diff line change
@@ -1762,6 +1762,12 @@ private static void execFillarg(ThreadContext context, RubyString prog, IRubyObj
}
}

// restructure command as a single string if chdir and has args
if (eargp.chdir_given() && argc > 1) {
RubyArray array = RubyArray.newArrayNoCopy(runtime, argv);
prog = (RubyString)array.join(context, RubyString.newString(runtime, " "));
}

if (!env.isNil()) {
eargp.env_modification = RubyIO.checkExecEnv(context, (RubyHash)env);
}
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/io/PosixShim.java
Original file line number Diff line number Diff line change
@@ -412,7 +412,7 @@ public Channel open(String cwd, String path, ModeFlags flags, int perm, ClassLoa
} catch (ResourceException.TooManySymlinks e) {
errno = Errno.ELOOP;
} catch (IOException e) {
throw new RuntimeException("Unhandled IOException" + e.getLocalizedMessage(), e);
throw new RuntimeException("Unhandled IOException: " + e.getLocalizedMessage(), e);
}
return null;
}
48 changes: 35 additions & 13 deletions lib/ruby/stdlib/rubygems.rb
Original file line number Diff line number Diff line change
@@ -6,9 +6,10 @@
#++

require 'rbconfig'
require 'thread'

module Gem
VERSION = '2.2.2'
VERSION = '2.4.3'
end

# Must be first since it unloads the prelude from 1.9.2
@@ -56,8 +57,8 @@ module Gem
# RubyGems defaults are stored in rubygems/defaults.rb. If you're packaging
# RubyGems or implementing Ruby you can change RubyGems' defaults.
#
# For RubyGems packagers, provide lib/rubygems/operating_system.rb and
# override any defaults from lib/rubygems/defaults.rb.
# For RubyGems packagers, provide lib/rubygems/defaults/operating_system.rb
# and override any defaults from lib/rubygems/defaults.rb.
#
# For Ruby implementers, provide lib/rubygems/defaults/#{RUBY_ENGINE}.rb and
# override any defaults from lib/rubygems/defaults.rb.
@@ -83,7 +84,7 @@ module Gem
# * Chad Fowler -- chad(at)chadfowler.com
# * David Black -- dblack(at)wobblini.net
# * Paul Brannan -- paul(at)atdesk.com
# * Jim Weirch -- jim(at)weirichhouse.org
# * Jim Weirich -- jim(at)weirichhouse.org
#
# Contributors:
#
@@ -156,6 +157,7 @@ module Gem

@configuration = nil
@loaded_specs = {}
LOADED_SPECS_MUTEX = Mutex.new
@path_to_default_spec_map = {}
@platforms = []
@ruby = nil
@@ -298,7 +300,7 @@ def self.configuration=(config)
end

##
# The path the the data directory specified by the gem name. If the
# The path to the data directory specified by the gem name. If the
# package is not available as a gem, return nil.

def self.datadir(gem_name)
@@ -544,9 +546,9 @@ def self.inflate(data)
# Fetching: minitest-3.0.1.gem (100%)
# => [#<Gem::Specification:0x1013b4528 @name="minitest", ...>]

def self.install name, version = Gem::Requirement.default
def self.install name, version = Gem::Requirement.default, *options
require "rubygems/dependency_installer"
inst = Gem::DependencyInstaller.new
inst = Gem::DependencyInstaller.new(*options)
inst.install name, version
inst.installed_gems
end
@@ -995,19 +997,31 @@ def self.load_env_plugins
end

##
# Looks for gem dependency files (gem.deps.rb, Gemfile, Isolate) from the
# current directory up and activates the gems in the first file found.
# Looks for a gem dependency file at +path+ and activates the gems in the
# file if found. If the file is not found an ArgumentError is raised.
#
# If +path+ is not given the RUBYGEMS_GEMDEPS environment variable is used,
# but if no file is found no exception is raised.
#
# If '-' is given for +path+ RubyGems searches up from the current working
# directory for gem dependency files (gem.deps.rb, Gemfile, Isolate) and
# activates the gems in the first one found.
#
# You can run this automatically when rubygems starts. To enable, set
# the <code>RUBYGEMS_GEMDEPS</code> environment variable to either the path
# of your Gemfile or "-" to auto-discover in parent directories.
# of your gem dependencies file or "-" to auto-discover in parent
# directories.
#
# NOTE: Enabling automatic discovery on multiuser systems can lead to
# execution of arbitrary code when used from directories outside your
# control.

def self.use_gemdeps
return unless path = ENV['RUBYGEMS_GEMDEPS']
def self.use_gemdeps path = nil
raise_exception = path

path ||= ENV['RUBYGEMS_GEMDEPS']
return unless path

path = path.dup

if path == "-" then
@@ -1025,7 +1039,11 @@ def self.use_gemdeps

path.untaint

return unless File.file? path
unless File.file? path then
return unless raise_exception

raise ArgumentError, "Unable to find gem dependencies file at #{path}"
end

rs = Gem::RequestSet.new
rs.load_gemdeps path
@@ -1035,6 +1053,10 @@ def self.use_gemdeps
sp.activate
sp
end
rescue Gem::LoadError, Gem::UnsatisfiableDependencyError => e
warn e.message
warn "You may need to `gem install -g` to install missing gems"
warn ""
end

class << self
2 changes: 1 addition & 1 deletion lib/ruby/stdlib/rubygems/available_set.rb
Original file line number Diff line number Diff line change
@@ -126,7 +126,7 @@ def find_all(req)
dep = req.dependency

match = @set.find_all do |t|
dep.matches_spec? t.spec
dep.match? t.spec
end

match.map do |t|
30 changes: 20 additions & 10 deletions lib/ruby/stdlib/rubygems/basic_specification.rb
Original file line number Diff line number Diff line change
@@ -14,6 +14,11 @@ class Gem::BasicSpecification

attr_writer :extension_dir # :nodoc:

##
# Is this specification ignored for activation purposes?

attr_writer :ignored # :nodoc:

##
# The path this gemspec was loaded from. This attribute is not persisted.

@@ -53,7 +58,16 @@ def base_dir
# Return true if this spec can require +file+.

def contains_requirable_file? file
build_extensions
if instance_variable_defined?(:@ignored) or
instance_variable_defined?('@ignored') then
return false
elsif missing_extensions? then
@ignored = true

warn "Ignoring #{full_name} because its extensions are not built. " +
"Try: gem pristine #{full_name}"
return false
end

suffixes = Gem.suffixes

@@ -120,11 +134,11 @@ def full_name
# activated.

def full_require_paths
full_paths = @require_paths.map do |path|
full_paths = raw_require_paths.map do |path|
File.join full_gem_path, path
end

full_paths.unshift extension_dir unless @extensions.empty?
full_paths.unshift extension_dir unless @extensions.nil? || @extensions.empty?

full_paths
end
@@ -176,7 +190,7 @@ def platform
end

def raw_require_paths # :nodoc:
@require_paths
Array(@require_paths)
end

##
@@ -197,13 +211,9 @@ def raw_require_paths # :nodoc:
# spec.require_path = '.'

def require_paths
return @require_paths if @extensions.empty?

relative_extension_dir =
File.join '..', '..', 'extensions', Gem::Platform.local.to_s,
Gem.extension_api_version, full_name
return raw_require_paths if @extensions.nil? || @extensions.empty?

[relative_extension_dir].concat @require_paths
[extension_dir].concat raw_require_paths
end

##
5 changes: 4 additions & 1 deletion lib/ruby/stdlib/rubygems/command.rb
Original file line number Diff line number Diff line change
@@ -148,6 +148,8 @@ def execute

##
# Display to the user that a gem couldn't be found and reasons why
#--
# TODO: replace +domain+ with a parameter to suppress suggestions

def show_lookup_failure(gem_name, version, errors, domain)
if errors and !errors.empty?
@@ -557,7 +559,8 @@ def wrap(text, width) # :doc:
Further help:
gem help commands list all 'gem' commands
gem help examples show some examples of usage
gem help platforms show information about platforms
gem help gem_dependencies gem dependencies file guide
gem help platforms gem platforms guide
gem help <COMMAND> show help on COMMAND
(e.g. 'gem help install')
gem server present a web page at
3 changes: 2 additions & 1 deletion lib/ruby/stdlib/rubygems/command_manager.rb
Original file line number Diff line number Diff line change
@@ -48,6 +48,7 @@ class Gem::CommandManager
:list,
:lock,
:mirror,
:open,
:outdated,
:owner,
:pristine,
@@ -136,7 +137,7 @@ def command_names
def run(args, build_args=nil)
process_args(args, build_args)
rescue StandardError, Timeout::Error => ex
alert_error "While executing gem ... (#{ex.class})\n #{ex.to_s}"
alert_error "While executing gem ... (#{ex.class})\n #{ex}"
ui.backtrace ex

terminate_interaction(1)
24 changes: 11 additions & 13 deletions lib/ruby/stdlib/rubygems/commands/cert_command.rb
Original file line number Diff line number Diff line change
@@ -129,23 +129,21 @@ def build_cert name, key # :nodoc:
end

def build_key # :nodoc:
if options[:key] then
options[:key]
else
passphrase = ask_for_password 'Passphrase for your Private Key:'
say "\n"
return options[:key] if options[:key]

passphrase_confirmation = ask_for_password 'Please repeat the passphrase for your Private Key:'
say "\n"
passphrase = ask_for_password 'Passphrase for your Private Key:'
say "\n"

raise Gem::CommandLineError,
"Passphrase and passphrase confirmation don't match" unless passphrase == passphrase_confirmation
passphrase_confirmation = ask_for_password 'Please repeat the passphrase for your Private Key:'
say "\n"

key = Gem::Security.create_key
key_path = Gem::Security.write key, "gem-private_key.pem", 0600, passphrase
raise Gem::CommandLineError,
"Passphrase and passphrase confirmation don't match" unless passphrase == passphrase_confirmation

return key, key_path
end
key = Gem::Security.create_key
key_path = Gem::Security.write key, "gem-private_key.pem", 0600, passphrase

return key, key_path
end

def certificates_matching filter
4 changes: 2 additions & 2 deletions lib/ruby/stdlib/rubygems/commands/cleanup_command.rb
Original file line number Diff line number Diff line change
@@ -67,10 +67,10 @@ def execute

say "Clean Up Complete"

if Gem.configuration.really_verbose then
verbose do
skipped = @default_gems.map { |spec| spec.full_name }

say "Skipped default gems: #{skipped.join ', '}"
"Skipped default gems: #{skipped.join ', '}"
end
end

25 changes: 23 additions & 2 deletions lib/ruby/stdlib/rubygems/commands/contents_command.rb
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@ class Gem::Commands::ContentsCommand < Gem::Command

def initialize
super 'contents', 'Display the contents of the installed gems',
:specdirs => [], :lib_only => false, :prefix => true
:specdirs => [], :lib_only => false, :prefix => true,
:show_install_dir => false

add_version_option

@@ -32,6 +33,11 @@ def initialize
options[:prefix] = prefix
end

add_option( '--[no-]show-install-dir',
'Show only the gem install dir') do |show, options|
options[:show_install_dir] = show
end

@path_kind = nil
@spec_dirs = nil
@version = nil
@@ -65,7 +71,12 @@ def execute
names = gem_names

names.each do |name|
found = gem_contents name
found =
if options[:show_install_dir] then
gem_install_dir name
else
gem_contents name
end

terminate_interaction 1 unless found or names.length > 1
end
@@ -115,6 +126,16 @@ def gem_contents name
true
end

def gem_install_dir name
spec = spec_for name

return false unless spec

say spec.gem_dir

true
end

def gem_names # :nodoc:
if options[:all] then
Gem::Specification.map(&:name)
4 changes: 2 additions & 2 deletions lib/ruby/stdlib/rubygems/commands/dependency_command.rb
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ def initialize
end

def arguments # :nodoc:
"GEMNAME name of gem to show dependencies for"
"REGEXP show dependencies for gems whose names start with REGEXP"
end

def defaults_str # :nodoc:
@@ -50,7 +50,7 @@ def description # :nodoc:
end

def usage # :nodoc:
"#{program_name} GEMNAME"
"#{program_name} REGEXP"
end

def fetch_remote_specs dependency # :nodoc:
7 changes: 5 additions & 2 deletions lib/ruby/stdlib/rubygems/commands/environment_command.rb
Original file line number Diff line number Diff line change
@@ -28,8 +28,9 @@ def description # :nodoc:
gemrc files, environment variables and built-in defaults.
Command line argument defaults and some RubyGems defaults can be set in a
~/.gemrc file for individual users and a /etc/gemrc for all users. These
files are YAML files with the following YAML keys:
~/.gemrc file for individual users and a gemrc in the SYSTEM CONFIGURATION
DIRECTORY for all users. These files are YAML files with the following YAML
keys:
:sources: A YAML array of remote gem repositories to install gems from
:verbose: Verbosity of the gem command. false, true, and :really are the
@@ -120,6 +121,8 @@ def show_environment # :nodoc:

out << " - SPEC CACHE DIRECTORY: #{Gem.spec_cache_dir}\n"

out << " - SYSTEM CONFIGURATION DIRECTORY: #{Gem::ConfigFile::SYSTEM_CONFIG_PATH}\n"

out << " - RUBYGEMS PLATFORMS:\n"
Gem.platforms.each do |platform|
out << " - #{platform}\n"
Loading