summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/ruby-symlinkfix.patch
diff options
context:
space:
mode:
authorRob Syme <rob.syme@gmail.com>2016-04-30 08:39:27 +1000
committerBen Woodcroft <donttrustben@gmail.com>2016-04-30 08:39:27 +1000
commitb0e52f52b76ecc37a9b6469e6f72c4b4757979ce (patch)
treef30e25c1f43bf58459bc5cf8a4dab8feb9cb8d17 /gnu/packages/patches/ruby-symlinkfix.patch
parentf36a1ebaab67bd05a62af990312d43a845daa9f2 (diff)
gnu: ruby: Update to 2.3.1.
* gnu/packages/ruby.scm (ruby): Update to 2.3.1. [origin] Add symlink patch. * gnu/packages/patches/ruby-symlinkfix.patch: New file. * gnu/local.mk (dist_patch_DATA): Add patch.
Diffstat (limited to 'gnu/packages/patches/ruby-symlinkfix.patch')
-rw-r--r--gnu/packages/patches/ruby-symlinkfix.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/gnu/packages/patches/ruby-symlinkfix.patch b/gnu/packages/patches/ruby-symlinkfix.patch
new file mode 100644
index 0000000000..16beecc97a
--- /dev/null
+++ b/gnu/packages/patches/ruby-symlinkfix.patch
@@ -0,0 +1,53 @@
+Fix symlinks to '..' to fix rubygems improperly expanding symlinked
+paths. Without this fix, some gems fail to install. This patch is applied in
+rubygems 2.5.2, but ruby version 2.3.1 bundles an older version of rubygems
+(2.5.1).
+
+--- a/lib/rubygems/package.rb
++++ b/lib/rubygems/package.rb
+@@ -383,7 +383,7 @@ def extract_tar_gz io, destination_dir, pattern = "*" # :nodoc:
+ FileUtils.chmod entry.header.mode, destination
+ end if entry.file?
+
+- File.symlink(install_location(entry.header.linkname, destination_dir), destination) if entry.symlink?
++ File.symlink(entry.header.linkname, destination) if entry.symlink?
+
+ verbose destination
+ end
+diff --git a/test/rubygems/test_gem_package.rb b/test/rubygems/test_gem_package.rb
+index 7848bc2..f287bd3 100644
+--- a/test/rubygems/test_gem_package.rb
++++ b/test/rubygems/test_gem_package.rb
+@@ -428,19 +428,25 @@ def test_extract_tar_gz_absolute
+ "#{@destination} is not allowed", e.message)
+ end
+
+- def test_extract_tar_gz_symlink_absolute
++ def test_extract_tar_gz_symlink_relative_path
++ skip 'symlink not supported' if Gem.win_platform?
++
+ package = Gem::Package.new @gem
+
+ tgz_io = util_tar_gz do |tar|
+- tar.add_symlink 'code.rb', '/absolute.rb', 0644
++ tar.add_file 'relative.rb', 0644 do |io| io.write 'hi' end
++ tar.mkdir 'lib', 0755
++ tar.add_symlink 'lib/foo.rb', '../relative.rb', 0644
+ end
+
+- e = assert_raises Gem::Package::PathError do
+- package.extract_tar_gz tgz_io, @destination
+- end
++ package.extract_tar_gz tgz_io, @destination
+
+- assert_equal("installing into parent path /absolute.rb of " +
+- "#{@destination} is not allowed", e.message)
++ extracted = File.join @destination, 'lib/foo.rb'
++ assert_path_exists extracted
++ assert_equal '../relative.rb',
++ File.readlink(extracted)
++ assert_equal 'hi',
++ File.read(extracted)
+ end
+
+ def test_extract_tar_gz_directory