summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-23 00:20:49 (GMT)
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-23 00:20:49 (GMT)
commitae19a18996727954cba2da90ab816e2d5023822a (patch)
tree158b316a17cb6618235df3ce4cf27c6108240084
parent9b9fe826fd1ce825af3503f39643f75910307a51 (diff)
Merge RubyGems 3.0.1 from rubygems/rubygems.
It fixed the issues of RubyGems 3.0.0. https://blog.rubygems.org/2018/12/23/3.0.1-released.html git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/rubygems.rb4
-rw-r--r--lib/rubygems/commands/setup_command.rb10
-rw-r--r--lib/rubygems/installer.rb10
-rw-r--r--lib/rubygems/package.rb4
-rw-r--r--lib/rubygems/package/old.rb2
-rw-r--r--lib/rubygems/util.rb2
-rw-r--r--test/rubygems/test_gem.rb2
-rw-r--r--test/rubygems/test_gem_util.rb17
8 files changed, 34 insertions, 17 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index abf2e9b..118268d 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -9,7 +9,7 @@
require 'rbconfig'
module Gem
- VERSION = "3.0.0".freeze
+ VERSION = "3.0.1".freeze
end
# Must be first since it unloads the prelude from 1.9.2
@@ -572,7 +572,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
#++
def self.find_home
- Dir.home
+ Dir.home.dup
rescue
if Gem.win_platform?
File.expand_path File.join(ENV['HOMEDRIVE'] || ENV['SystemDrive'], '/')
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 7992818..c9c00b5 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -312,7 +312,7 @@ By default, this RubyGems will install gem as:
dest_file = File.join dest_dir, file
dest_dir = File.dirname dest_file
unless File.directory? dest_dir
- mkdir_p dest_dir, :mode => 0700
+ mkdir_p dest_dir, :mode => 0755
end
install file, dest_file, :mode => options[:data_mode] || 0644
@@ -387,7 +387,7 @@ By default, this RubyGems will install gem as:
specs_dir = Gem::Specification.default_specifications_dir
specs_dir = File.join(options[:destdir], specs_dir) unless Gem.win_platform?
- mkdir_p specs_dir, :mode => 0700
+ mkdir_p specs_dir, :mode => 0755
# Workaround for non-git environment.
gemspec = File.open('bundler/bundler.gemspec', 'rb'){|f| f.read.gsub(/`git ls-files -z`/, "''") }
@@ -422,7 +422,7 @@ By default, this RubyGems will install gem as:
bundler_bin_dir = bundler_spec.bin_dir
bundler_bin_dir = File.join(options[:destdir], bundler_bin_dir) unless Gem.win_platform?
- mkdir_p bundler_bin_dir, :mode => 0700
+ mkdir_p bundler_bin_dir, :mode => 0755
bundler_spec.executables.each do |e|
cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e)
end
@@ -446,8 +446,8 @@ By default, this RubyGems will install gem as:
lib_dir, bin_dir = generate_default_dirs(install_destdir)
end
- mkdir_p lib_dir, :mode => 0700
- mkdir_p bin_dir, :mode => 0700
+ mkdir_p lib_dir, :mode => 0755
+ mkdir_p bin_dir, :mode => 0755
return lib_dir, bin_dir
end
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index b1f8317..6cd073e 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -309,7 +309,7 @@ class Gem::Installer
FileUtils.rm_rf spec.extension_dir
dir_mode = options[:dir_mode]
- FileUtils.mkdir_p gem_dir, :mode => dir_mode && 0700
+ FileUtils.mkdir_p gem_dir, :mode => dir_mode && 0755
if @options[:install_as_default]
extract_bin
@@ -481,7 +481,7 @@ class Gem::Installer
return if spec.executables.nil? or spec.executables.empty?
begin
- Dir.mkdir @bin_dir, *[options[:dir_mode] && 0700].compact
+ Dir.mkdir @bin_dir, *[options[:dir_mode] && 0755].compact
rescue SystemCallError
raise unless File.directory? @bin_dir
end
@@ -525,7 +525,7 @@ class Gem::Installer
FileUtils.rm_f bin_script_path # prior install may have been --no-wrappers
- File.open bin_script_path, 'wb', 0700 do |file|
+ File.open bin_script_path, 'wb', 0755 do |file|
file.print app_script_text(filename)
file.chmod(options[:prog_mode] || 0755)
end
@@ -720,7 +720,7 @@ class Gem::Installer
end
def verify_gem_home(unpack = false) # :nodoc:
- FileUtils.mkdir_p gem_home, :mode => options[:dir_mode] && 0700
+ FileUtils.mkdir_p gem_home, :mode => options[:dir_mode] && 0755
raise Gem::FilePermissionError, gem_home unless
unpack or File.writable?(gem_home)
end
@@ -905,7 +905,7 @@ TEXT
build_info_dir = File.join gem_home, 'build_info'
dir_mode = options[:dir_mode]
- FileUtils.mkdir_p build_info_dir, :mode => dir_mode && 0700
+ FileUtils.mkdir_p build_info_dir, :mode => dir_mode && 0755
build_info_file = File.join build_info_dir, "#{spec.full_name}.info"
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 3d81b8b..8695b85 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -357,7 +357,7 @@ EOM
def extract_files(destination_dir, pattern = "*")
verify unless @spec
- FileUtils.mkdir_p destination_dir, :mode => dir_mode && 0700
+ FileUtils.mkdir_p destination_dir, :mode => dir_mode && 0755
@gem.with_read_io do |io|
reader = Gem::Package::TarReader.new io
@@ -394,7 +394,7 @@ EOM
FileUtils.rm_rf destination
mkdir_options = {}
- mkdir_options[:mode] = dir_mode ? 0700 : (entry.header.mode if entry.directory?)
+ mkdir_options[:mode] = dir_mode ? 0755 : (entry.header.mode if entry.directory?)
mkdir =
if entry.directory?
destination
diff --git a/lib/rubygems/package/old.rb b/lib/rubygems/package/old.rb
index d028be1..f574b98 100644
--- a/lib/rubygems/package/old.rb
+++ b/lib/rubygems/package/old.rb
@@ -78,7 +78,7 @@ class Gem::Package::Old < Gem::Package
FileUtils.rm_rf destination
- FileUtils.mkdir_p File.dirname(destination), :mode => dir_mode && 0700
+ FileUtils.mkdir_p File.dirname(destination), :mode => dir_mode && 0755
File.open destination, 'wb', file_mode(entry['mode']) do |out|
out.write file_data
diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb
index 60d552d..b9e5dfc 100644
--- a/lib/rubygems/util.rb
+++ b/lib/rubygems/util.rb
@@ -122,7 +122,7 @@ module Gem::Util
def self.glob_files_in_dir(glob, base_path)
if RUBY_VERSION >= "2.5"
- Dir.glob(glob, base: base_path).map! {|f| File.join(base_path, f) }
+ Dir.glob(glob, base: base_path).map! {|f| File.expand_path(f, base_path) }
else
Dir.glob(File.expand_path(glob, base_path))
end
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index e062eeb..b657874 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -198,7 +198,7 @@ class TestGem < Gem::TestCase
end
assert_equal(expected, result)
ensure
- File.chmod(0700, *Dir.glob(@gemhome+'/gems/**/').map {|path| path.untaint})
+ File.chmod(0755, *Dir.glob(@gemhome+'/gems/**/').map {|path| path.untaint})
end
def test_require_missing
diff --git a/test/rubygems/test_gem_util.rb b/test/rubygems/test_gem_util.rb
index 0fd8441..88afc62 100644
--- a/test/rubygems/test_gem_util.rb
+++ b/test/rubygems/test_gem_util.rb
@@ -58,4 +58,21 @@ class TestGemUtil < Gem::TestCase
assert_equal 4, list.find { |x| x == 4 }
end
+ def test_glob_files_in_dir
+ FileUtils.mkdir_p 'g'
+ FileUtils.touch File.join('g', 'h.rb')
+ FileUtils.touch File.join('g', 'i.rb')
+
+ expected_paths = [
+ File.join(@tempdir, 'g/h.rb'),
+ File.join(@tempdir, 'g/i.rb'),
+ ]
+
+ files_with_absolute_base = Gem::Util.glob_files_in_dir('*.rb', File.join(@tempdir, 'g'))
+ assert_equal expected_paths.to_set, files_with_absolute_base.to_set
+
+ files_with_relative_base = Gem::Util.glob_files_in_dir('*.rb', 'g')
+ assert_equal expected_paths.to_set, files_with_relative_base.to_set
+ end
+
end