Bug #14721 ยป 2211.patch
lib/rubygems/package.rb | ||
---|---|---|
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)
|
||
... | ... | |
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
|
test/rubygems/test_gem_package.rb | ||
---|---|---|
assert_path_exists extracted
|
||
end
|
||
if Gem.win_platform?
|
||
def test_extract_tar_gz_case_insensitive
|
||
package = Gem::Package.new @gem
|
||
tgz_io = util_tar_gz do |tar|
|
||
tar.add_file 'foo/file.rb', 0644 do |io| io.write 'hi' end
|
||
end
|
||
package.extract_tar_gz tgz_io, @destination.upcase
|
||
extracted = File.join @destination, 'foo/file.rb'
|
||
assert_path_exists extracted
|
||
end
|
||
end
|
||
def test_install_location
|
||
package = Gem::Package.new @gem
|
||