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 root/tests/networking.scm
AgeCommit message (Expand)Author
2019-10-30services: ntp: Ensure no double quotes are output to config file....* gnu/services/networking.scm (ntp-server->string): Use the textual representation of the values as printed by 'display' rather than 'write', to avoid inserting double quotes in the generated config. * tests/networking.scm (%ntp-server-sample): Add a comment and make one of the options a string, to exercise the fix. ("ntp-server->string"): Move the expected value to the first argument. ("ntp configuration servers deprecated form"): Likewise. ("openntpd generated config string ends with a newline"): Likewise. Maxim Cournoyer
2019-09-08services: openntpd: Add test for issue #3731....See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=37318. * gnu/services/networking.scm (openntpd-configuration->string): New procedure, extracted from top of the `openntpd-shepherd-service' to make it testable. (openntpd-shepherd-service): Adapt following the move of the code to the above procedure. * tests/networking.scm: Add a test for the `openntpd-configuration->string' procedure. Maxim Cournoyer
2019-09-08services: ntp: Support different NTP server types and options....* gnu/services/networking.scm (ntp-server-types): New enum. (<ntp-server>): New record type. (ntp-server->string): New procedure. (%ntp-servers): Define in terms of <htp-server> records. Use the first entrypoint server as a pool instead of a list of static servers. This is more resilient since a new server of the pool can be interrogated on every request. Add the 'iburst' options. (ntp-configuration-servers): Define a custom accessor that warns but honors the now deprecated server format. (<ntp-configuration>): Use it. (%openntpd-servers): New variable, (<openntpd-configuration>): Use it, as a pool ('servers' field) instead of a regular server. * tests/networking.scm: New file. * Makefile.am (SCM_TESTS): Register it. * doc/guix.texi: Update documentation. Maxim Cournoyer