ruby-changes:28510
From: nagachika <ko1@a...>
Date: Thu, 2 May 2013 23:40:41 +0900 (JST)
Subject: [ruby-changes:28510] nagachika:r40562 (ruby_2_0_0): merge revision(s) 39939: [Backport #8360]
nagachika 2013-05-02 23:40:29 +0900 (Thu, 02 May 2013) New Revision: 40562 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40562 Log: merge revision(s) 39939: [Backport #8360] * thread.c (double2timeval): convert the infinity to TIME_MAX to avoid SEGV by Thread.new {}.join(Float::INFINITY) on Debian GNU/Linux (amd64). Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/thread.c branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 40561) +++ ruby_2_0_0/ChangeLog (revision 40562) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Thu May 2 23:39:45 2013 Tanaka Akira <akr@f...> + + * thread.c (double2timeval): convert the infinity to TIME_MAX to avoid + SEGV by Thread.new {}.join(Float::INFINITY) on + Debian GNU/Linux (amd64). + Thu May 2 00:30:00 2013 Tanaka Akira <akr@f...> * thread_pthread.c (ruby_init_stack): Add STACK_GROW_DIR_DETECTION. Index: ruby_2_0_0/thread.c =================================================================== --- ruby_2_0_0/thread.c (revision 40561) +++ ruby_2_0_0/thread.c (revision 40562) @@ -73,6 +73,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/thread.c#L73 #define THREAD_DEBUG 0 #endif +#define TIMET_MAX (~(time_t)0 <= 0 ? (time_t)((~(unsigned_time_t)0) >> 1) : (time_t)(~(unsigned_time_t)0)) +#define TIMET_MIN (~(time_t)0 <= 0 ? (time_t)(((unsigned_time_t)1) << (sizeof(time_t) * CHAR_BIT - 1)) : (time_t)0) + VALUE rb_cMutex; VALUE rb_cThreadShield; @@ -916,6 +919,12 @@ double2timeval(double d) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/thread.c#L919 { struct timeval time; + if (isinf(d)) { + time.tv_sec = TIMET_MAX; + time.tv_usec = 0; + return time; + } + time.tv_sec = (int)d; time.tv_usec = (int)((d - (int)d) * 1e6); if (time.tv_usec < 0) { @@ -3509,9 +3518,6 @@ rb_thread_fd_select(int max, rb_fdset_t https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/thread.c#L3518 #define POLLOUT_SET (POLLWRBAND | POLLWRNORM | POLLOUT | POLLERR) #define POLLEX_SET (POLLPRI) -#define TIMET_MAX (~(time_t)0 <= 0 ? (time_t)((~(unsigned_time_t)0) >> 1) : (time_t)(~(unsigned_time_t)0)) -#define TIMET_MIN (~(time_t)0 <= 0 ? (time_t)(((unsigned_time_t)1) << (sizeof(time_t) * CHAR_BIT - 1)) : (time_t)0) - #ifndef HAVE_PPOLL /* TODO: don't ignore sigmask */ int Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 40561) +++ ruby_2_0_0/version.h (revision 40562) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-05-02" -#define RUBY_PATCHLEVEL 180 +#define RUBY_PATCHLEVEL 181 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 5 Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r39939 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/