Merge RubyGems 3.1.0.pre3

* Fix gem pristine not accounting for user installed gems. Pull request
    #2914 by Luis Sagastume.
  * Refactor keyword argument test for Ruby 2.7. Pull request #2947 by
    SHIBATA Hiroshi.
  * Fix errors at frozen Gem::Version. Pull request #2949 by Nobuyoshi
    Nakada.
  * Remove taint usage on Ruby 2.7+. Pull request #2951 by Jeremy Evans.
  * Check Manifest.txt is up to date. Pull request #2953 by David Rodríguez.
  * Clarify symlink conditionals in tests. Pull request #2962 by David
    Rodríguez.
  * Update command line parsing to work under ps. Pull request #2966 by
    David Rodríguez.
  * Properly test `Gem::Specifications.stub_for`. Pull request #2970 by
    David Rodríguez.
  * Fix Gem::LOADED_SPECS_MUTEX handling for recursive locking. Pull request
    #2985 by MSP-Greg.
This commit is contained in:
Hiroshi SHIBATA 2019-11-11 15:03:57 +09:00 committed by SHIBATA Hiroshi
parent 3141642380
commit 7d463e360b
Notes: git 2019-11-11 17:00:21 +09:00
29 changed files with 237 additions and 133 deletions

View file

@ -98,7 +98,7 @@ class Gem::BasicSpecification
# Returns full path to the directory where gem's extensions are installed.
def extension_dir
@extension_dir ||= File.expand_path(File.join(extensions_dir, full_name)).untaint
@extension_dir ||= File.expand_path(File.join(extensions_dir, full_name)).tap(&Gem::UNTAINT)
end
##
@ -113,7 +113,7 @@ class Gem::BasicSpecification
def find_full_gem_path # :nodoc:
# TODO: also, shouldn't it default to full_name if it hasn't been written?
path = File.expand_path File.join(gems_dir, full_name)
path.untaint
path.tap(&Gem::UNTAINT)
path
end
@ -135,9 +135,9 @@ class Gem::BasicSpecification
def full_name
if platform == Gem::Platform::RUBY or platform.nil?
"#{name}-#{version}".dup.untaint
"#{name}-#{version}".dup.tap(&Gem::UNTAINT)
else
"#{name}-#{version}-#{platform}".dup.untaint
"#{name}-#{version}-#{platform}".dup.tap(&Gem::UNTAINT)
end
end
@ -149,7 +149,7 @@ class Gem::BasicSpecification
@full_require_paths ||=
begin
full_paths = raw_require_paths.map do |path|
File.join full_gem_path, path.untaint
File.join full_gem_path, path.tap(&Gem::UNTAINT)
end
full_paths << extension_dir if have_extensions?
@ -163,7 +163,7 @@ class Gem::BasicSpecification
def datadir
# TODO: drop the extra ", gem_name" which is uselessly redundant
File.expand_path(File.join(gems_dir, full_name, "data", name)).untaint
File.expand_path(File.join(gems_dir, full_name, "data", name)).tap(&Gem::UNTAINT)
end
##
@ -277,7 +277,7 @@ class Gem::BasicSpecification
# TODO: do we need these?? Kill it
glob = File.join(self.lib_dirs_glob, glob)
Dir[glob].map { |f| f.untaint } # FIX our tests are broken, run w/ SAFE=1
Dir[glob].map { |f| f.tap(&Gem::UNTAINT) } # FIX our tests are broken, run w/ SAFE=1
end
##
@ -295,7 +295,7 @@ class Gem::BasicSpecification
"lib" # default value for require_paths for bundler/inline
end
"#{self.full_gem_path}/#{dirs}".dup.untaint
"#{self.full_gem_path}/#{dirs}".dup.tap(&Gem::UNTAINT)
end
##
@ -328,7 +328,7 @@ class Gem::BasicSpecification
def have_file?(file, suffixes)
return true if raw_require_paths.any? do |path|
base = File.join(gems_dir, full_name, path.untaint, file).untaint
base = File.join(gems_dir, full_name, path.tap(&Gem::UNTAINT), file).tap(&Gem::UNTAINT)
suffixes.any? { |suf| File.file? base + suf }
end