File thread_pthread.c-ruby_init_stack-ignore-STACK_END_ADDRESS.patch of Package ruby19

diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache -x .deps -x .libs -x Makefile -x Makefile.in ../orig-ruby-1.9.3-p362/thread_pthread.c ./thread_pthread.c
--- ../orig-ruby-1.9.3-p362/thread_pthread.c	2012-09-20 16:34:12.000000000 +0200
+++ ./thread_pthread.c	2013-02-08 13:19:46.609491143 +0100
@@ -593,6 +593,27 @@
 #endif
 	native_main_thread.stack_maxsize = size - space;
     }
+
+    /* If addr is out of range of main-thread stack range estimation,  */
+    /* it should be on co-routine (alternative stack). [Feature #2294] */
+    {
+	void *start, *end;
+
+	if (STACK_DIR_UPPER(1,0)) {
+	    start = native_main_thread.stack_start;
+	    end = (char *)native_main_thread.stack_start + native_main_thread.stack_maxsize;
+	}
+	else {
+	    start = (char *)native_main_thread.stack_start - native_main_thread.stack_maxsize;
+	    end = native_main_thread.stack_start;
+	}
+
+	if ((void *)addr < start || (void *)addr > end) {
+	    /* out of range */
+	    native_main_thread.stack_start = (VALUE *)addr;
+	    native_main_thread.stack_maxsize = 0; /* unknown */
+	}
+    }
 }
 
 #define CHECK_ERR(expr) \
openSUSE Build Service is sponsored by