On 2019-08-10 6:17 p.m., John David Anglin wrote: > I tend to think get_main_stack should be modified to > reflect that the main stack is growable. Possibly, the size obtained by > get_main_stack should > be modified based on the setting of one of the RUBY_THREAD_VM_STACK_SIZE > defines.
The attached patches fix the build of ruby2.5 on hppa: https://buildd.debian.org/status/fetch.php?pkg=ruby2.5&arch=hppa&ver=2.5.5-4%2Bb1&stamp=1565630907&raw=0 They might also fix build on kfreebsd-amd64 and kfreebsd-i386. The second patch is needed to fix timeout waiting for join in two tests: https://buildd.debian.org/status/fetch.php?pkg=ruby2.5&arch=hppa&ver=2.5.5-4%2Bb1&stamp=1565623940&raw=0 Fixing ruby2.5 fixes builds for ruby-ffi-yajl, ruby-json, and ruby-oj. Regards, Dave Anglin -- John David Anglin dave.ang...@bell.net
Index: ruby2.5-2.5.5/thread_pthread.c =================================================================== --- ruby2.5-2.5.5.orig/thread_pthread.c +++ ruby2.5-2.5.5/thread_pthread.c @@ -552,8 +552,17 @@ hpux_attr_getstackaddr(const pthread_att # 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) +{ + get_stack(addr, size); + + /* Since main stack is growable, it may be too small. */ + if (*size < RUBY_VM_THREAD_VM_STACK_SIZE) + *size = RUBY_VM_THREAD_VM_STACK_SIZE; +} #endif #ifdef STACKADDR_AVAILABLE @@ -573,6 +582,7 @@ get_stack(void **addr, size_t *size) # ifdef HAVE_PTHREAD_ATTR_GETSTACK CHECK_ERR(pthread_attr_getstack(&attr, addr, size)); STACK_DIR_UPPER((void)0, (void)(*addr = (char *)*addr + *size)); + *size *= 4; # else CHECK_ERR(pthread_attr_getstackaddr(&attr, addr)); CHECK_ERR(pthread_attr_getstacksize(&attr, size));
Index: ruby2.5-2.5.5/test/openssl/utils.rb =================================================================== --- ruby2.5-2.5.5.orig/test/openssl/utils.rb +++ ruby2.5-2.5.5/test/openssl/utils.rb @@ -266,8 +266,8 @@ class OpenSSL::SSLTestCase < OpenSSL::Te pend = nil threads.each { |th| begin - th.join(10) or - th.raise(RuntimeError, "[start_server] thread did not exit in 10 secs") + th.join(100) or + th.raise(RuntimeError, "[start_server] thread did not exit in 100 secs") rescue (defined?(MiniTest::Skip) ? MiniTest::Skip : Test::Unit::PendedError) # MiniTest::Skip is for the Ruby tree pend = $!