summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-lang/ruby/files/3.3')
-rw-r--r--dev-lang/ruby/files/3.3/010-default-gem-location.patch11
-rw-r--r--dev-lang/ruby/files/3.3/901-musl-stacksize.patch20
-rw-r--r--dev-lang/ruby/files/3.3/902-hppa-pthread-stack-size.patch54
3 files changed, 85 insertions, 0 deletions
diff --git a/dev-lang/ruby/files/3.3/010-default-gem-location.patch b/dev-lang/ruby/files/3.3/010-default-gem-location.patch
new file mode 100644
index 000000000000..36009ad66f61
--- /dev/null
+++ b/dev-lang/ruby/files/3.3/010-default-gem-location.patch
@@ -0,0 +1,11 @@
+--- a/tool/rbinstall.rb 2022-11-13 08:12:27.373041649 +0100
++++ b/tool/rbinstall.rb 2022-11-13 08:16:09.110406705 +0100
+@@ -994,7 +994,7 @@
+ end
+
+ install?(:ext, :comm, :gem, :'bundled-gems') do
+- gem_dir = Gem.default_dir
++ gem_dir = ENV['GEM_DESTDIR']
+ install_dir = with_destdir(gem_dir)
+ prepare "bundled gems", gem_dir
+ RbInstall.no_write do
diff --git a/dev-lang/ruby/files/3.3/901-musl-stacksize.patch b/dev-lang/ruby/files/3.3/901-musl-stacksize.patch
new file mode 100644
index 000000000000..f18aa271ea65
--- /dev/null
+++ b/dev-lang/ruby/files/3.3/901-musl-stacksize.patch
@@ -0,0 +1,20 @@
+--- a/thread_pthread.c 2023-02-08 05:02:20.000000000 +0100
++++ b/thread_pthread.c 2023-03-10 17:46:25.694739053 +0100
+@@ -1033,7 +1033,7 @@
+ {
+ native_main_thread.id = pthread_self();
+
+-#if MAINSTACKADDR_AVAILABLE
++#if MAINSTACKADDR_AVAILABLE && !(defined(__linux__) && !defined(__GLIBC__))
+ if (native_main_thread.stack_maxsize) return;
+ {
+ void* stackaddr;
+@@ -2090,7 +2090,7 @@
+
+ #ifdef STACKADDR_AVAILABLE
+ if (get_stack(&base, &size) == 0) {
+-# ifdef __APPLE__
++# if defined(__APPLE__) || (defined(__linux__) && !defined(__GLIBC__))
+ if (pthread_equal(th->nt->thread_id, native_main_thread.id)) {
+ struct rlimit rlim;
+ if (getrlimit(RLIMIT_STACK, &rlim) == 0 && rlim.rlim_cur > size) {
diff --git a/dev-lang/ruby/files/3.3/902-hppa-pthread-stack-size.patch b/dev-lang/ruby/files/3.3/902-hppa-pthread-stack-size.patch
new file mode 100644
index 000000000000..96e24a340ad9
--- /dev/null
+++ b/dev-lang/ruby/files/3.3/902-hppa-pthread-stack-size.patch
@@ -0,0 +1,54 @@
+https://bugs.gentoo.org/701494
+
+From 40ccf3b91071d3603335b0b7095613ef1843f9e1 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Fri, 7 Apr 2023 11:46:12 +0100
+Subject: [PATCH] thread_pthread: Grow main_stack if required (fixes tests on
+ HPPA)
+
+On HPPA, test_insns.rb fails (along with various Ruby gems) with
+'stack level too deep (SystemStackError)'. This turns out to be because HPPA
+defaults to a small(er) stack.
+
+With this change, most of Ruby's test suite now passes on HPPA.
+
+Thanks to both Dave and Helge for the investigation and coming up with the
+patch.
+
+Bug: https://bugs.gentoo.org/701494
+Bug: https://bugs.debian.org/881773
+Bug: https://bugs.debian.org/881772 (for PPC64)
+Bug: https://github.com/rack/rack/issues/1640
+Thanks-to: John David Anglin <dave.anglin@bell.net>
+Thanks-to: Helge Deller <deller@gmx.de>
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/thread_pthread.c
++++ b/thread_pthread.c
+@@ -858,8 +858,22 @@ size_t pthread_get_stacksize_np(pthread_t);
+ # define MAINSTACKADDR_AVAILABLE 0
+ # endif
+ #endif
+-#if MAINSTACKADDR_AVAILABLE && !defined(get_main_stack)
+-# define get_main_stack(addr, size) get_stack(addr, size)
++#if MAINSTACKADDR_AVAILABLE
++static int get_stack(void **, size_t *);
++static int
++get_main_stack(void **addr, size_t *size)
++{
++ int ret = get_stack(addr, size);
++
++#ifdef __hppa__
++ /* On some architectures, the initial stack size may be too small, but fortunately,
++ it's growable. Bump it up to the minimum needed if it is too small. */
++ if (*size < RUBY_VM_THREAD_VM_STACK_SIZE)
++ *size = RUBY_VM_THREAD_VM_STACK_SIZE;
++#endif
++
++ return ret;
++}
+ #endif
+
+ #ifdef STACKADDR_AVAILABLE
+--
+2.40.0
+