From 00084d448e71d8fd8caec22f194abd5b24f3f1b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 19 Apr 2022 14:11:12 +0200 Subject: [PATCH 1/8] Upgrade to Ruby 3.0.4. --- ...ed-paths-when-empty-version-string-i.patch | 2 +- ruby-2.1.0-always-use-i386.patch | 2 +- ruby-2.1.0-custom-rubygems-location.patch | 6 +- ruby-2.3.0-ruby_version.patch | 10 +-- ruby-dwarf5-avoid_crash-r1.patch | 20 +++--- ruby.spec | 66 +++++++++++-------- sources | 2 +- 7 files changed, 58 insertions(+), 50 deletions(-) diff --git a/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch b/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch index 118203c..437d09f 100644 --- a/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch +++ b/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch @@ -14,7 +14,7 @@ diff --git a/configure.ac b/configure.ac index c42436c23d..d261ea57b5 100644 --- a/configure.ac +++ b/configure.ac -@@ -3881,7 +3881,8 @@ AS_CASE(["$ruby_version_dir_name"], +@@ -3886,7 +3886,8 @@ AS_CASE(["$ruby_version_dir_name"], ruby_version_dir=/'${ruby_version_dir_name}' if test -z "${ruby_version_dir_name}"; then diff --git a/ruby-2.1.0-always-use-i386.patch b/ruby-2.1.0-always-use-i386.patch index de58295..46584d7 100644 --- a/ruby-2.1.0-always-use-i386.patch +++ b/ruby-2.1.0-always-use-i386.patch @@ -11,7 +11,7 @@ diff --git a/configure.ac b/configure.ac index 3c13076b82..93af30321d 100644 --- a/configure.ac +++ b/configure.ac -@@ -3945,6 +3945,8 @@ AC_SUBST(vendorarchdir)dnl +@@ -3950,6 +3950,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 diff --git a/ruby-2.1.0-custom-rubygems-location.patch b/ruby-2.1.0-custom-rubygems-location.patch index b7157ff..6946429 100644 --- a/ruby-2.1.0-custom-rubygems-location.patch +++ b/ruby-2.1.0-custom-rubygems-location.patch @@ -15,7 +15,7 @@ diff --git a/configure.ac b/configure.ac index 93af30321d..bc13397e0e 100644 --- a/configure.ac +++ b/configure.ac -@@ -3917,6 +3917,10 @@ AC_ARG_WITH(vendorarchdir, +@@ -3922,6 +3922,10 @@ AC_ARG_WITH(vendorarchdir, [vendorarchdir=$withval], [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}]) @@ -26,7 +26,7 @@ index 93af30321d..bc13397e0e 100644 AS_IF([test "${LOAD_RELATIVE+set}"], [ AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE) RUBY_EXEC_PREFIX='' -@@ -3941,6 +3941,7 @@ AC_SUBST(sitearchdir)dnl +@@ -3946,6 +3950,7 @@ AC_SUBST(sitearchdir)dnl AC_SUBST(vendordir)dnl AC_SUBST(vendorlibdir)dnl AC_SUBST(vendorarchdir)dnl @@ -75,7 +75,7 @@ index e9110a17ca..76a1f0a315 100755 mandir = CONFIG["mandir", true] docdir = CONFIG["docdir", true] enable_shared = CONFIG["ENABLE_SHARED"] == 'yes' -@@ -581,7 +581,16 @@ def stub +@@ -581,7 +582,16 @@ def stub install?(:local, :comm, :lib) do prepare "library scripts", rubylibdir noinst = %w[*.txt *.rdoc *.gemspec] diff --git a/ruby-2.3.0-ruby_version.patch b/ruby-2.3.0-ruby_version.patch index 4fd6530..fd545e5 100644 --- a/ruby-2.3.0-ruby_version.patch +++ b/ruby-2.3.0-ruby_version.patch @@ -20,7 +20,7 @@ diff --git a/configure.ac b/configure.ac index 80b137e380..63cd3b4f8b 100644 --- a/configure.ac +++ b/configure.ac -@@ -3832,9 +3832,6 @@ AS_CASE(["$target_os"], +@@ -3837,9 +3837,6 @@ AS_CASE(["$target_os"], rubyw_install_name='$(RUBYW_INSTALL_NAME)' ]) @@ -30,7 +30,7 @@ index 80b137e380..63cd3b4f8b 100644 rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'} AC_ARG_WITH(rubyarchprefix, AS_HELP_STRING([--with-rubyarchprefix=DIR], -@@ -3857,56 +3857,62 @@ AC_ARG_WITH(ridir, +@@ -3862,56 +3859,62 @@ AC_ARG_WITH(ridir, AC_SUBST(ridir) AC_SUBST(RI_BASE_NAME) @@ -120,7 +120,7 @@ index 80b137e380..63cd3b4f8b 100644 AS_IF([test "${LOAD_RELATIVE+set}"], [ AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE) -@@ -3923,6 +3923,7 @@ AC_SUBST(sitearchincludedir)dnl +@@ -3928,6 +3931,7 @@ AC_SUBST(sitearchincludedir)dnl AC_SUBST(arch)dnl AC_SUBST(sitearch)dnl AC_SUBST(ruby_version)dnl @@ -237,7 +237,7 @@ diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index b25068405d..e9fef4a311 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb -@@ -1452,7 +1452,8 @@ def test_self_use_paths +@@ -1440,7 +1440,8 @@ def test_self_use_paths def test_self_user_dir parts = [@userhome, '.gem', Gem.ruby_engine] @@ -247,7 +247,7 @@ index b25068405d..e9fef4a311 100644 FileUtils.mkdir_p File.join(parts) -@@ -1530,7 +1531,7 @@ def test_self_vendor_dir +@@ -1516,7 +1517,7 @@ def test_self_vendor_dir vendordir(File.join(@tempdir, 'vendor')) do expected = File.join RbConfig::CONFIG['vendordir'], 'gems', diff --git a/ruby-dwarf5-avoid_crash-r1.patch b/ruby-dwarf5-avoid_crash-r1.patch index c14642b..b183f8f 100644 --- a/ruby-dwarf5-avoid_crash-r1.patch +++ b/ruby-dwarf5-avoid_crash-r1.patch @@ -31,7 +31,7 @@ addr += a; break; case DW_LNS_advance_line: { -@@ -450,7 +452,7 @@ +@@ -451,7 +453,7 @@ /* isa = (unsigned int)*/(void)uleb128((char **)&p); break; case 0: @@ -40,7 +40,7 @@ op = *p++; switch (op) { case DW_LNE_end_sequence: -@@ -807,6 +809,18 @@ +@@ -808,6 +810,18 @@ DW_FORM_addrx4 = 0x2c }; @@ -59,7 +59,7 @@ enum { VAL_none = 0, VAL_cstr = 1, -@@ -961,6 +975,23 @@ +@@ -962,6 +976,23 @@ } static void @@ -83,7 +83,7 @@ di_read_debug_abbrev_cu(DebugInfoReader *reader) { uint64_t prev = 0; -@@ -974,12 +1005,7 @@ +@@ -975,12 +1006,7 @@ prev = abbrev_number; uleb128(&p); /* tag */ p++; /* has_children */ @@ -97,7 +97,7 @@ } } -@@ -1243,12 +1269,7 @@ +@@ -1244,12 +1270,7 @@ /* skip 255th record */ uleb128(&p); /* tag */ p++; /* has_children */ @@ -111,7 +111,7 @@ for (uint64_t n = uleb128(&p); abbrev_number != n; n = uleb128(&p)) { if (n == 0) { fprintf(stderr,"%d: Abbrev Number %"PRId64" not found\n",__LINE__, abbrev_number); -@@ -1256,12 +1277,7 @@ +@@ -1257,12 +1278,7 @@ } uleb128(&p); /* tag */ p++; /* has_children */ @@ -125,7 +125,7 @@ } return p; } -@@ -1389,6 +1405,21 @@ +@@ -1390,6 +1406,21 @@ } } @@ -147,7 +147,7 @@ static uintptr_t ranges_include(DebugInfoReader *reader, ranges_t *ptr, uint64_t addr) { -@@ -1402,8 +1433,50 @@ +@@ -1403,8 +1434,50 @@ } else if (ptr->ranges_set) { /* TODO: support base address selection entry */ @@ -199,7 +199,7 @@ for (;;) { uintptr_t from = read_uintptr(&p); uintptr_t to = read_uintptr(&p); -@@ -1747,6 +1820,7 @@ +@@ -1750,6 +1823,7 @@ ".debug_info", ".debug_line", ".debug_ranges", @@ -207,7 +207,7 @@ ".debug_str" }; -@@ -2003,6 +2077,7 @@ +@@ -2006,6 +2080,7 @@ "__debug_info", "__debug_line", "__debug_ranges", diff --git a/ruby.spec b/ruby.spec index 9f01a3a..7077d07 100644 --- a/ruby.spec +++ b/ruby.spec @@ -1,6 +1,6 @@ %global major_version 3 %global minor_version 0 -%global teeny_version 2 +%global teeny_version 4 %global major_minor_version %{major_version}.%{minor_version} %global ruby_version %{major_minor_version}.%{teeny_version} @@ -22,7 +22,7 @@ %endif -%global release 151 +%global release 152 %{!?release_string:%define release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} # The RubyGems library has to stay out of Ruby directory tree, since the @@ -30,12 +30,12 @@ %global rubygems_dir %{_datadir}/rubygems # Bundled libraries versions -%global rubygems_version 3.2.22 +%global rubygems_version 3.2.33 %global rubygems_molinillo_version 0.7.0 # Default gems. -%global bundler_version 2.2.22 -%global bundler_connection_pool_version 2.2.2 +%global bundler_version 2.2.33 +%global bundler_connection_pool_version 2.3.0 %global bundler_fileutils_version 1.4.1 %global bundler_molinillo_version 0.7.0 %global bundler_net_http_persistent_version 4.0.0 @@ -49,20 +49,20 @@ %global io_console_version 0.5.7 %global irb_version 1.3.5 %global json_version 2.5.1 -%global openssl_version 2.2.0 -%global psych_version 3.3.0 -%global racc_version 1.5.1 -%global rdoc_version 6.3.1 +%global openssl_version 2.2.1 +%global psych_version 3.3.2 +%global racc_version 1.5.2 +%global rdoc_version 6.3.3 # Bundled gems. %global minitest_version 5.14.2 %global power_assert_version 1.2.0 %global rake_version 13.0.3 -%global rbs_version 1.0.4 +%global rbs_version 1.4.0 %global test_unit_version 3.3.7 %global rexml_version 3.2.5 %global rss_version 0.2.9 -%global typeprof_version 0.12.0 +%global typeprof_version 0.15.2 %global tapset_libdir %(echo %{_libdir} | sed 's/64//')* @@ -874,6 +874,12 @@ make runruby TESTRUN_SCRIPT="--enable-gems %{SOURCE13}" DISABLE_TESTS="" MSPECOPTS="" +%ifarch ppc64le +# `Couldn't unprotect page` error. +# https://bugs.ruby-lang.org/issues/18746 +DISABLE_TESTS="$DISABLE_TESTS -n !/test_\(ast_compacts\|compact_count\|complex_hash_keys\|gc_compact_stats\)/" +%endif + # Avoid `hostname' dependency. %{!?with_hostname:MSPECOPTS="-P 'Socket.gethostname returns the host name'"} @@ -1138,26 +1144,26 @@ MSPECOPTS="" %{gem_dir}/specifications/default/abbrev-0.1.0.gemspec %{gem_dir}/specifications/default/base64-0.1.0.gemspec %{gem_dir}/specifications/default/benchmark-0.1.1.gemspec -%{gem_dir}/specifications/default/cgi-0.2.0.gemspec +%{gem_dir}/specifications/default/cgi-0.2.1.gemspec %{gem_dir}/specifications/default/csv-3.1.9.gemspec -%{gem_dir}/specifications/default/date-3.1.0.gemspec +%{gem_dir}/specifications/default/date-3.1.3.gemspec %{gem_dir}/specifications/default/dbm-1.1.0.gemspec -%{gem_dir}/specifications/default/debug-0.1.0.gemspec +%{gem_dir}/specifications/default/debug-0.2.1.gemspec %{gem_dir}/specifications/default/delegate-0.2.0.gemspec %{gem_dir}/specifications/default/did_you_mean-%{did_you_mean_version}.gemspec %{gem_dir}/specifications/default/digest-3.0.0.gemspec -%{gem_dir}/specifications/default/drb-2.0.4.gemspec +%{gem_dir}/specifications/default/drb-2.0.5.gemspec %{gem_dir}/specifications/default/erb-%{erb_version}.gemspec -%{gem_dir}/specifications/default/etc-1.2.0.gemspec -%{gem_dir}/specifications/default/fcntl-1.0.0.gemspec -%{gem_dir}/specifications/default/fiddle-1.0.6.gemspec +%{gem_dir}/specifications/default/etc-1.3.0.gemspec +%{gem_dir}/specifications/default/fcntl-1.0.1.gemspec +%{gem_dir}/specifications/default/fiddle-1.0.8.gemspec %{gem_dir}/specifications/default/fileutils-1.5.0.gemspec %{gem_dir}/specifications/default/find-0.1.0.gemspec %{gem_dir}/specifications/default/forwardable-1.3.2.gemspec %{gem_dir}/specifications/default/gdbm-2.1.0.gemspec %{gem_dir}/specifications/default/getoptlong-0.1.1.gemspec %{gem_dir}/specifications/default/io-nonblock-0.1.0.gemspec -%{gem_dir}/specifications/default/io-wait-0.1.0.gemspec +%{gem_dir}/specifications/default/io-wait-0.2.0.gemspec %{gem_dir}/specifications/default/ipaddr-1.2.2.gemspec %{gem_dir}/specifications/default/logger-1.4.3.gemspec %{gem_dir}/specifications/default/matrix-0.3.1.gemspec @@ -1166,33 +1172,33 @@ MSPECOPTS="" %{gem_dir}/specifications/default/net-http-0.1.1.gemspec %{gem_dir}/specifications/default/net-imap-0.1.1.gemspec %{gem_dir}/specifications/default/net-pop-0.1.1.gemspec -%{gem_dir}/specifications/default/net-protocol-0.1.0.gemspec +%{gem_dir}/specifications/default/net-protocol-0.1.1.gemspec %{gem_dir}/specifications/default/net-smtp-0.2.1.gemspec %{gem_dir}/specifications/default/nkf-0.1.0.gemspec %{gem_dir}/specifications/default/observer-0.1.1.gemspec %{gem_dir}/specifications/default/open3-0.1.1.gemspec %{gem_dir}/specifications/default/open-uri-0.1.0.gemspec -%{gem_dir}/specifications/default/optparse-0.1.0.gemspec +%{gem_dir}/specifications/default/optparse-0.1.1.gemspec %{gem_dir}/specifications/default/openssl-%{openssl_version}.gemspec %{gem_dir}/specifications/default/ostruct-0.3.1.gemspec %{gem_dir}/specifications/default/pathname-0.1.0.gemspec -%{gem_dir}/specifications/default/pp-0.1.0.gemspec -%{gem_dir}/specifications/default/prettyprint-0.1.0.gemspec +%{gem_dir}/specifications/default/pp-0.2.1.gemspec +%{gem_dir}/specifications/default/prettyprint-0.1.1.gemspec %{gem_dir}/specifications/default/prime-0.1.2.gemspec %{gem_dir}/specifications/default/pstore-0.1.1.gemspec %{gem_dir}/specifications/default/racc-%{racc_version}.gemspec %{gem_dir}/specifications/default/readline-0.0.2.gemspec %{gem_dir}/specifications/default/readline-ext-0.1.1.gemspec %{gem_dir}/specifications/default/reline-0.2.5.gemspec -%{gem_dir}/specifications/default/resolv-0.2.0.gemspec +%{gem_dir}/specifications/default/resolv-0.2.1.gemspec %{gem_dir}/specifications/default/resolv-replace-0.1.0.gemspec -%{gem_dir}/specifications/default/rinda-0.1.0.gemspec +%{gem_dir}/specifications/default/rinda-0.1.1.gemspec %{gem_dir}/specifications/default/securerandom-0.1.0.gemspec %{gem_dir}/specifications/default/set-1.0.1.gemspec %{gem_dir}/specifications/default/shellwords-0.1.0.gemspec %{gem_dir}/specifications/default/singleton-0.1.1.gemspec -%{gem_dir}/specifications/default/stringio-3.0.0.gemspec -%{gem_dir}/specifications/default/strscan-3.0.0.gemspec +%{gem_dir}/specifications/default/stringio-3.0.1.gemspec +%{gem_dir}/specifications/default/strscan-3.0.1.gemspec %{gem_dir}/specifications/default/syslog-0.1.0.gemspec %{gem_dir}/specifications/default/tempfile-0.1.1.gemspec %{gem_dir}/specifications/default/time-0.1.0.gemspec @@ -1205,7 +1211,7 @@ MSPECOPTS="" %{gem_dir}/specifications/default/weakref-0.1.1.gemspec #%%{gem_dir}/specifications/default/win32ole-1.8.8.gemspec %{gem_dir}/specifications/default/yaml-0.1.1.gemspec -%{gem_dir}/specifications/default/zlib-1.1.0.gemspec +%{gem_dir}/specifications/default/zlib-2.0.0.gemspec %{gem_dir}/gems/erb-%{erb_version} # Use standalone rubygem-racc if Racc binary is required. Shipping this @@ -1299,7 +1305,6 @@ MSPECOPTS="" %doc %{gem_dir}/gems/rbs-%{rbs_version}/README.md %{gem_dir}/gems/rbs-%{rbs_version}/Rakefile %{gem_dir}/gems/rbs-%{rbs_version}/Steepfile -%{gem_dir}/gems/rbs-%{rbs_version}/bin %{gem_dir}/gems/rbs-%{rbs_version}/core %doc %{gem_dir}/gems/rbs-%{rbs_version}/docs %{gem_dir}/gems/rbs-%{rbs_version}/exe @@ -1355,6 +1360,9 @@ MSPECOPTS="" %changelog +* Tue Apr 19 2022 Vít Ondruch - 3.0.2-152 +- Upgrade to Ruby 3.0.4. + * Fri Jul 23 2021 Fedora Release Engineering - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index fc750ca..acb6fbe 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ruby-3.0.2.tar.xz) = 0f702e2d8ca1342a9d4284dbdd234a3588e057b92566353aa7c21835cf09a3932864b2acf459a976960a1704e9befa562155d36b98b7cda8bd99526e10a374c4 +SHA512 (ruby-3.0.4.tar.xz) = 53bf7dd403b0c68af9691882ad8ed7422c8d1f496627428fb4c3caf0b0313715524b744c5f453aced2d49e16e55f3f45b46b9a77aa3097dbfcae7caa0208194b From 004364fd97a3def5838b70491bf2947c218b081e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Thu, 21 Apr 2022 11:42:08 +0200 Subject: [PATCH 2/8] Fix GC test failures on ppc64le. Fix /test_\(ast_compacts\|compact_count\|complex_hash_keys\|gc_compact_stats\)/ test failures on ppc64le. It seems that upstream forgot to backport this patch. https://bugs.ruby-lang.org/issues/18394 --- ...-for-allocating-heap-pages-in-the-GC.patch | 359 ++++++++++++++++++ ruby.spec | 12 +- 2 files changed, 365 insertions(+), 6 deletions(-) create mode 100644 ruby-3.1.0-Use-mmap-for-allocating-heap-pages-in-the-GC.patch diff --git a/ruby-3.1.0-Use-mmap-for-allocating-heap-pages-in-the-GC.patch b/ruby-3.1.0-Use-mmap-for-allocating-heap-pages-in-the-GC.patch new file mode 100644 index 0000000..512be18 --- /dev/null +++ b/ruby-3.1.0-Use-mmap-for-allocating-heap-pages-in-the-GC.patch @@ -0,0 +1,359 @@ +From bcab8c3cd877506de75f50e0f9ed98827ed554b0 Mon Sep 17 00:00:00 2001 +From: Peter Zhu +Date: Tue, 23 Feb 2021 16:28:56 -0500 +Subject: [PATCH] Use mmap for allocating heap pages + +--- + configure.ac | 16 ++++ + gc.c | 149 ++++++++++++++++++++++++++--------- + test/ruby/test_gc_compact.rb | 41 ++++++---- + 3 files changed, 155 insertions(+), 51 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 2dcebdde9f..b1b190004d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1944,6 +1944,7 @@ AC_CHECK_FUNCS(memmem) + AC_CHECK_FUNCS(mkfifo) + AC_CHECK_FUNCS(mknod) + AC_CHECK_FUNCS(mktime) ++AC_CHECK_FUNCS(mmap) + AC_CHECK_FUNCS(openat) + AC_CHECK_FUNCS(pipe2) + AC_CHECK_FUNCS(poll) +@@ -2666,6 +2667,21 @@ main(int argc, char *argv[]) + rb_cv_fork_with_pthread=yes)]) + test x$rb_cv_fork_with_pthread = xyes || AC_DEFINE(CANNOT_FORK_WITH_PTHREAD) + ]) ++ ++AC_CHECK_HEADERS([sys/user.h]) ++AS_IF([test "x$ac_cv_func_mmap" = xyes], [ ++ AC_CACHE_CHECK([whether PAGE_SIZE is compile-time const], rb_cv_const_page_size, ++ [malloc_headers=`sed -n '/MALLOC_HEADERS_BEGIN/,/MALLOC_HEADERS_END/p' ${srcdir}/gc.c` ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$malloc_headers ++ typedef char conftest_page[PAGE_SIZE]; ++ ]], [[]])], ++ [rb_cv_const_page_size=yes], ++ [rb_cv_const_page_size=no])]) ++]) ++AS_IF([test "x$rb_cv_const_page_size" = xyes], ++ [AC_DEFINE(HAVE_CONST_PAGE_SIZE, 1)], ++ [AC_DEFINE(HAVE_CONST_PAGE_SIZE, 0)] ++) + } + + : "runtime section" && { +diff --git a/gc.c b/gc.c +index f6acf3e117..6f8e5f242d 100644 +--- a/gc.c ++++ b/gc.c +@@ -32,6 +32,7 @@ + #include + #include + ++/* MALLOC_HEADERS_BEGIN */ + #ifndef HAVE_MALLOC_USABLE_SIZE + # ifdef _WIN32 + # define HAVE_MALLOC_USABLE_SIZE +@@ -54,6 +55,12 @@ + # endif + #endif + ++#if !defined(PAGE_SIZE) && defined(HAVE_SYS_USER_H) ++/* LIST_HEAD conflicts with sys/queue.h on macOS */ ++# include ++#endif ++/* MALLOC_HEADERS_END */ ++ + #ifdef HAVE_SYS_TIME_H + # include + #endif +@@ -821,6 +828,25 @@ enum { + HEAP_PAGE_BITMAP_SIZE = (BITS_SIZE * HEAP_PAGE_BITMAP_LIMIT), + HEAP_PAGE_BITMAP_PLANES = 4 /* RGENGC: mark, unprotected, uncollectible, marking */ + }; ++#define HEAP_PAGE_ALIGN (1 << HEAP_PAGE_ALIGN_LOG) ++#define HEAP_PAGE_SIZE HEAP_PAGE_ALIGN ++ ++#ifdef HAVE_MMAP ++# if HAVE_CONST_PAGE_SIZE ++/* If we have the HEAP_PAGE and it is a constant, then we can directly use it. */ ++static const bool USE_MMAP_ALIGNED_ALLOC = (PAGE_SIZE <= HEAP_PAGE_SIZE); ++# elif defined(PAGE_MAX_SIZE) && (PAGE_MAX_SIZE <= HEAP_PAGE_SIZE) ++/* PAGE_SIZE <= HEAP_PAGE_SIZE */ ++static const bool USE_MMAP_ALIGNED_ALLOC = true; ++# else ++/* Otherwise, fall back to determining if we can use mmap during runtime. */ ++# define USE_MMAP_ALIGNED_ALLOC (use_mmap_aligned_alloc != false) ++ ++static bool use_mmap_aligned_alloc; ++# endif ++#elif !defined(__MINGW32__) && !defined(_WIN32) ++static const bool USE_MMAP_ALIGNED_ALLOC = false; ++#endif + + struct heap_page { + short total_slots; +@@ -1760,14 +1786,14 @@ heap_unlink_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *pag + heap->total_slots -= page->total_slots; + } + +-static void rb_aligned_free(void *ptr); ++static void rb_aligned_free(void *ptr, size_t size); + + static void + heap_page_free(rb_objspace_t *objspace, struct heap_page *page) + { + heap_allocated_pages--; + objspace->profile.total_freed_pages++; +- rb_aligned_free(GET_PAGE_BODY(page->start)); ++ rb_aligned_free(GET_PAGE_BODY(page->start), HEAP_PAGE_SIZE); + free(page); + } + +@@ -1819,7 +1845,7 @@ heap_page_allocate(rb_objspace_t *objspace) + /* assign heap_page entry */ + page = calloc1(sizeof(struct heap_page)); + if (page == 0) { +- rb_aligned_free(page_body); ++ rb_aligned_free(page_body, HEAP_PAGE_SIZE); + rb_memerror(); + } + +@@ -3159,15 +3185,18 @@ Init_heap(void) + { + rb_objspace_t *objspace = &rb_objspace; + +-#if defined(HAVE_SYSCONF) && defined(_SC_PAGE_SIZE) +- /* If Ruby's heap pages are not a multiple of the system page size, we +- * cannot use mprotect for the read barrier, so we must disable automatic +- * compaction. */ +- int pagesize; +- pagesize = (int)sysconf(_SC_PAGE_SIZE); +- if ((HEAP_PAGE_SIZE % pagesize) != 0) { +- ruby_enable_autocompact = 0; +- } ++#if defined(HAVE_MMAP) && !HAVE_CONST_PAGE_SIZE && !defined(PAGE_MAX_SIZE) ++ /* Need to determine if we can use mmap at runtime. */ ++# ifdef PAGE_SIZE ++ /* If the PAGE_SIZE macro can be used. */ ++ use_mmap_aligned_alloc = PAGE_SIZE <= HEAP_PAGE_SIZE; ++# elif defined(HAVE_SYSCONF) && defined(_SC_PAGE_SIZE) ++ /* If we can use sysconf to determine the page size. */ ++ use_mmap_aligned_alloc = sysconf(_SC_PAGE_SIZE) <= HEAP_PAGE_SIZE; ++# else ++ /* Otherwise we can't determine the system page size, so don't use mmap. */ ++ use_mmap_aligned_alloc = FALSE; ++# endif + #endif + + objspace->next_object_id = INT2FIX(OBJ_ID_INITIAL); +@@ -8533,6 +8562,14 @@ gc_start_internal(rb_execution_context_t *ec, VALUE self, VALUE full_mark, VALUE + + /* For now, compact implies full mark / sweep, so ignore other flags */ + if (RTEST(compact)) { ++ /* If not MinGW, Windows, or does not have mmap, we cannot use mprotect for ++ * the read barrier, so we must disable compaction. */ ++#if !defined(__MINGW32__) && !defined(_WIN32) ++ if (!USE_MMAP_ALIGNED_ALLOC) { ++ rb_raise(rb_eNotImpError, "Compaction isn't available on this platform"); ++ } ++#endif ++ + reason |= GPR_FLAG_COMPACT; + } else { + if (!RTEST(full_mark)) reason &= ~GPR_FLAG_FULL_MARK; +@@ -9944,16 +9981,14 @@ gc_disable(rb_execution_context_t *ec, VALUE _) + static VALUE + gc_set_auto_compact(rb_execution_context_t *ec, VALUE _, VALUE v) + { +-#if defined(HAVE_SYSCONF) && defined(_SC_PAGE_SIZE) +- /* If Ruby's heap pages are not a multiple of the system page size, we +- * cannot use mprotect for the read barrier, so we must disable automatic +- * compaction. */ +- int pagesize; +- pagesize = (int)sysconf(_SC_PAGE_SIZE); +- if ((HEAP_PAGE_SIZE % pagesize) != 0) { ++ /* If not MinGW, Windows, or does not have mmap, we cannot use mprotect for ++ * the read barrier, so we must disable automatic compaction. */ ++#if !defined(__MINGW32__) && !defined(_WIN32) ++ if (!USE_MMAP_ALIGNED_ALLOC) { + rb_raise(rb_eNotImpError, "Automatic compaction isn't available on this platform"); + } + #endif ++ + ruby_enable_autocompact = RTEST(v); + return v; + } +@@ -10350,22 +10385,54 @@ rb_aligned_malloc(size_t alignment, size_t size) + #elif defined _WIN32 + void *_aligned_malloc(size_t, size_t); + res = _aligned_malloc(size, alignment); +-#elif defined(HAVE_POSIX_MEMALIGN) +- if (posix_memalign(&res, alignment, size) == 0) { +- return res; ++#else ++ if (USE_MMAP_ALIGNED_ALLOC) { ++ GC_ASSERT(alignment % sysconf(_SC_PAGE_SIZE) == 0); ++ ++ char *ptr = mmap(NULL, alignment + size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); ++ if (ptr == MAP_FAILED) { ++ return NULL; ++ } ++ ++ char *aligned = ptr + alignment; ++ aligned -= ((VALUE)aligned & (alignment - 1)); ++ GC_ASSERT(aligned > ptr); ++ GC_ASSERT(aligned <= ptr + alignment); ++ ++ size_t start_out_of_range_size = aligned - ptr; ++ GC_ASSERT(start_out_of_range_size % sysconf(_SC_PAGE_SIZE) == 0); ++ if (start_out_of_range_size > 0) { ++ if (munmap(ptr, start_out_of_range_size)) { ++ rb_bug("rb_aligned_malloc: munmap failed for start"); ++ } ++ } ++ ++ size_t end_out_of_range_size = alignment - start_out_of_range_size; ++ GC_ASSERT(end_out_of_range_size % sysconf(_SC_PAGE_SIZE) == 0); ++ if (end_out_of_range_size > 0) { ++ if (munmap(aligned + size, end_out_of_range_size)) { ++ rb_bug("rb_aligned_malloc: munmap failed for end"); ++ } ++ } ++ ++ res = (void *)aligned; + } + else { +- return NULL; ++# if defined(HAVE_POSIX_MEMALIGN) ++ if (posix_memalign(&res, alignment, size) != 0) { ++ return NULL; ++ } ++# elif defined(HAVE_MEMALIGN) ++ res = memalign(alignment, size); ++# else ++ char* aligned; ++ res = malloc(alignment + size + sizeof(void*)); ++ aligned = (char*)res + alignment + sizeof(void*); ++ aligned -= ((VALUE)aligned & (alignment - 1)); ++ ((void**)aligned)[-1] = res; ++ res = (void*)aligned; ++# endif + } +-#elif defined(HAVE_MEMALIGN) +- res = memalign(alignment, size); +-#else +- char* aligned; +- res = malloc(alignment + size + sizeof(void*)); +- aligned = (char*)res + alignment + sizeof(void*); +- aligned -= ((VALUE)aligned & (alignment - 1)); +- ((void**)aligned)[-1] = res; +- res = (void*)aligned; + #endif + + /* alignment must be a power of 2 */ +@@ -10375,16 +10442,26 @@ rb_aligned_malloc(size_t alignment, size_t size) + } + + static void +-rb_aligned_free(void *ptr) ++rb_aligned_free(void *ptr, size_t size) + { + #if defined __MINGW32__ + __mingw_aligned_free(ptr); + #elif defined _WIN32 + _aligned_free(ptr); +-#elif defined(HAVE_MEMALIGN) || defined(HAVE_POSIX_MEMALIGN) +- free(ptr); + #else +- free(((void**)ptr)[-1]); ++ if (USE_MMAP_ALIGNED_ALLOC) { ++ GC_ASSERT(size % sysconf(_SC_PAGE_SIZE) == 0); ++ if (munmap(ptr, size)) { ++ rb_bug("rb_aligned_free: munmap failed"); ++ } ++ } ++ else { ++# if defined(HAVE_POSIX_MEMALIGN) || defined(HAVE_MEMALIGN) ++ free(ptr); ++# else ++ free(((void**)ptr)[-1]); ++# endif ++ } + #endif + } + +diff --git a/test/ruby/test_gc_compact.rb b/test/ruby/test_gc_compact.rb +index 4a8cff33f4..f5cab55ba7 100644 +--- a/test/ruby/test_gc_compact.rb ++++ b/test/ruby/test_gc_compact.rb +@@ -4,12 +4,32 @@ + require 'etc' + + class TestGCCompact < Test::Unit::TestCase +- class AutoCompact < Test::Unit::TestCase ++ module SupportsCompact + def setup + skip "autocompact not supported on this platform" unless supports_auto_compact? + super + end + ++ private ++ ++ def supports_auto_compact? ++ return true unless defined?(Etc::SC_PAGE_SIZE) ++ ++ begin ++ return GC::INTERNAL_CONSTANTS[:HEAP_PAGE_SIZE] % Etc.sysconf(Etc::SC_PAGE_SIZE) == 0 ++ rescue NotImplementedError ++ rescue ArgumentError ++ end ++ ++ true ++ end ++ end ++ ++ include SupportsCompact ++ ++ class AutoCompact < Test::Unit::TestCase ++ include SupportsCompact ++ + def test_enable_autocompact + before = GC.auto_compact + GC.auto_compact = true +@@ -59,26 +79,17 @@ def test_implicit_compaction_does_something + ensure + GC.auto_compact = before + end +- +- private +- +- def supports_auto_compact? +- return true unless defined?(Etc::SC_PAGE_SIZE) +- +- begin +- return GC::INTERNAL_CONSTANTS[:HEAP_PAGE_SIZE] % Etc.sysconf(Etc::SC_PAGE_SIZE) == 0 +- rescue NotImplementedError +- rescue ArgumentError +- end +- +- true +- end + end + + def os_page_size + return true unless defined?(Etc::SC_PAGE_SIZE) + end + ++ def setup ++ skip "autocompact not supported on this platform" unless supports_auto_compact? ++ super ++ end ++ + def test_gc_compact_stats + list = [] + +-- +2.30.1 (Apple Git-130) + diff --git a/ruby.spec b/ruby.spec index 7077d07..de0a07b 100644 --- a/ruby.spec +++ b/ruby.spec @@ -153,6 +153,11 @@ Patch15: ruby-dwarf5-avoid_crash-r1.patch # Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add. # https://bugs.ruby-lang.org/issues/16492 Patch19: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch +# Fix /test_\(ast_compacts\|compact_count\|complex_hash_keys\|gc_compact_stats\)/ +# test failures on ppc64le. +# https://bugs.ruby-lang.org/issues/18746 +# https://bugs.ruby-lang.org/issues/18394 +Patch20: ruby-3.1.0-Use-mmap-for-allocating-heap-pages-in-the-GC.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} Suggests: rubypick @@ -599,6 +604,7 @@ rm -rf ext/fiddle/libffi* %patch9 -p1 %patch15 -p1 %patch19 -p1 +%patch20 -p1 # Provide an example of usage of the tapset: cp -a %{SOURCE3} . @@ -874,12 +880,6 @@ make runruby TESTRUN_SCRIPT="--enable-gems %{SOURCE13}" DISABLE_TESTS="" MSPECOPTS="" -%ifarch ppc64le -# `Couldn't unprotect page` error. -# https://bugs.ruby-lang.org/issues/18746 -DISABLE_TESTS="$DISABLE_TESTS -n !/test_\(ast_compacts\|compact_count\|complex_hash_keys\|gc_compact_stats\)/" -%endif - # Avoid `hostname' dependency. %{!?with_hostname:MSPECOPTS="-P 'Socket.gethostname returns the host name'"} From 92097615b26eeef9175cd0dab322c97e25621658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Fri, 10 Dec 2021 17:05:02 +0100 Subject: [PATCH 3/8] Fix loading of default gems. Resolves: rhbz#2027099 --- ruby.spec | 13 +- ...ng_system-rb-customizations-too-late.patch | 262 ++++++++++++++++++ 2 files changed, 273 insertions(+), 2 deletions(-) create mode 100644 rubygems-3.2.33-Fix-loading-operating_system-rb-customizations-too-late.patch diff --git a/ruby.spec b/ruby.spec index de0a07b..18f5355 100644 --- a/ruby.spec +++ b/ruby.spec @@ -22,7 +22,7 @@ %endif -%global release 152 +%global release 153 %{!?release_string:%define release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} # The RubyGems library has to stay out of Ruby directory tree, since the @@ -158,6 +158,10 @@ Patch19: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch # https://bugs.ruby-lang.org/issues/18746 # https://bugs.ruby-lang.org/issues/18394 Patch20: ruby-3.1.0-Use-mmap-for-allocating-heap-pages-in-the-GC.patch +# Fix loading of default gems. +# https://bugzilla.redhat.com/show_bug.cgi?id=2027099 +# https://github.com/rubygems/rubygems/pull/5154 +Patch22: rubygems-3.2.33-Fix-loading-operating_system-rb-customizations-too-late.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} Suggests: rubypick @@ -605,6 +609,7 @@ rm -rf ext/fiddle/libffi* %patch15 -p1 %patch19 -p1 %patch20 -p1 +%patch22 -p1 # Provide an example of usage of the tapset: cp -a %{SOURCE3} . @@ -1360,7 +1365,11 @@ MSPECOPTS="" %changelog -* Tue Apr 19 2022 Vít Ondruch - 3.0.2-152 +* Wed Apr 27 2022 Vít Ondruch - 3.0.4-153 +- Fix loading of default gems. + Resolves: rhbz#2027099 + +* Tue Apr 19 2022 Vít Ondruch - 3.0.4-152 - Upgrade to Ruby 3.0.4. * Fri Jul 23 2021 Fedora Release Engineering diff --git a/rubygems-3.2.33-Fix-loading-operating_system-rb-customizations-too-late.patch b/rubygems-3.2.33-Fix-loading-operating_system-rb-customizations-too-late.patch new file mode 100644 index 0000000..d61020d --- /dev/null +++ b/rubygems-3.2.33-Fix-loading-operating_system-rb-customizations-too-late.patch @@ -0,0 +1,262 @@ +From e80e7a3d0b3d72f7af7286b935702b3fab117008 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?David=20Rodr=C3=ADguez?= +Date: Wed, 8 Dec 2021 21:12:24 +0100 +Subject: [PATCH 1/5] More explicit require + +This class does not use `rubygems/deprecate`. It uses +`rubygems/version`, which in turn uses `rubygems/deprecate`. Make this +explicit. +--- + lib/rubygems/requirement.rb | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb +index d2e28fab5b4..9edd6aa7d3c 100644 +--- a/lib/rubygems/requirement.rb ++++ b/lib/rubygems/requirement.rb +@@ -1,5 +1,5 @@ + # frozen_string_literal: true +-require_relative "deprecate" ++require_relative "version" + + ## + # A Requirement is a set of one or more version restrictions. It supports a + +From 4e46dcc17ee5cabbde43b8a34063b8ab042536f9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?David=20Rodr=C3=ADguez?= +Date: Wed, 8 Dec 2021 21:17:30 +0100 +Subject: [PATCH 2/5] Remove ineffective autoloads + +These files are loaded on startup unconditionally, so we can require +them relatively when needed. +--- + lib/rubygems.rb | 4 +--- + lib/rubygems/specification.rb | 2 ++ + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/rubygems.rb b/lib/rubygems.rb +index f803e47628e..b8747409304 100644 +--- a/lib/rubygems.rb ++++ b/lib/rubygems.rb +@@ -1310,19 +1310,17 @@ def default_gem_load_paths + autoload :Licenses, File.expand_path('rubygems/util/licenses', __dir__) + autoload :NameTuple, File.expand_path('rubygems/name_tuple', __dir__) + autoload :PathSupport, File.expand_path('rubygems/path_support', __dir__) +- autoload :Platform, File.expand_path('rubygems/platform', __dir__) + autoload :RequestSet, File.expand_path('rubygems/request_set', __dir__) +- autoload :Requirement, File.expand_path('rubygems/requirement', __dir__) + autoload :Resolver, File.expand_path('rubygems/resolver', __dir__) + autoload :Source, File.expand_path('rubygems/source', __dir__) + autoload :SourceList, File.expand_path('rubygems/source_list', __dir__) + autoload :SpecFetcher, File.expand_path('rubygems/spec_fetcher', __dir__) +- autoload :Specification, File.expand_path('rubygems/specification', __dir__) + autoload :Util, File.expand_path('rubygems/util', __dir__) + autoload :Version, File.expand_path('rubygems/version', __dir__) + end + + require_relative 'rubygems/exceptions' ++require_relative 'rubygems/specification' + + # REFACTOR: This should be pulled out into some kind of hacks file. + begin +diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb +index d3b96491a28..dc5e5ba0138 100644 +--- a/lib/rubygems/specification.rb ++++ b/lib/rubygems/specification.rb +@@ -9,6 +9,8 @@ + require_relative 'deprecate' + require_relative 'basic_specification' + require_relative 'stub_specification' ++require_relative 'platform' ++require_relative 'requirement' + require_relative 'specification_policy' + require_relative 'util/list' + + +From 96b6b3e04e8e4fec17f63079a0caf999a2709d71 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?David=20Rodr=C3=ADguez?= +Date: Wed, 8 Dec 2021 21:45:16 +0100 +Subject: [PATCH 3/5] Load `operating_system.rb` customizations before setting + up default gems + +It's very common for packagers to configure gem paths in this file, for +example, `Gem.default_dir`. Also, setting up default gems requires these +paths to be set, so that we know which default gems need to be setup. + +If we setup default gems before loading `operatin_system.rb` +customizations, the wrong default gems will be setup. + +Unfortunately, default gems loaded by `operating_system.rb` can't be +upgraded if we do this, but it seems much of a smaller issue. I wasn't +even fully sure it was the right thing to do when I added that, and it +was not the culprit of the end user issue that led to making that +change. +--- + .github/workflows/install-rubygems.yml | 5 ---- + lib/rubygems.rb | 32 +++++++++++++------------- + test/rubygems/test_rubygems.rb | 23 ++++++++++++++++++ + 3 files changed, 39 insertions(+), 21 deletions(-) + +diff --git a/lib/rubygems.rb b/lib/rubygems.rb +index b8747409304..11474b6554c 100644 +--- a/lib/rubygems.rb ++++ b/lib/rubygems.rb +@@ -1323,22 +1323,6 @@ def default_gem_load_paths + require_relative 'rubygems/specification' + + # REFACTOR: This should be pulled out into some kind of hacks file. +-begin +- ## +- # Defaults the Ruby implementation wants to provide for RubyGems +- +- require "rubygems/defaults/#{RUBY_ENGINE}" +-rescue LoadError +-end +- +-## +-# Loads the default specs. +-Gem::Specification.load_defaults +- +-require_relative 'rubygems/core_ext/kernel_gem' +-require_relative 'rubygems/core_ext/kernel_require' +-require_relative 'rubygems/core_ext/kernel_warn' +- + begin + ## + # Defaults the operating system (or packager) wants to provide for RubyGems. +@@ -1354,3 +1338,19 @@ def default_gem_load_paths + "the problem and ask for help." + raise e.class, msg + end ++ ++begin ++ ## ++ # Defaults the Ruby implementation wants to provide for RubyGems ++ ++ require "rubygems/defaults/#{RUBY_ENGINE}" ++rescue LoadError ++end ++ ++## ++# Loads the default specs. ++Gem::Specification.load_defaults ++ ++require_relative 'rubygems/core_ext/kernel_gem' ++require_relative 'rubygems/core_ext/kernel_require' ++require_relative 'rubygems/core_ext/kernel_warn' +diff --git a/test/rubygems/test_rubygems.rb b/test/rubygems/test_rubygems.rb +index 493b9fdf4a3..fa77a299322 100644 +--- a/test/rubygems/test_rubygems.rb ++++ b/test/rubygems/test_rubygems.rb +@@ -22,6 +22,29 @@ def test_operating_system_other_exceptions + "the problem and ask for help." + end + ++ def test_operating_system_customizing_default_dir ++ pend "does not apply to truffleruby" if RUBY_ENGINE == 'truffleruby' ++ pend "loads a custom defaults/jruby file that gets in the middle" if RUBY_ENGINE == 'jruby' ++ ++ # On a non existing default dir, there should be no gems ++ ++ path = util_install_operating_system_rb <<-RUBY ++ module Gem ++ def self.default_dir ++ File.expand_path("foo") ++ end ++ end ++ RUBY ++ ++ output = Gem::Util.popen( ++ *ruby_with_rubygems_and_fake_operating_system_in_load_path(path), ++ '-e', ++ "require \"rubygems\"; puts Gem::Specification.stubs.map(&:full_name)", ++ {:err => [:child, :out]} ++ ).strip ++ assert_empty output ++ end ++ + private + + def util_install_operating_system_rb(content) + +From 52cfdd14fd1213a97aac12f01177e27779de9035 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?David=20Rodr=C3=ADguez?= +Date: Thu, 9 Dec 2021 06:08:31 +0100 +Subject: [PATCH 4/5] Install default fiddle on latest ruby on specs that need + it + +Otherwise first OS customizations load and activate that fiddle version, +but then when we change to `Gem.default_dir`, that fiddle version is no +longer there. +--- + bundler/spec/commands/clean_spec.rb | 2 +- + bundler/spec/install/gems/standalone_spec.rb | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb +index ffaf22dbb32..65231b35fac 100644 +--- a/spec/bundler/commands/clean_spec.rb ++++ b/spec/bundler/commands/clean_spec.rb +@@ -638,7 +638,7 @@ def should_not_have_gems(*gems) + s.executables = "irb" + end + +- realworld_system_gems "fiddle --version 1.0.6", "tsort --version 0.1.0", "pathname --version 0.1.0", "set --version 1.0.1" ++ realworld_system_gems "fiddle --version 1.0.8", "tsort --version 0.1.0", "pathname --version 0.1.0", "set --version 1.0.1" + + install_gemfile <<-G + source "#{file_uri_for(gem_repo2)}" +diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb +index db16a1b0e13..faefda25f45 100644 +--- a/spec/bundler/install/gems/standalone_spec.rb ++++ b/spec/bundler/install/gems/standalone_spec.rb +@@ -113,7 +113,7 @@ + skip "does not work on rubygems versions where `--install_dir` doesn't respect --default" unless Gem::Installer.for_spec(loaded_gemspec, :install_dir => "/foo").default_spec_file == "/foo/specifications/default/bundler-#{Bundler::VERSION}.gemspec" # Since rubygems 3.2.0.rc.2 + skip "does not work on old rubies because the realworld gems that need to be installed don't support them" if RUBY_VERSION < "2.7.0" + +- realworld_system_gems "fiddle --version 1.0.6", "tsort --version 0.1.0" ++ realworld_system_gems "fiddle --version 1.0.8", "tsort --version 0.1.0" + + necessary_system_gems = ["optparse --version 0.1.1", "psych --version 3.3.2", "yaml --version 0.1.1", "logger --version 1.4.3", "etc --version 1.2.0", "stringio --version 3.0.0"] + necessary_system_gems += ["shellwords --version 0.1.0", "base64 --version 0.1.0", "resolv --version 0.2.1"] if Gem.rubygems_version < Gem::Version.new("3.3.3.a") + +From c6a9c81021092c9157f5616a2bbe1323411a5bf8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?David=20Rodr=C3=ADguez?= +Date: Thu, 9 Dec 2021 12:46:23 +0100 +Subject: [PATCH 5/5] Resolve symlinks in LOAD_PATH when activating + pre-required default gems + +Some double load issues were reported a while ago by OS packagers where +if a gem has been required before rubygems, and then after, rubygems +require would cause a double load. + +We avoid this issue by activating the corresponding gem if we detect +that a file in the default LOAD_PATH that belongs to a default gem has +already been required when rubygems registers default gems. + +However, the fix does not take into account that the default LOAD_PATH +could potentially include symlinks. This change fixes the same double +load issue described above but for situations where the default +LOAD_PATH includes symlinks. +--- + lib/rubygems.rb | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/lib/rubygems.rb b/lib/rubygems.rb +index 11474b6554c..b7dda38d522 100644 +--- a/lib/rubygems.rb ++++ b/lib/rubygems.rb +@@ -1293,7 +1293,12 @@ def already_loaded?(file) + end + + def default_gem_load_paths +- @default_gem_load_paths ||= $LOAD_PATH[load_path_insert_index..-1] ++ @default_gem_load_paths ||= $LOAD_PATH[load_path_insert_index..-1].map do |lp| ++ expanded = File.expand_path(lp) ++ next expanded unless File.exist?(expanded) ++ ++ File.realpath(expanded) ++ end + end + end + From 2526f5fe723f4508ab9a36e9b7f4070192cb01ef Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Fri, 4 Nov 2022 13:57:37 +0100 Subject: [PATCH 4/8] Fix tests with Europe/Amsterdam pre-1970 time on tzdata version 2022b. Resolves: rhbz#2120354 --- ruby-spec-Fix-tests-on-tzdata-2022b.patch | 40 +++++++++++++++++++++++ ruby.spec | 10 +++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 ruby-spec-Fix-tests-on-tzdata-2022b.patch diff --git a/ruby-spec-Fix-tests-on-tzdata-2022b.patch b/ruby-spec-Fix-tests-on-tzdata-2022b.patch new file mode 100644 index 0000000..19386d9 --- /dev/null +++ b/ruby-spec-Fix-tests-on-tzdata-2022b.patch @@ -0,0 +1,40 @@ +From 7e9ec8a20b0f7469b415283d2ec0c22087f8eb2b Mon Sep 17 00:00:00 2001 +From: Jun Aruga +Date: Wed, 24 Aug 2022 12:02:56 +0200 +Subject: [PATCH] Fix tests with Europe/Amsterdam pre-1970 time on tzdata + version 2022b. + +The Time Zone Database (tzdata) changed the pre-1970 timestamps in some zones +including Europe/Amsterdam on tzdata version 2022b or later. +See . + +The tzdata RPM package maintainer on Fedora project suggested changing the Ruby +test, because the change is intentional. +See . + +We use post-1970 time test data to simplify the test. +--- + core/time/shared/local.rb | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/spec/ruby/core/time/shared/local.rb b/spec/ruby/core/time/shared/local.rb +index 43f331c4c..c4aa7a7ea 100644 +--- a/spec/ruby/core/time/shared/local.rb ++++ b/spec/ruby/core/time/shared/local.rb +@@ -8,10 +8,10 @@ describe :time_local, shared: true do + + platform_is_not :windows do + describe "timezone changes" do +- it "correctly adjusts the timezone change to 'CEST' on 'Europe/Amsterdam'" do ++ it "correctly adjusts the timezone change to 'CET' on 'Europe/Amsterdam'" do + with_timezone("Europe/Amsterdam") do +- Time.send(@method, 1940, 5, 16).to_a.should == +- [0, 40, 1, 16, 5, 1940, 4, 137, true, "CEST"] ++ Time.send(@method, 1970, 5, 16).to_a.should == ++ [0, 0, 0, 16, 5, 1970, 6, 136, false, "CET"] + end + end + end +-- +2.36.1 + diff --git a/ruby.spec b/ruby.spec index 18f5355..386e39d 100644 --- a/ruby.spec +++ b/ruby.spec @@ -22,7 +22,7 @@ %endif -%global release 153 +%global release 154 %{!?release_string:%define release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} # The RubyGems library has to stay out of Ruby directory tree, since the @@ -162,6 +162,9 @@ Patch20: ruby-3.1.0-Use-mmap-for-allocating-heap-pages-in-the-GC.patch # https://bugzilla.redhat.com/show_bug.cgi?id=2027099 # https://github.com/rubygems/rubygems/pull/5154 Patch22: rubygems-3.2.33-Fix-loading-operating_system-rb-customizations-too-late.patch +# Fix tests with Europe/Amsterdam pre-1970 time on tzdata version 2022b. +# https://github.com/ruby/spec/pull/939 +Patch26: ruby-spec-Fix-tests-on-tzdata-2022b.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} Suggests: rubypick @@ -610,6 +613,7 @@ rm -rf ext/fiddle/libffi* %patch19 -p1 %patch20 -p1 %patch22 -p1 +%patch26 -p1 # Provide an example of usage of the tapset: cp -a %{SOURCE3} . @@ -1365,6 +1369,10 @@ MSPECOPTS="" %changelog +* Fri Nov 04 2022 Jun Aruga - 3.0.4-154 +- Fix tests with Europe/Amsterdam pre-1970 time on tzdata version 2022b. + Resolves: rhbz#2120354 + * Wed Apr 27 2022 Vít Ondruch - 3.0.4-153 - Fix loading of default gems. Resolves: rhbz#2027099 From a90e12d412b3ea51a043099afd0d142df650c1d9 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Thu, 3 Nov 2022 18:03:35 +0100 Subject: [PATCH 5/8] Bypass git submodule test failure on Git >= 2.38.1. --- ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch | 27 +++++++++++++++++++ ruby.spec | 5 ++++ 2 files changed, 32 insertions(+) create mode 100644 ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch diff --git a/ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch b/ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch new file mode 100644 index 0000000..73f9a02 --- /dev/null +++ b/ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch @@ -0,0 +1,27 @@ +From dae843f6b7502f921a7e66f39e3714a39d860181 Mon Sep 17 00:00:00 2001 +From: Hiroshi SHIBATA +Date: Wed, 19 Oct 2022 19:40:00 +0900 +Subject: [PATCH] Bypass git submodule add/update with git config + protocol.file.allow=always option. + +Co-authored-by: Nobuyoshi Nakada +--- + test/rubygems/test_gem_source_git.rb | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/test/rubygems/test_gem_source_git.rb b/test/rubygems/test_gem_source_git.rb +index 5702da05974b6..c3b324771fa4d 100644 +--- a/test/rubygems/test_gem_source_git.rb ++++ b/test/rubygems/test_gem_source_git.rb +@@ -63,6 +63,11 @@ def test_checkout_local_cached + end + + def test_checkout_submodules ++ # We need to allow to checkout submodules with file:// protocol ++ # CVE-2022-39253 ++ # https://lore.kernel.org/lkml/xmqq4jw1uku5.fsf@gitster.g/ ++ system(@git, *%W"config --global protocol.file.allow always") ++ + source = Gem::Source::Git.new @name, @repository, 'master', true + + git_gem 'b' diff --git a/ruby.spec b/ruby.spec index 386e39d..6414e20 100644 --- a/ruby.spec +++ b/ruby.spec @@ -165,6 +165,9 @@ Patch22: rubygems-3.2.33-Fix-loading-operating_system-rb-customizations-too-late # Fix tests with Europe/Amsterdam pre-1970 time on tzdata version 2022b. # https://github.com/ruby/spec/pull/939 Patch26: ruby-spec-Fix-tests-on-tzdata-2022b.patch +# Bypass git submodule test failure on Git >= 2.38.1. +# https://github.com/ruby/ruby/pull/6587 +Patch29: ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} Suggests: rubypick @@ -614,6 +617,7 @@ rm -rf ext/fiddle/libffi* %patch20 -p1 %patch22 -p1 %patch26 -p1 +%patch29 -p1 # Provide an example of usage of the tapset: cp -a %{SOURCE3} . @@ -1372,6 +1376,7 @@ MSPECOPTS="" * Fri Nov 04 2022 Jun Aruga - 3.0.4-154 - Fix tests with Europe/Amsterdam pre-1970 time on tzdata version 2022b. Resolves: rhbz#2120354 +- Bypass git submodule test failure on Git >= 2.38.1. * Wed Apr 27 2022 Vít Ondruch - 3.0.4-153 - Fix loading of default gems. From 11193feb5208e1d29e36ffa6fae7df74a65a7b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Wed, 30 Nov 2022 15:18:52 +0100 Subject: [PATCH 6/8] Upgrade to Ruby 3.0.5. --- ...2.1.0-Enable-configuration-of-archlibdir.patch | 2 +- ...icated-paths-when-empty-version-string-i.patch | 2 +- ruby-2.1.0-always-use-i386.patch | 2 +- ruby-2.1.0-custom-rubygems-location.patch | 4 ++-- ruby-2.3.0-ruby_version.patch | 6 +++--- ruby-2.7.0-Initialize-ABRT-hook.patch | 2 +- ruby-spec-Fix-tests-on-tzdata-2022b.patch | 10 +++++++++- ruby.spec | 15 +++++++-------- 8 files changed, 25 insertions(+), 18 deletions(-) diff --git a/ruby-2.1.0-Enable-configuration-of-archlibdir.patch b/ruby-2.1.0-Enable-configuration-of-archlibdir.patch index 32806da..613b98f 100644 --- a/ruby-2.1.0-Enable-configuration-of-archlibdir.patch +++ b/ruby-2.1.0-Enable-configuration-of-archlibdir.patch @@ -11,7 +11,7 @@ diff --git a/configure.ac b/configure.ac index d261ea57b5..3c13076b82 100644 --- a/configure.ac +++ b/configure.ac -@@ -3240,6 +3240,11 @@ AS_IF([test ${multiarch+set}], [ +@@ -3259,6 +3259,11 @@ AS_IF([test ${multiarch+set}], [ ]) archlibdir='${libdir}/${arch}' diff --git a/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch b/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch index 437d09f..12788d0 100644 --- a/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch +++ b/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch @@ -14,7 +14,7 @@ diff --git a/configure.ac b/configure.ac index c42436c23d..d261ea57b5 100644 --- a/configure.ac +++ b/configure.ac -@@ -3886,7 +3886,8 @@ AS_CASE(["$ruby_version_dir_name"], +@@ -3905,7 +3905,8 @@ AS_CASE(["$ruby_version_dir_name"], ruby_version_dir=/'${ruby_version_dir_name}' if test -z "${ruby_version_dir_name}"; then diff --git a/ruby-2.1.0-always-use-i386.patch b/ruby-2.1.0-always-use-i386.patch index 46584d7..b69e1b2 100644 --- a/ruby-2.1.0-always-use-i386.patch +++ b/ruby-2.1.0-always-use-i386.patch @@ -11,7 +11,7 @@ diff --git a/configure.ac b/configure.ac index 3c13076b82..93af30321d 100644 --- a/configure.ac +++ b/configure.ac -@@ -3950,6 +3950,8 @@ AC_SUBST(vendorarchdir)dnl +@@ -3969,6 +3969,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 diff --git a/ruby-2.1.0-custom-rubygems-location.patch b/ruby-2.1.0-custom-rubygems-location.patch index 6946429..7992450 100644 --- a/ruby-2.1.0-custom-rubygems-location.patch +++ b/ruby-2.1.0-custom-rubygems-location.patch @@ -15,7 +15,7 @@ diff --git a/configure.ac b/configure.ac index 93af30321d..bc13397e0e 100644 --- a/configure.ac +++ b/configure.ac -@@ -3922,6 +3922,10 @@ AC_ARG_WITH(vendorarchdir, +@@ -3941,6 +3941,10 @@ AC_ARG_WITH(vendorarchdir, [vendorarchdir=$withval], [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}]) @@ -26,7 +26,7 @@ index 93af30321d..bc13397e0e 100644 AS_IF([test "${LOAD_RELATIVE+set}"], [ AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE) RUBY_EXEC_PREFIX='' -@@ -3946,6 +3950,7 @@ AC_SUBST(sitearchdir)dnl +@@ -3965,6 +3969,7 @@ AC_SUBST(sitearchdir)dnl AC_SUBST(vendordir)dnl AC_SUBST(vendorlibdir)dnl AC_SUBST(vendorarchdir)dnl diff --git a/ruby-2.3.0-ruby_version.patch b/ruby-2.3.0-ruby_version.patch index fd545e5..1ff2b63 100644 --- a/ruby-2.3.0-ruby_version.patch +++ b/ruby-2.3.0-ruby_version.patch @@ -20,7 +20,7 @@ diff --git a/configure.ac b/configure.ac index 80b137e380..63cd3b4f8b 100644 --- a/configure.ac +++ b/configure.ac -@@ -3837,9 +3837,6 @@ AS_CASE(["$target_os"], +@@ -3856,9 +3856,6 @@ AS_CASE(["$target_os"], rubyw_install_name='$(RUBYW_INSTALL_NAME)' ]) @@ -30,7 +30,7 @@ index 80b137e380..63cd3b4f8b 100644 rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'} AC_ARG_WITH(rubyarchprefix, AS_HELP_STRING([--with-rubyarchprefix=DIR], -@@ -3862,56 +3859,62 @@ AC_ARG_WITH(ridir, +@@ -3881,56 +3878,62 @@ AC_ARG_WITH(ridir, AC_SUBST(ridir) AC_SUBST(RI_BASE_NAME) @@ -120,7 +120,7 @@ index 80b137e380..63cd3b4f8b 100644 AS_IF([test "${LOAD_RELATIVE+set}"], [ AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE) -@@ -3928,6 +3931,7 @@ AC_SUBST(sitearchincludedir)dnl +@@ -3947,6 +3950,7 @@ AC_SUBST(sitearchincludedir)dnl AC_SUBST(arch)dnl AC_SUBST(sitearch)dnl AC_SUBST(ruby_version)dnl diff --git a/ruby-2.7.0-Initialize-ABRT-hook.patch b/ruby-2.7.0-Initialize-ABRT-hook.patch index 2b90d9e..975f55e 100644 --- a/ruby-2.7.0-Initialize-ABRT-hook.patch +++ b/ruby-2.7.0-Initialize-ABRT-hook.patch @@ -57,7 +57,7 @@ diff --git a/ruby.c b/ruby.c index 60c57d6259..1eec16f2c8 100644 --- a/ruby.c +++ b/ruby.c -@@ -1489,10 +1489,14 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt) +@@ -1501,10 +1501,14 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt) void Init_builtin_features(void); diff --git a/ruby-spec-Fix-tests-on-tzdata-2022b.patch b/ruby-spec-Fix-tests-on-tzdata-2022b.patch index 19386d9..bbf6bbf 100644 --- a/ruby-spec-Fix-tests-on-tzdata-2022b.patch +++ b/ruby-spec-Fix-tests-on-tzdata-2022b.patch @@ -21,8 +21,11 @@ diff --git a/spec/ruby/core/time/shared/local.rb b/spec/ruby/core/time/shared/lo index 43f331c4c..c4aa7a7ea 100644 --- a/spec/ruby/core/time/shared/local.rb +++ b/spec/ruby/core/time/shared/local.rb -@@ -8,10 +8,10 @@ describe :time_local, shared: true do +@@ -6,18 +6,16 @@ describe :time_local, shared: true do + end + end +-=begin platform_is_not :windows do describe "timezone changes" do - it "correctly adjusts the timezone change to 'CEST' on 'Europe/Amsterdam'" do @@ -35,6 +38,11 @@ index 43f331c4c..c4aa7a7ea 100644 end end end + end +-=end + end + + describe :time_local_10_arg, shared: true do -- 2.36.1 diff --git a/ruby.spec b/ruby.spec index 6414e20..e6fb677 100644 --- a/ruby.spec +++ b/ruby.spec @@ -1,6 +1,6 @@ %global major_version 3 %global minor_version 0 -%global teeny_version 4 +%global teeny_version 5 %global major_minor_version %{major_version}.%{minor_version} %global ruby_version %{major_minor_version}.%{teeny_version} @@ -22,7 +22,7 @@ %endif -%global release 154 +%global release 155 %{!?release_string:%define release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} # The RubyGems library has to stay out of Ruby directory tree, since the @@ -49,7 +49,7 @@ %global io_console_version 0.5.7 %global irb_version 1.3.5 %global json_version 2.5.1 -%global openssl_version 2.2.1 +%global openssl_version 2.2.2 %global psych_version 3.3.2 %global racc_version 1.5.2 %global rdoc_version 6.3.3 @@ -165,9 +165,6 @@ Patch22: rubygems-3.2.33-Fix-loading-operating_system-rb-customizations-too-late # Fix tests with Europe/Amsterdam pre-1970 time on tzdata version 2022b. # https://github.com/ruby/spec/pull/939 Patch26: ruby-spec-Fix-tests-on-tzdata-2022b.patch -# Bypass git submodule test failure on Git >= 2.38.1. -# https://github.com/ruby/ruby/pull/6587 -Patch29: ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} Suggests: rubypick @@ -617,7 +614,6 @@ rm -rf ext/fiddle/libffi* %patch20 -p1 %patch22 -p1 %patch26 -p1 -%patch29 -p1 # Provide an example of usage of the tapset: cp -a %{SOURCE3} . @@ -1157,7 +1153,7 @@ MSPECOPTS="" %{gem_dir}/specifications/default/abbrev-0.1.0.gemspec %{gem_dir}/specifications/default/base64-0.1.0.gemspec %{gem_dir}/specifications/default/benchmark-0.1.1.gemspec -%{gem_dir}/specifications/default/cgi-0.2.1.gemspec +%{gem_dir}/specifications/default/cgi-0.2.2.gemspec %{gem_dir}/specifications/default/csv-3.1.9.gemspec %{gem_dir}/specifications/default/date-3.1.3.gemspec %{gem_dir}/specifications/default/dbm-1.1.0.gemspec @@ -1373,6 +1369,9 @@ MSPECOPTS="" %changelog +* Wed Nov 30 2022 Vít Ondruch - 3.0.4-155 +- Upgrade to Ruby 3.0.5. + * Fri Nov 04 2022 Jun Aruga - 3.0.4-154 - Fix tests with Europe/Amsterdam pre-1970 time on tzdata version 2022b. Resolves: rhbz#2120354 From 58a1cac4f5057db48ace08ad3d18196d5852ffe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Wed, 30 Nov 2022 16:14:25 +0100 Subject: [PATCH 7/8] =?UTF-8?q?Import=20the=20Ruby=203.0.5=20sources=20?= =?UTF-8?q?=E2=98=9D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch | 27 ------------------- sources | 2 +- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch diff --git a/ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch b/ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch deleted file mode 100644 index 73f9a02..0000000 --- a/ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch +++ /dev/null @@ -1,27 +0,0 @@ -From dae843f6b7502f921a7e66f39e3714a39d860181 Mon Sep 17 00:00:00 2001 -From: Hiroshi SHIBATA -Date: Wed, 19 Oct 2022 19:40:00 +0900 -Subject: [PATCH] Bypass git submodule add/update with git config - protocol.file.allow=always option. - -Co-authored-by: Nobuyoshi Nakada ---- - test/rubygems/test_gem_source_git.rb | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/test/rubygems/test_gem_source_git.rb b/test/rubygems/test_gem_source_git.rb -index 5702da05974b6..c3b324771fa4d 100644 ---- a/test/rubygems/test_gem_source_git.rb -+++ b/test/rubygems/test_gem_source_git.rb -@@ -63,6 +63,11 @@ def test_checkout_local_cached - end - - def test_checkout_submodules -+ # We need to allow to checkout submodules with file:// protocol -+ # CVE-2022-39253 -+ # https://lore.kernel.org/lkml/xmqq4jw1uku5.fsf@gitster.g/ -+ system(@git, *%W"config --global protocol.file.allow always") -+ - source = Gem::Source::Git.new @name, @repository, 'master', true - - git_gem 'b' diff --git a/sources b/sources index acb6fbe..0a7bbee 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ruby-3.0.4.tar.xz) = 53bf7dd403b0c68af9691882ad8ed7422c8d1f496627428fb4c3caf0b0313715524b744c5f453aced2d49e16e55f3f45b46b9a77aa3097dbfcae7caa0208194b +SHA512 (ruby-3.0.5.tar.xz) = 1c69d18210a2156f7696c678a8d54bf05c4dc49a1401c1ecc5760b1c23fb6ac14053873a225564664d6a327cda274ce72f47d112a6ad8d378f978de4e507e9a0 From 7dd46efe6ccb37256a5ab40e6981b2d596d53454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Thu, 8 Dec 2022 13:12:40 +0100 Subject: [PATCH 8/8] Fix CGI causing issue with leading '.' in domain names. The original issue broke rubygem-actionpack: https://github.com/rails/rails/issues/46578 https://github.com/rails/rails/pull/46595 rubygem-rack: https://github.com/rack/rack/pull/1988 And rack-test (where I have not checked details). --- ...t_cgi_cookie_new_with_domain-to-pass.patch | 38 ++++++++++++++++ ...gi-Loosen-the-domain-regex-to-accept.patch | 44 +++++++++++++++++++ ruby.spec | 14 +++++- 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 ruby-3.2.0-ruby-cgi-Fix-test_cgi_cookie_new_with_domain-to-pass.patch create mode 100644 ruby-3.2.0-ruby-cgi-Loosen-the-domain-regex-to-accept.patch diff --git a/ruby-3.2.0-ruby-cgi-Fix-test_cgi_cookie_new_with_domain-to-pass.patch b/ruby-3.2.0-ruby-cgi-Fix-test_cgi_cookie_new_with_domain-to-pass.patch new file mode 100644 index 0000000..21579c5 --- /dev/null +++ b/ruby-3.2.0-ruby-cgi-Fix-test_cgi_cookie_new_with_domain-to-pass.patch @@ -0,0 +1,38 @@ +From 656f25987cf2885104d5b13c8d3f5b7d32f1b333 Mon Sep 17 00:00:00 2001 +From: Jean Boussier +Date: Wed, 23 Nov 2022 12:10:36 +0100 +Subject: [PATCH] [ruby/cgi] Fix test_cgi_cookie_new_with_domain to pass on + older rubies + +https://github.com/ruby/cgi/commit/05f0c58048 +--- + test/cgi/test_cgi_cookie.rb | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/test/cgi/test_cgi_cookie.rb b/test/cgi/test_cgi_cookie.rb +index e3ec4bea5286..6d31932d321a 100644 +--- a/test/cgi/test_cgi_cookie.rb ++++ b/test/cgi/test_cgi_cookie.rb +@@ -62,18 +62,18 @@ def test_cgi_cookie_new_complex + + def test_cgi_cookie_new_with_domain + h = {'name'=>'name1', 'value'=>'value1'} +- cookie = CGI::Cookie.new('domain'=>'a.example.com', **h) ++ cookie = CGI::Cookie.new(h.merge('domain'=>'a.example.com')) + assert_equal('a.example.com', cookie.domain) + +- cookie = CGI::Cookie.new('domain'=>'1.example.com', **h) ++ cookie = CGI::Cookie.new(h.merge('domain'=>'1.example.com')) + assert_equal('1.example.com', cookie.domain, 'enhanced by RFC 1123') + + assert_raise(ArgumentError) { +- CGI::Cookie.new('domain'=>'-a.example.com', **h) ++ CGI::Cookie.new(h.merge('domain'=>'-a.example.com')) + } + + assert_raise(ArgumentError) { +- CGI::Cookie.new('domain'=>'a-.example.com', **h) ++ CGI::Cookie.new(h.merge('domain'=>'a-.example.com')) + } + end + diff --git a/ruby-3.2.0-ruby-cgi-Loosen-the-domain-regex-to-accept.patch b/ruby-3.2.0-ruby-cgi-Loosen-the-domain-regex-to-accept.patch new file mode 100644 index 0000000..f217281 --- /dev/null +++ b/ruby-3.2.0-ruby-cgi-Loosen-the-domain-regex-to-accept.patch @@ -0,0 +1,44 @@ +From 745dcf5326ea2c8e2047a3bddeb0fbb7e7d07649 Mon Sep 17 00:00:00 2001 +From: Xenor Chang +Date: Mon, 28 Nov 2022 12:34:06 +0800 +Subject: [PATCH] [ruby/cgi] Loosen the domain regex to accept '.' + (https://github.com/ruby/cgi/pull/29) + +* Loosen the domain regex to accept '.' + +Co-authored-by: Nobuyoshi Nakada + +https://github.com/ruby/cgi/commit/5e09d632f3 +Co-authored-by: Hiroshi SHIBATA +--- + lib/cgi/cookie.rb | 2 +- + test/cgi/test_cgi_cookie.rb | 3 +++ + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/lib/cgi/cookie.rb b/lib/cgi/cookie.rb +index 1a9c1a82c123..9498e2f9faf9 100644 +--- a/lib/cgi/cookie.rb ++++ b/lib/cgi/cookie.rb +@@ -42,7 +42,7 @@ class Cookie < Array + + TOKEN_RE = %r"\A[[!-~]&&[^()<>@,;:\\\"/?=\[\]{}]]+\z" + PATH_VALUE_RE = %r"\A[[ -~]&&[^;]]*\z" +- DOMAIN_VALUE_RE = %r"\A(?