summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-30 13:24:21 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-30 13:24:21 +0000
commitc0e77089b2f3c5358562d2fe58e74cc91f8813da (patch)
treea811d42a9fd5235d72e38466969d54a2da6ed1ed /lib
parent9796be14ac1bf0af31861f995d35d9740a01aad1 (diff)
Fix path checks for case insensitive filesystem
see https://github.com/rubygems/rubygems/pull/2211 [ruby-core:86745] [Backport #14721] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@63809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems.rb2
-rw-r--r--lib/rubygems/package.rb10
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 53be979a52..4ab0da9acf 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -10,7 +10,7 @@ require 'rbconfig'
require 'thread'
module Gem
- VERSION = "2.6.14.2"
+ VERSION = "2.6.14.3"
end
# Must be first since it unloads the prelude from 1.9.2
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index b5a5fe2a26..1dd28d8132 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -429,6 +429,14 @@ EOM
destination
end
+ def normalize_path(pathname)
+ if Gem.win_platform?
+ pathname.downcase
+ else
+ pathname
+ end
+ end
+
def mkdir_p_safe mkdir, mkdir_options, destination_dir, file_name
destination_dir = realpath File.expand_path(destination_dir)
parts = mkdir.split(File::SEPARATOR)
@@ -437,7 +445,7 @@ EOM
path = File.expand_path(path + File::SEPARATOR + basename)
lstat = File.lstat path rescue nil
if !lstat || !lstat.directory?
- unless path.start_with? destination_dir and (FileUtils.mkdir path, mkdir_options rescue false)
+ unless normalize_path(path).start_with? normalize_path(destination_dir) and (FileUtils.mkdir path, mkdir_options rescue false)
raise Gem::Package::PathError.new(file_name, destination_dir)
end
end