From c0e77089b2f3c5358562d2fe58e74cc91f8813da Mon Sep 17 00:00:00 2001 From: usa Date: Sat, 30 Jun 2018 13:24:21 +0000 Subject: 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 --- lib/rubygems.rb | 2 +- lib/rubygems/package.rb | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3