summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornegi0109 <[email protected]>2023-09-10 17:01:15 +0000
committergit <[email protected]>2023-09-11 21:06:21 +0000
commit8bb61077ad02c2b57eb5727b7da8a7a4fff28ef3 ()
tree168fb485e310538e0923f51ab3a45da3f5ccc496
parent1ae5dd6f320da502e1b4a032ed9c17e03a9f344f (diff)
[rubygems/rubygems] Fixed false positive SymlinkError in symbolic link directory
https://.com/rubygems/rubygems/commit/58173ff2ea
-rw-r--r--lib/rubygems/package.rb4
-rw-r--r--test/rubygems/test_gem_package.rb26
2 files changed, 29 insertions, 1 deletions
@@ -413,6 +413,8 @@ EOM
# extracted.
def extract_tar_gz(io, destination_dir, pattern = "*") # :nodoc:
directories = []
symlinks = []
@@ -428,7 +430,7 @@ EOM
real_destination = link_target.start_with?("/") ? link_target : File.expand_path(link_target, File.dirname(destination))
raise Gem::Package::SymlinkError.new(full_name, real_destination, destination_dir) unless
- normalize_path(real_destination).start_with? normalize_path(destination_dir + "/")
symlinks << [full_name, link_target, destination, real_destination]
end
@@ -574,6 +574,32 @@ class TestGemPackage < Gem::Package::TarTestCase
File.read(extracted)
end
def test_extract_tar_gz_symlink_broken_relative_path
package = Gem::Package.new @gem
package.verify