Update to Ruby 2.4.4.
This commit is contained in:
parent
7cfc7ee74f
commit
6e392fbfac
@ -39,7 +39,7 @@ diff --git a/configure.in b/configure.in
|
||||
index 0e371e2..d4f1dcb 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -4565,6 +4565,13 @@ AC_SUBST(rubyarchhdrdir)dnl
|
||||
@@ -4571,6 +4571,13 @@ AC_SUBST(rubyarchhdrdir)dnl
|
||||
AC_SUBST(sitearchhdrdir)dnl
|
||||
AC_SUBST(vendorarchhdrdir)dnl
|
||||
|
||||
|
@ -11,7 +11,7 @@ diff --git a/configure.in b/configure.in
|
||||
index 37d9a62..553d4d0 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -3825,6 +3825,11 @@ if test ${multiarch+set}; then
|
||||
@@ -3831,6 +3831,11 @@ if test ${multiarch+set}; then
|
||||
fi
|
||||
|
||||
archlibdir='${libdir}/${arch}'
|
||||
|
@ -14,7 +14,7 @@ diff --git a/configure.in b/configure.in
|
||||
index db37cd6..ce8d149 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -4419,7 +4419,8 @@ AS_CASE(["$ruby_version_dir_name"],
|
||||
@@ -4425,7 +4425,8 @@ AS_CASE(["$ruby_version_dir_name"],
|
||||
ruby_version_dir=/'${ruby_version_dir_name}'
|
||||
|
||||
if test -z "${ruby_version_dir_name}"; then
|
||||
|
@ -11,7 +11,7 @@ diff --git a/configure.in b/configure.in
|
||||
index 553d4d0..03a4152 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -4483,6 +4483,8 @@ AC_SUBST(vendorarchdir)dnl
|
||||
@@ -4489,6 +4489,8 @@ AC_SUBST(vendorarchdir)dnl
|
||||
AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl
|
||||
AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl
|
||||
|
||||
|
@ -15,7 +15,7 @@ diff --git a/configure.in b/configure.in
|
||||
index 03a4152..0e371e2 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -4455,6 +4455,10 @@ AC_ARG_WITH(vendorarchdir,
|
||||
@@ -4461,6 +4461,10 @@ AC_ARG_WITH(vendorarchdir,
|
||||
[vendorarchdir=$withval],
|
||||
[vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
|
||||
|
||||
@ -26,7 +26,7 @@ index 03a4152..0e371e2 100644
|
||||
if test "${LOAD_RELATIVE+set}"; then
|
||||
AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
|
||||
RUBY_EXEC_PREFIX=''
|
||||
@@ -4479,6 +4483,7 @@ AC_SUBST(sitearchdir)dnl
|
||||
@@ -4485,6 +4489,7 @@ AC_SUBST(sitearchdir)dnl
|
||||
AC_SUBST(vendordir)dnl
|
||||
AC_SUBST(vendorlibdir)dnl
|
||||
AC_SUBST(vendorarchdir)dnl
|
||||
|
@ -20,7 +20,7 @@ diff --git a/configure.in b/configure.in
|
||||
index db37cd6..6e73fae 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -4370,9 +4370,6 @@ AS_CASE(["$target_os"],
|
||||
@@ -4376,9 +4376,6 @@ AS_CASE(["$target_os"],
|
||||
rubyw_install_name='$(RUBYW_INSTALL_NAME)'
|
||||
])
|
||||
|
||||
@ -30,7 +30,7 @@ index db37cd6..6e73fae 100644
|
||||
rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'}
|
||||
AC_ARG_WITH(rubyarchprefix,
|
||||
AS_HELP_STRING([--with-rubyarchprefix=DIR],
|
||||
@@ -4395,56 +4392,62 @@ AC_ARG_WITH(ridir,
|
||||
@@ -4401,56 +4398,62 @@ AC_ARG_WITH(ridir,
|
||||
AC_SUBST(ridir)
|
||||
AC_SUBST(RI_BASE_NAME)
|
||||
|
||||
@ -120,7 +120,7 @@ index db37cd6..6e73fae 100644
|
||||
|
||||
if test "${LOAD_RELATIVE+set}"; then
|
||||
AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
|
||||
@@ -4461,6 +4464,7 @@ AC_SUBST(sitearchincludedir)dnl
|
||||
@@ -4467,6 +4470,7 @@ AC_SUBST(sitearchincludedir)dnl
|
||||
AC_SUBST(arch)dnl
|
||||
AC_SUBST(sitearch)dnl
|
||||
AC_SUBST(ruby_version)dnl
|
||||
|
@ -1,30 +0,0 @@
|
||||
diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb
|
||||
index 20a57fe7dd..5b9e5a8bde 100644
|
||||
--- a/test/ruby/test_time_tz.rb
|
||||
+++ b/test/ruby/test_time_tz.rb
|
||||
@@ -126,8 +126,8 @@ def test_asia_singapore
|
||||
|
||||
def test_asia_tokyo
|
||||
with_tz(tz="Asia/Tokyo") {
|
||||
- assert_time_constructor(tz, "1951-05-06 03:00:00 +1000", :local, [1951,5,6,2,0,0])
|
||||
- assert_time_constructor(tz, "1951-05-06 03:59:59 +1000", :local, [1951,5,6,2,59,59])
|
||||
+# assert_time_constructor(tz, "1951-05-06 03:00:00 +1000", :local, [1951,5,6,2,0,0])
|
||||
+# assert_time_constructor(tz, "1951-05-06 03:59:59 +1000", :local, [1951,5,6,2,59,59])
|
||||
assert_time_constructor(tz, "2010-06-10 06:13:28 +0900", :local, [2010,6,10,6,13,28])
|
||||
}
|
||||
end
|
||||
@@ -329,10 +329,10 @@ def self.gen_zdump_test(data)
|
||||
Asia/Singapore Sun Aug 8 16:30:00 1965 UTC = Mon Aug 9 00:00:00 1965 SGT isdst=0 gmtoff=27000
|
||||
Asia/Singapore Thu Dec 31 16:29:59 1981 UTC = Thu Dec 31 23:59:59 1981 SGT isdst=0 gmtoff=27000
|
||||
Asia/Singapore Thu Dec 31 16:30:00 1981 UTC = Fri Jan 1 00:30:00 1982 SGT isdst=0 gmtoff=28800
|
||||
-Asia/Tokyo Sat May 5 16:59:59 1951 UTC = Sun May 6 01:59:59 1951 JST isdst=0 gmtoff=32400
|
||||
-Asia/Tokyo Sat May 5 17:00:00 1951 UTC = Sun May 6 03:00:00 1951 JDT isdst=1 gmtoff=36000
|
||||
-Asia/Tokyo Fri Sep 7 15:59:59 1951 UTC = Sat Sep 8 01:59:59 1951 JDT isdst=1 gmtoff=36000
|
||||
-Asia/Tokyo Fri Sep 7 16:00:00 1951 UTC = Sat Sep 8 01:00:00 1951 JST isdst=0 gmtoff=32400
|
||||
+#Asia/Tokyo Sat May 5 16:59:59 1951 UTC = Sun May 6 01:59:59 1951 JST isdst=0 gmtoff=32400
|
||||
+#Asia/Tokyo Sat May 5 17:00:00 1951 UTC = Sun May 6 03:00:00 1951 JDT isdst=1 gmtoff=36000
|
||||
+#Asia/Tokyo Fri Sep 7 15:59:59 1951 UTC = Sat Sep 8 01:59:59 1951 JDT isdst=1 gmtoff=36000
|
||||
+#Asia/Tokyo Fri Sep 7 16:00:00 1951 UTC = Sat Sep 8 01:00:00 1951 JST isdst=0 gmtoff=32400
|
||||
America/St_Johns Sun Mar 11 03:30:59 2007 UTC = Sun Mar 11 00:00:59 2007 NST isdst=0 gmtoff=-12600
|
||||
America/St_Johns Sun Mar 11 03:31:00 2007 UTC = Sun Mar 11 01:01:00 2007 NDT isdst=1 gmtoff=-9000
|
||||
America/St_Johns Sun Nov 4 02:30:59 2007 UTC = Sun Nov 4 00:00:59 2007 NDT isdst=1 gmtoff=-9000
|
115
ruby-2.5.1-TestTimeTZ-test-failures-Kiritimati-and-Lisbon.patch
Normal file
115
ruby-2.5.1-TestTimeTZ-test-failures-Kiritimati-and-Lisbon.patch
Normal file
@ -0,0 +1,115 @@
|
||||
From 584b5929f9b769c4d0b03e322a9fddf2b2dd3454 Mon Sep 17 00:00:00 2001
|
||||
From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
|
||||
Date: Sun, 1 Apr 2018 13:02:11 +0000
|
||||
Subject: [PATCH] test_time_tz.rb: Kiritimati tzdata fix
|
||||
|
||||
* test/ruby/test_time_tz.rb (gen_zdump_test): fix the expected
|
||||
data at the Kiritimati's skip of New Year's Eve 1994.
|
||||
[Bug #14655]
|
||||
|
||||
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
||||
---
|
||||
test/ruby/test_time_tz.rb | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb
|
||||
index dfe139033ed3..ac5f81892878 100644
|
||||
--- a/test/ruby/test_time_tz.rb
|
||||
+++ b/test/ruby/test_time_tz.rb
|
||||
@@ -364,9 +364,18 @@ def self.gen_zdump_test(data)
|
||||
Europe/London Sun Aug 10 01:00:00 1947 UTC = Sun Aug 10 02:00:00 1947 BST isdst=1 gmtoff=3600
|
||||
Europe/London Sun Nov 2 01:59:59 1947 UTC = Sun Nov 2 02:59:59 1947 BST isdst=1 gmtoff=3600
|
||||
Europe/London Sun Nov 2 02:00:00 1947 UTC = Sun Nov 2 02:00:00 1947 GMT isdst=0 gmtoff=0
|
||||
+End
|
||||
+ if CORRECT_KIRITIMATI_SKIP_1994
|
||||
+ gen_zdump_test <<'End'
|
||||
+Pacific/Kiritimati Sat Dec 31 09:59:59 1994 UTC = Fri Dec 30 23:59:59 1994 LINT isdst=0 gmtoff=-36000
|
||||
+Pacific/Kiritimati Sat Dec 31 10:00:00 1994 UTC = Sun Jan 1 00:00:00 1995 LINT isdst=0 gmtoff=50400
|
||||
+End
|
||||
+ else
|
||||
+ gen_zdump_test <<'End'
|
||||
Pacific/Kiritimati Sun Jan 1 09:59:59 1995 UTC = Sat Dec 31 23:59:59 1994 LINT isdst=0 gmtoff=-36000
|
||||
Pacific/Kiritimati Sun Jan 1 10:00:00 1995 UTC = Mon Jan 2 00:00:00 1995 LINT isdst=0 gmtoff=50400
|
||||
End
|
||||
+ end
|
||||
gen_zdump_test <<'End' if has_right_tz
|
||||
right/America/Los_Angeles Fri Jun 30 23:59:60 1972 UTC = Fri Jun 30 16:59:60 1972 PDT isdst=1 gmtoff=-25200
|
||||
right/America/Los_Angeles Wed Dec 31 23:59:60 2008 UTC = Wed Dec 31 15:59:60 2008 PST isdst=0 gmtoff=-28800
|
||||
--
|
||||
|
||||
From 2965c2d4df78e6f5acf8759f84c88ce14a4e70f1 Mon Sep 17 00:00:00 2001
|
||||
From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
|
||||
Date: Sun, 1 Apr 2018 02:00:36 +0000
|
||||
Subject: [PATCH] test_time_tz.rb: Kiritimati tzdata fix
|
||||
|
||||
* test/ruby/test_time_tz.rb (TestTimeTZ#test_pacific_kiritimati):
|
||||
fix the expected data at the skip of New Year's Eve 1994.
|
||||
[Bug #14655]
|
||||
|
||||
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
||||
---
|
||||
test/ruby/test_time_tz.rb | 17 ++++++++++++++---
|
||||
1 file changed, 14 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb
|
||||
index 39b830d28a3d..dfe139033ed3 100644
|
||||
--- a/test/ruby/test_time_tz.rb
|
||||
+++ b/test/ruby/test_time_tz.rb
|
||||
@@ -89,6 +89,9 @@ def group_by(e, &block)
|
||||
Time.local(1951, 5, 6, 1, 0, 0).dst? # DST with fixed tzdata
|
||||
end
|
||||
}
|
||||
+ CORRECT_KIRITIMATI_SKIP_1994 = with_tz("Pacific/Kiritimati") {
|
||||
+ Time.local(1994, 12, 31, 0, 0, 0).year == 1995
|
||||
+ }
|
||||
|
||||
def time_to_s(t)
|
||||
t.to_s
|
||||
@@ -178,9 +181,17 @@ def test_europe_lisbon
|
||||
|
||||
def test_pacific_kiritimati
|
||||
with_tz(tz="Pacific/Kiritimati") {
|
||||
- assert_time_constructor(tz, "1994-12-31 23:59:59 -1000", :local, [1994,12,31,23,59,59])
|
||||
- assert_time_constructor(tz, "1995-01-02 00:00:00 +1400", :local, [1995,1,1,0,0,0])
|
||||
- assert_time_constructor(tz, "1995-01-02 23:59:59 +1400", :local, [1995,1,1,23,59,59])
|
||||
+ assert_time_constructor(tz, "1994-12-30 00:00:00 -1000", :local, [1994,12,30,0,0,0])
|
||||
+ assert_time_constructor(tz, "1994-12-30 23:59:59 -1000", :local, [1994,12,30,23,59,59])
|
||||
+ if CORRECT_KIRITIMATI_SKIP_1994
|
||||
+ assert_time_constructor(tz, "1995-01-01 00:00:00 +1400", :local, [1994,12,31,0,0,0])
|
||||
+ assert_time_constructor(tz, "1995-01-01 23:59:59 +1400", :local, [1994,12,31,23,59,59])
|
||||
+ assert_time_constructor(tz, "1995-01-01 00:00:00 +1400", :local, [1995,1,1,0,0,0])
|
||||
+ else
|
||||
+ assert_time_constructor(tz, "1994-12-31 23:59:59 -1000", :local, [1994,12,31,23,59,59])
|
||||
+ assert_time_constructor(tz, "1995-01-02 00:00:00 +1400", :local, [1995,1,1,0,0,0])
|
||||
+ assert_time_constructor(tz, "1995-01-02 23:59:59 +1400", :local, [1995,1,1,23,59,59])
|
||||
+ end
|
||||
assert_time_constructor(tz, "1995-01-02 00:00:00 +1400", :local, [1995,1,2,0,0,0])
|
||||
}
|
||||
end
|
||||
--
|
||||
|
||||
From a0e6607a8172f9eaf9a15f03065736deb2035771 Mon Sep 17 00:00:00 2001
|
||||
From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
|
||||
Date: Sun, 1 Apr 2018 13:16:14 +0000
|
||||
Subject: [PATCH] test_time_tz.rb: Lisbon tzdata fix
|
||||
|
||||
* test/ruby/test_time_tz.rb (gen_variational_zdump_test): Update
|
||||
Lisbon zdump data, which fixed the 1912-01-01 transition for
|
||||
Portugual and its colonies. [Bug #14655]
|
||||
|
||||
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
||||
---
|
||||
test/ruby/test_time_tz.rb | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb
|
||||
index ac5f81892878..b32caff9c539 100644
|
||||
--- a/test/ruby/test_time_tz.rb
|
||||
+++ b/test/ruby/test_time_tz.rb
|
||||
@@ -434,5 +434,6 @@ def self.gen_variational_zdump_test(hint, data)
|
||||
gen_variational_zdump_test "lisbon", <<'End' if has_lisbon_tz
|
||||
Europe/Lisbon Mon Jan 1 00:36:31 1912 UTC = Sun Dec 31 23:59:59 1911 LMT isdst=0 gmtoff=-2192
|
||||
Europe/Lisbon Mon Jan 1 00:36:44 1912 UT = Sun Dec 31 23:59:59 1911 LMT isdst=0 gmtoff=-2205
|
||||
+Europe/Lisbon Sun Dec 31 23:59:59 1911 UT = Sun Dec 31 23:23:14 1911 LMT isdst=0 gmtoff=-2205
|
||||
End
|
||||
end
|
22
ruby.spec
22
ruby.spec
@ -1,6 +1,6 @@
|
||||
%global major_version 2
|
||||
%global minor_version 4
|
||||
%global teeny_version 3
|
||||
%global teeny_version 4
|
||||
%global major_minor_version %{major_version}.%{minor_version}
|
||||
|
||||
%global ruby_version %{major_minor_version}.%{teeny_version}
|
||||
@ -36,13 +36,13 @@
|
||||
# http://redmine.ruby-lang.org/issues/5313
|
||||
%global irb_version %{ruby_version}
|
||||
|
||||
%global bigdecimal_version 1.3.0
|
||||
%global bigdecimal_version 1.3.2
|
||||
%global did_you_mean_version 1.1.0
|
||||
%global io_console_version 0.4.6
|
||||
%global json_version 2.0.4
|
||||
%global minitest_version 5.10.1
|
||||
%global net_telnet_version 0.1.1
|
||||
%global openssl_version 2.0.5
|
||||
%global openssl_version 2.0.7
|
||||
%global power_assert_version 0.4.1
|
||||
%global psych_version 2.2.2
|
||||
%global rake_version 12.0.0
|
||||
@ -131,13 +131,9 @@ Patch9: ruby-2.3.1-Rely-on-ldd-to-detect-glibc.patch
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1528226
|
||||
# https://github.com/ruby/ruby/commit/e7464561b5151501beb356fc750d5dd1a88014f7
|
||||
Patch10: ruby-2.4.3-Fix-Command-injection-in-lib-resolv-lazy_initialize.patch
|
||||
# Fix: Multiple vulnerabilities in RubyGems
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1547431
|
||||
# https://www.ruby-lang.org/en/news/2018/02/17/multiple-vulnerabilities-in-rubygems/
|
||||
Patch11: rubygems-2.4.3-multiple-vulnerabilities.patch
|
||||
# Recent tzdata change breaks Ruby test suite.
|
||||
# https://bugs.ruby-lang.org/issues/14438
|
||||
Patch12: ruby-2.5.0-Disable-Tokyo-TZ-tests.patch
|
||||
# TestTimeTZ test failures Kiritimati and Lisbon
|
||||
# https://bugs.ruby-lang.org/issues/14655
|
||||
Patch13: ruby-2.5.1-TestTimeTZ-test-failures-Kiritimati-and-Lisbon.patch
|
||||
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
Suggests: rubypick
|
||||
@ -519,8 +515,7 @@ rm -rf ext/fiddle/libffi*
|
||||
%patch7 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p0
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
|
||||
# Provide an example of usage of the tapset:
|
||||
cp -a %{SOURCE3} .
|
||||
@ -1035,6 +1030,9 @@ make check TESTS="-v $DISABLE_TESTS"
|
||||
%{gem_dir}/specifications/xmlrpc-%{xmlrpc_version}.gemspec
|
||||
|
||||
%changelog
|
||||
* Mon Apr 16 2018 Pavel Valena <pvalena@redhat.com> - 2.4.4-88
|
||||
- Update to Ruby 2.4.4.
|
||||
|
||||
* Wed Feb 21 2018 Pavel Valena <pvalena@redhat.com> - 2.4.3-87
|
||||
- Fix: Multiple vulnerabilities in RubyGems
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1547431
|
||||
|
@ -1,605 +0,0 @@
|
||||
diff --git lib/rubygems.rb lib/rubygems.rb
|
||||
index 0685bcb3c6..a5a9202e56 100644
|
||||
--- lib/rubygems.rb
|
||||
+++ lib/rubygems.rb
|
||||
@@ -10,7 +10,7 @@
|
||||
require 'thread'
|
||||
|
||||
module Gem
|
||||
- VERSION = "2.6.14"
|
||||
+ VERSION = "2.6.14.1"
|
||||
end
|
||||
|
||||
# Must be first since it unloads the prelude from 1.9.2
|
||||
diff --git lib/rubygems/commands/owner_command.rb lib/rubygems/commands/owner_command.rb
|
||||
index 4b99434e87..2ee7f84462 100644
|
||||
--- lib/rubygems/commands/owner_command.rb
|
||||
+++ lib/rubygems/commands/owner_command.rb
|
||||
@@ -62,7 +62,7 @@ def show_owners name
|
||||
end
|
||||
|
||||
with_response response do |resp|
|
||||
- owners = YAML.load resp.body
|
||||
+ owners = Gem::SafeYAML.load resp.body
|
||||
|
||||
say "Owners for gem: #{name}"
|
||||
owners.each do |owner|
|
||||
diff --git lib/rubygems/package.rb lib/rubygems/package.rb
|
||||
index 77811ed5ec..b5a5fe2a26 100644
|
||||
--- lib/rubygems/package.rb
|
||||
+++ lib/rubygems/package.rb
|
||||
@@ -378,7 +378,7 @@ def extract_tar_gz io, destination_dir, pattern = "*" # :nodoc:
|
||||
File.dirname destination
|
||||
end
|
||||
|
||||
- FileUtils.mkdir_p mkdir, mkdir_options
|
||||
+ mkdir_p_safe mkdir, mkdir_options, destination_dir, entry.full_name
|
||||
|
||||
open destination, 'wb' do |out|
|
||||
out.write entry.read
|
||||
@@ -416,20 +416,35 @@ def install_location filename, destination_dir # :nodoc:
|
||||
raise Gem::Package::PathError.new(filename, destination_dir) if
|
||||
filename.start_with? '/'
|
||||
|
||||
- destination_dir = File.realpath destination_dir if
|
||||
- File.respond_to? :realpath
|
||||
+ destination_dir = realpath destination_dir
|
||||
destination_dir = File.expand_path destination_dir
|
||||
|
||||
destination = File.join destination_dir, filename
|
||||
destination = File.expand_path destination
|
||||
|
||||
raise Gem::Package::PathError.new(destination, destination_dir) unless
|
||||
- destination.start_with? destination_dir
|
||||
+ destination.start_with? destination_dir + '/'
|
||||
|
||||
destination.untaint
|
||||
destination
|
||||
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)
|
||||
+ parts.reduce do |path, basename|
|
||||
+ path = realpath path unless path == ""
|
||||
+ 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)
|
||||
+ raise Gem::Package::PathError.new(file_name, destination_dir)
|
||||
+ end
|
||||
+ end
|
||||
+ path
|
||||
+ end
|
||||
+ end
|
||||
+
|
||||
##
|
||||
# Loads a Gem::Specification from the TarEntry +entry+
|
||||
|
||||
@@ -603,6 +618,10 @@ def verify_files gem
|
||||
raise Gem::Package::FormatError.new \
|
||||
'package content (data.tar.gz) is missing', @gem
|
||||
end
|
||||
+
|
||||
+ if duplicates = @files.group_by {|f| f }.select {|k,v| v.size > 1 }.map(&:first) and duplicates.any?
|
||||
+ raise Gem::Security::Exception, "duplicate files in the package: (#{duplicates.map(&:inspect).join(', ')})"
|
||||
+ end
|
||||
end
|
||||
|
||||
##
|
||||
@@ -616,6 +635,16 @@ def verify_gz entry # :nodoc:
|
||||
raise Gem::Package::FormatError.new(e.message, entry.full_name)
|
||||
end
|
||||
|
||||
+ if File.respond_to? :realpath
|
||||
+ def realpath file
|
||||
+ File.realpath file
|
||||
+ end
|
||||
+ else
|
||||
+ def realpath file
|
||||
+ file
|
||||
+ end
|
||||
+ end
|
||||
+
|
||||
end
|
||||
|
||||
require 'rubygems/package/digest_io'
|
||||
diff --git lib/rubygems/package/tar_header.rb lib/rubygems/package/tar_header.rb
|
||||
index c54bd14d57..d557357114 100644
|
||||
--- lib/rubygems/package/tar_header.rb
|
||||
+++ lib/rubygems/package/tar_header.rb
|
||||
@@ -104,25 +104,30 @@ def self.from(stream)
|
||||
fields = header.unpack UNPACK_FORMAT
|
||||
|
||||
new :name => fields.shift,
|
||||
- :mode => fields.shift.oct,
|
||||
- :uid => fields.shift.oct,
|
||||
- :gid => fields.shift.oct,
|
||||
- :size => fields.shift.oct,
|
||||
- :mtime => fields.shift.oct,
|
||||
- :checksum => fields.shift.oct,
|
||||
+ :mode => strict_oct(fields.shift),
|
||||
+ :uid => strict_oct(fields.shift),
|
||||
+ :gid => strict_oct(fields.shift),
|
||||
+ :size => strict_oct(fields.shift),
|
||||
+ :mtime => strict_oct(fields.shift),
|
||||
+ :checksum => strict_oct(fields.shift),
|
||||
:typeflag => fields.shift,
|
||||
:linkname => fields.shift,
|
||||
:magic => fields.shift,
|
||||
- :version => fields.shift.oct,
|
||||
+ :version => strict_oct(fields.shift),
|
||||
:uname => fields.shift,
|
||||
:gname => fields.shift,
|
||||
- :devmajor => fields.shift.oct,
|
||||
- :devminor => fields.shift.oct,
|
||||
+ :devmajor => strict_oct(fields.shift),
|
||||
+ :devminor => strict_oct(fields.shift),
|
||||
:prefix => fields.shift,
|
||||
|
||||
:empty => empty
|
||||
end
|
||||
|
||||
+ def self.strict_oct(str)
|
||||
+ return str.oct if str =~ /\A[0-7]*\z/
|
||||
+ raise ArgumentError, "#{str.inspect} is not an octal string"
|
||||
+ end
|
||||
+
|
||||
##
|
||||
# Creates a new TarHeader using +vals+
|
||||
|
||||
diff --git lib/rubygems/package/tar_writer.rb lib/rubygems/package/tar_writer.rb
|
||||
index f68b8d4c5e..390f7851a3 100644
|
||||
--- lib/rubygems/package/tar_writer.rb
|
||||
+++ lib/rubygems/package/tar_writer.rb
|
||||
@@ -196,6 +196,8 @@ def add_file_signed name, mode, signer
|
||||
digest_name == signer.digest_name
|
||||
end
|
||||
|
||||
+ raise "no #{signer.digest_name} in #{digests.values.compact}" unless signature_digest
|
||||
+
|
||||
if signer.key then
|
||||
signature = signer.sign signature_digest.digest
|
||||
|
||||
diff --git lib/rubygems/server.rb lib/rubygems/server.rb
|
||||
index df4eb566d3..a7b5243ba0 100644
|
||||
--- lib/rubygems/server.rb
|
||||
+++ lib/rubygems/server.rb
|
||||
@@ -631,6 +631,18 @@ def root(req, res)
|
||||
executables = nil if executables.empty?
|
||||
executables.last["is_last"] = true if executables
|
||||
|
||||
+ # Pre-process spec homepage for safety reasons
|
||||
+ begin
|
||||
+ homepage_uri = URI.parse(spec.homepage)
|
||||
+ if [URI::HTTP, URI::HTTPS].member? homepage_uri.class
|
||||
+ homepage_uri = spec.homepage
|
||||
+ else
|
||||
+ homepage_uri = "."
|
||||
+ end
|
||||
+ rescue URI::InvalidURIError
|
||||
+ homepage_uri = "."
|
||||
+ end
|
||||
+
|
||||
specs << {
|
||||
"authors" => spec.authors.sort.join(", "),
|
||||
"date" => spec.date.to_s,
|
||||
@@ -640,7 +652,7 @@ def root(req, res)
|
||||
"only_one_executable" => (executables && executables.size == 1),
|
||||
"full_name" => spec.full_name,
|
||||
"has_deps" => !deps.empty?,
|
||||
- "homepage" => spec.homepage,
|
||||
+ "homepage" => homepage_uri,
|
||||
"name" => spec.name,
|
||||
"rdoc_installed" => Gem::RDoc.new(spec).rdoc_installed?,
|
||||
"ri_installed" => Gem::RDoc.new(spec).ri_installed?,
|
||||
diff --git lib/rubygems/specification.rb lib/rubygems/specification.rb
|
||||
index 40e3a70d47..0a154b9001 100644
|
||||
--- lib/rubygems/specification.rb
|
||||
+++ lib/rubygems/specification.rb
|
||||
@@ -15,6 +15,7 @@
|
||||
require 'rubygems/stub_specification'
|
||||
require 'rubygems/util/list'
|
||||
require 'stringio'
|
||||
+require 'uri'
|
||||
|
||||
##
|
||||
# The Specification class contains the information for a Gem. Typically
|
||||
@@ -2813,10 +2814,16 @@ def validate packaging = true
|
||||
raise Gem::InvalidSpecificationException, "#{lazy} is not a summary"
|
||||
end
|
||||
|
||||
- if homepage and not homepage.empty? and
|
||||
- homepage !~ /\A[a-z][a-z\d+.-]*:/i then
|
||||
- raise Gem::InvalidSpecificationException,
|
||||
- "\"#{homepage}\" is not a URI"
|
||||
+ # Make sure a homepage is valid HTTP/HTTPS URI
|
||||
+ if homepage and not homepage.empty?
|
||||
+ begin
|
||||
+ homepage_uri = URI.parse(homepage)
|
||||
+ unless [URI::HTTP, URI::HTTPS].member? homepage_uri.class
|
||||
+ raise Gem::InvalidSpecificationException, "\"#{homepage}\" is not a valid HTTP URI"
|
||||
+ end
|
||||
+ rescue URI::InvalidURIError
|
||||
+ raise Gem::InvalidSpecificationException, "\"#{homepage}\" is not a valid HTTP URI"
|
||||
+ end
|
||||
end
|
||||
|
||||
# Warnings
|
||||
diff --git test/rubygems/test_gem_commands_owner_command.rb test/rubygems/test_gem_commands_owner_command.rb
|
||||
index 44652c1093..53cac4ce87 100644
|
||||
--- test/rubygems/test_gem_commands_owner_command.rb
|
||||
+++ test/rubygems/test_gem_commands_owner_command.rb
|
||||
@@ -43,6 +43,31 @@ def test_show_owners
|
||||
assert_match %r{- 4}, @ui.output
|
||||
end
|
||||
|
||||
+ def test_show_owners_dont_load_objects
|
||||
+ skip "testing a psych-only API" unless defined?(::Psych::DisallowedClass)
|
||||
+
|
||||
+ response = <<EOF
|
||||
+---
|
||||
+- email: !ruby/object:Object {}
|
||||
+ id: 1
|
||||
+ handle: user1
|
||||
+- email: user2@example.com
|
||||
+- id: 3
|
||||
+ handle: user3
|
||||
+- id: 4
|
||||
+EOF
|
||||
+
|
||||
+ @fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK']
|
||||
+
|
||||
+ assert_raises Psych::DisallowedClass do
|
||||
+ use_ui @ui do
|
||||
+ @cmd.show_owners("freewill")
|
||||
+ end
|
||||
+ end
|
||||
+
|
||||
+ end
|
||||
+
|
||||
+
|
||||
def test_show_owners_setting_up_host_through_env_var
|
||||
response = "- email: user1@example.com\n"
|
||||
host = "http://rubygems.example"
|
||||
diff --git test/rubygems/test_gem_package.rb test/rubygems/test_gem_package.rb
|
||||
index 9d47f0dea4..5b93475314 100644
|
||||
--- test/rubygems/test_gem_package.rb
|
||||
+++ test/rubygems/test_gem_package.rb
|
||||
@@ -455,6 +455,31 @@ def test_extract_tar_gz_symlink_relative_path
|
||||
File.read(extracted)
|
||||
end
|
||||
|
||||
+ def test_extract_symlink_parent
|
||||
+ skip 'symlink not supported' if Gem.win_platform?
|
||||
+
|
||||
+ package = Gem::Package.new @gem
|
||||
+
|
||||
+ tgz_io = util_tar_gz do |tar|
|
||||
+ tar.mkdir 'lib', 0755
|
||||
+ tar.add_symlink 'lib/link', '../..', 0644
|
||||
+ tar.add_file 'lib/link/outside.txt', 0644 do |io| io.write 'hi' end
|
||||
+ end
|
||||
+
|
||||
+ # Extract into a subdirectory of @destination; if this test fails it writes
|
||||
+ # a file outside destination_subdir, but we want the file to remain inside
|
||||
+ # @destination so it will be cleaned up.
|
||||
+ destination_subdir = File.join @destination, 'subdir'
|
||||
+ FileUtils.mkdir_p destination_subdir
|
||||
+
|
||||
+ e = assert_raises Gem::Package::PathError do
|
||||
+ package.extract_tar_gz tgz_io, destination_subdir
|
||||
+ end
|
||||
+
|
||||
+ assert_equal("installing into parent path lib/link/outside.txt of " +
|
||||
+ "#{destination_subdir} is not allowed", e.message)
|
||||
+ end
|
||||
+
|
||||
def test_extract_tar_gz_directory
|
||||
package = Gem::Package.new @gem
|
||||
|
||||
@@ -566,6 +591,21 @@ def test_install_location_relative
|
||||
"#{@destination} is not allowed", e.message)
|
||||
end
|
||||
|
||||
+ def test_install_location_suffix
|
||||
+ package = Gem::Package.new @gem
|
||||
+
|
||||
+ filename = "../#{File.basename(@destination)}suffix.rb"
|
||||
+
|
||||
+ e = assert_raises Gem::Package::PathError do
|
||||
+ package.install_location filename, @destination
|
||||
+ end
|
||||
+
|
||||
+ parent = File.expand_path File.join @destination, filename
|
||||
+
|
||||
+ assert_equal("installing into parent path #{parent} of " +
|
||||
+ "#{@destination} is not allowed", e.message)
|
||||
+ end
|
||||
+
|
||||
def test_load_spec
|
||||
entry = StringIO.new Gem.gzip @spec.to_yaml
|
||||
def entry.full_name() 'metadata.gz' end
|
||||
@@ -723,6 +763,32 @@ def test_verify_nonexistent
|
||||
assert_match %r%nonexistent.gem$%, e.message
|
||||
end
|
||||
|
||||
+ def test_verify_duplicate_file
|
||||
+ FileUtils.mkdir_p 'lib'
|
||||
+ FileUtils.touch 'lib/code.rb'
|
||||
+
|
||||
+ build = Gem::Package.new @gem
|
||||
+ build.spec = @spec
|
||||
+ build.setup_signer
|
||||
+ open @gem, 'wb' do |gem_io|
|
||||
+ Gem::Package::TarWriter.new gem_io do |gem|
|
||||
+ build.add_metadata gem
|
||||
+ build.add_contents gem
|
||||
+
|
||||
+ gem.add_file_simple 'a.sig', 0444, 0
|
||||
+ gem.add_file_simple 'a.sig', 0444, 0
|
||||
+ end
|
||||
+ end
|
||||
+
|
||||
+ package = Gem::Package.new @gem
|
||||
+
|
||||
+ e = assert_raises Gem::Security::Exception do
|
||||
+ package.verify
|
||||
+ end
|
||||
+
|
||||
+ assert_equal 'duplicate files in the package: ("a.sig")', e.message
|
||||
+ end
|
||||
+
|
||||
def test_verify_security_policy
|
||||
skip 'openssl is missing' unless defined?(OpenSSL::SSL)
|
||||
|
||||
@@ -780,7 +846,13 @@ def test_verify_security_policy_checksum_missing
|
||||
|
||||
# write bogus data.tar.gz to foil signature
|
||||
bogus_data = Gem.gzip 'hello'
|
||||
- gem.add_file_simple 'data.tar.gz', 0444, bogus_data.length do |io|
|
||||
+ fake_signer = Class.new do
|
||||
+ def digest_name; 'SHA512'; end
|
||||
+ def digest_algorithm; Digest(:SHA512); end
|
||||
+ def key; 'key'; end
|
||||
+ def sign(*); 'fake_sig'; end
|
||||
+ end
|
||||
+ gem.add_file_signed 'data2.tar.gz', 0444, fake_signer.new do |io|
|
||||
io.write bogus_data
|
||||
end
|
||||
|
||||
diff --git test/rubygems/test_gem_package_tar_header.rb test/rubygems/test_gem_package_tar_header.rb
|
||||
index d33877057d..43f508df45 100644
|
||||
--- test/rubygems/test_gem_package_tar_header.rb
|
||||
+++ test/rubygems/test_gem_package_tar_header.rb
|
||||
@@ -143,5 +143,26 @@ def test_update_checksum
|
||||
assert_equal '012467', @tar_header.checksum
|
||||
end
|
||||
|
||||
+ def test_from_bad_octal
|
||||
+ test_cases = [
|
||||
+ "00000006,44\000", # bogus character
|
||||
+ "00000006789\000", # non-octal digit
|
||||
+ "+0000001234\000", # positive sign
|
||||
+ "-0000001000\000", # negative sign
|
||||
+ "0x000123abc\000", # radix prefix
|
||||
+ ]
|
||||
+
|
||||
+ test_cases.each do |val|
|
||||
+ header_s = @tar_header.to_s
|
||||
+ # overwrite the size field
|
||||
+ header_s[124, 12] = val
|
||||
+ io = TempIO.new header_s
|
||||
+ assert_raises ArgumentError do
|
||||
+ new_header = Gem::Package::TarHeader.from io
|
||||
+ end
|
||||
+ io.close! if io.respond_to? :close!
|
||||
+ end
|
||||
+ end
|
||||
+
|
||||
end
|
||||
|
||||
diff --git test/rubygems/test_gem_server.rb test/rubygems/test_gem_server.rb
|
||||
index 4873fac5b6..96ed9194e9 100644
|
||||
--- test/rubygems/test_gem_server.rb
|
||||
+++ test/rubygems/test_gem_server.rb
|
||||
@@ -336,6 +336,171 @@ def test_root_gemdirs
|
||||
assert_match 'z 9', @res.body
|
||||
end
|
||||
|
||||
+
|
||||
+ def test_xss_homepage_fix_289313
|
||||
+ data = StringIO.new "GET / HTTP/1.0\r\n\r\n"
|
||||
+ dir = "#{@gemhome}2"
|
||||
+
|
||||
+ spec = util_spec 'xsshomepagegem', 1
|
||||
+ spec.homepage = "javascript:confirm(document.domain)"
|
||||
+
|
||||
+ specs_dir = File.join dir, 'specifications'
|
||||
+ FileUtils.mkdir_p specs_dir
|
||||
+
|
||||
+ open File.join(specs_dir, spec.spec_name), 'w' do |io|
|
||||
+ io.write spec.to_ruby
|
||||
+ end
|
||||
+
|
||||
+ server = Gem::Server.new dir, process_based_port, false
|
||||
+
|
||||
+ @req.parse data
|
||||
+
|
||||
+ server.root @req, @res
|
||||
+
|
||||
+ assert_equal 200, @res.status
|
||||
+ assert_match 'xsshomepagegem 1', @res.body
|
||||
+
|
||||
+ # This verifies that the homepage for this spec is not displayed and is set to ".", because it's not a
|
||||
+ # valid HTTP/HTTPS URL and could be unsafe in an HTML context. We would prefer to throw an exception here,
|
||||
+ # but spec.homepage is currently free form and not currently required to be a URL, this behavior may be
|
||||
+ # validated in future versions of Gem::Specification.
|
||||
+ #
|
||||
+ # There are two variant we're checking here, one where rdoc is not present, and one where rdoc is present in the same regex:
|
||||
+ #
|
||||
+ # Variant #1 - rdoc not installed
|
||||
+ #
|
||||
+ # <b>xsshomepagegem 1</b>
|
||||
+ #
|
||||
+ #
|
||||
+ # <span title="rdoc not installed">[rdoc]</span>
|
||||
+ #
|
||||
+ #
|
||||
+ #
|
||||
+ # <a href="." title=".">[www]</a>
|
||||
+ #
|
||||
+ # Variant #2 - rdoc installed
|
||||
+ #
|
||||
+ # <b>xsshomepagegem 1</b>
|
||||
+ #
|
||||
+ #
|
||||
+ # <a href="\/doc_root\/xsshomepagegem-1\/">\[rdoc\]<\/a>
|
||||
+ #
|
||||
+ #
|
||||
+ #
|
||||
+ # <a href="." title=".">[www]</a>
|
||||
+ regex_match = /xsshomepagegem 1<\/b>[\n\s]+(<span title="rdoc not installed">\[rdoc\]<\/span>|<a href="\/doc_root\/xsshomepagegem-1\/">\[rdoc\]<\/a>)[\n\s]+<a href="\." title="\.">\[www\]<\/a>/
|
||||
+ assert_match regex_match, @res.body
|
||||
+ end
|
||||
+
|
||||
+ def test_invalid_homepage
|
||||
+ data = StringIO.new "GET / HTTP/1.0\r\n\r\n"
|
||||
+ dir = "#{@gemhome}2"
|
||||
+
|
||||
+ spec = util_spec 'invalidhomepagegem', 1
|
||||
+ spec.homepage = "notavalidhomepageurl"
|
||||
+
|
||||
+ specs_dir = File.join dir, 'specifications'
|
||||
+ FileUtils.mkdir_p specs_dir
|
||||
+
|
||||
+ open File.join(specs_dir, spec.spec_name), 'w' do |io|
|
||||
+ io.write spec.to_ruby
|
||||
+ end
|
||||
+
|
||||
+ server = Gem::Server.new dir, process_based_port, false
|
||||
+
|
||||
+ @req.parse data
|
||||
+
|
||||
+ server.root @req, @res
|
||||
+
|
||||
+ assert_equal 200, @res.status
|
||||
+ assert_match 'invalidhomepagegem 1', @res.body
|
||||
+
|
||||
+ # This verifies that the homepage for this spec is not displayed and is set to ".", because it's not a
|
||||
+ # valid HTTP/HTTPS URL and could be unsafe in an HTML context. We would prefer to throw an exception here,
|
||||
+ # but spec.homepage is currently free form and not currently required to be a URL, this behavior may be
|
||||
+ # validated in future versions of Gem::Specification.
|
||||
+ #
|
||||
+ # There are two variant we're checking here, one where rdoc is not present, and one where rdoc is present in the same regex:
|
||||
+ #
|
||||
+ # Variant #1 - rdoc not installed
|
||||
+ #
|
||||
+ # <b>invalidhomepagegem 1</b>
|
||||
+ #
|
||||
+ #
|
||||
+ # <span title="rdoc not installed">[rdoc]</span>
|
||||
+ #
|
||||
+ #
|
||||
+ #
|
||||
+ # <a href="." title=".">[www]</a>
|
||||
+ #
|
||||
+ # Variant #2 - rdoc installed
|
||||
+ #
|
||||
+ # <b>invalidhomepagegem 1</b>
|
||||
+ #
|
||||
+ #
|
||||
+ # <a href="\/doc_root\/invalidhomepagegem-1\/">\[rdoc\]<\/a>
|
||||
+ #
|
||||
+ #
|
||||
+ #
|
||||
+ # <a href="." title=".">[www]</a>
|
||||
+ regex_match = /invalidhomepagegem 1<\/b>[\n\s]+(<span title="rdoc not installed">\[rdoc\]<\/span>|<a href="\/doc_root\/invalidhomepagegem-1\/">\[rdoc\]<\/a>)[\n\s]+<a href="\." title="\.">\[www\]<\/a>/
|
||||
+ assert_match regex_match, @res.body
|
||||
+ end
|
||||
+
|
||||
+ def test_valid_homepage_http
|
||||
+ data = StringIO.new "GET / HTTP/1.0\r\n\r\n"
|
||||
+ dir = "#{@gemhome}2"
|
||||
+
|
||||
+ spec = util_spec 'validhomepagegemhttp', 1
|
||||
+ spec.homepage = "http://rubygems.org"
|
||||
+
|
||||
+ specs_dir = File.join dir, 'specifications'
|
||||
+ FileUtils.mkdir_p specs_dir
|
||||
+
|
||||
+ open File.join(specs_dir, spec.spec_name), 'w' do |io|
|
||||
+ io.write spec.to_ruby
|
||||
+ end
|
||||
+
|
||||
+ server = Gem::Server.new dir, process_based_port, false
|
||||
+
|
||||
+ @req.parse data
|
||||
+
|
||||
+ server.root @req, @res
|
||||
+
|
||||
+ assert_equal 200, @res.status
|
||||
+ assert_match 'validhomepagegemhttp 1', @res.body
|
||||
+
|
||||
+ regex_match = /validhomepagegemhttp 1<\/b>[\n\s]+(<span title="rdoc not installed">\[rdoc\]<\/span>|<a href="\/doc_root\/validhomepagegemhttp-1\/">\[rdoc\]<\/a>)[\n\s]+<a href="http:\/\/rubygems\.org" title="http:\/\/rubygems\.org">\[www\]<\/a>/
|
||||
+ assert_match regex_match, @res.body
|
||||
+ end
|
||||
+
|
||||
+ def test_valid_homepage_https
|
||||
+ data = StringIO.new "GET / HTTP/1.0\r\n\r\n"
|
||||
+ dir = "#{@gemhome}2"
|
||||
+
|
||||
+ spec = util_spec 'validhomepagegemhttps', 1
|
||||
+ spec.homepage = "https://rubygems.org"
|
||||
+
|
||||
+ specs_dir = File.join dir, 'specifications'
|
||||
+ FileUtils.mkdir_p specs_dir
|
||||
+
|
||||
+ open File.join(specs_dir, spec.spec_name), 'w' do |io|
|
||||
+ io.write spec.to_ruby
|
||||
+ end
|
||||
+
|
||||
+ server = Gem::Server.new dir, process_based_port, false
|
||||
+
|
||||
+ @req.parse data
|
||||
+
|
||||
+ server.root @req, @res
|
||||
+
|
||||
+ assert_equal 200, @res.status
|
||||
+ assert_match 'validhomepagegemhttps 1', @res.body
|
||||
+
|
||||
+ regex_match = /validhomepagegemhttps 1<\/b>[\n\s]+(<span title="rdoc not installed">\[rdoc\]<\/span>|<a href="\/doc_root\/validhomepagegemhttps-1\/">\[rdoc\]<\/a>)[\n\s]+<a href="https:\/\/rubygems\.org" title="https:\/\/rubygems\.org">\[www\]<\/a>/
|
||||
+ assert_match regex_match, @res.body
|
||||
+ end
|
||||
+
|
||||
def test_specs
|
||||
data = StringIO.new "GET /specs.#{Gem.marshal_version} HTTP/1.0\r\n\r\n"
|
||||
@req.parse data
|
||||
diff --git test/rubygems/test_gem_specification.rb test/rubygems/test_gem_specification.rb
|
||||
index 0fcc11e78f..1c68826fb3 100644
|
||||
--- test/rubygems/test_gem_specification.rb
|
||||
+++ test/rubygems/test_gem_specification.rb
|
||||
@@ -2890,7 +2890,22 @@ def test_validate_homepage
|
||||
@a1.validate
|
||||
end
|
||||
|
||||
- assert_equal '"over at my cool site" is not a URI', e.message
|
||||
+ assert_equal '"over at my cool site" is not a valid HTTP URI', e.message
|
||||
+
|
||||
+ @a1.homepage = 'ftp://rubygems.org'
|
||||
+
|
||||
+ e = assert_raises Gem::InvalidSpecificationException do
|
||||
+ @a1.validate
|
||||
+ end
|
||||
+
|
||||
+ assert_equal '"ftp://rubygems.org" is not a valid HTTP URI', e.message
|
||||
+
|
||||
+ @a1.homepage = 'http://rubygems.org'
|
||||
+ assert_equal true, @a1.validate
|
||||
+
|
||||
+ @a1.homepage = 'https://rubygems.org'
|
||||
+ assert_equal true, @a1.validate
|
||||
+
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user