ruby-changes:52393
From: nagachika <ko1@a...>
Date: Sat, 1 Sep 2018 11:03:30 +0900 (JST)
Subject: [ruby-changes:52393] nagachika:r64602 (ruby_2_5): merge revision(s) 63994: [Backport #14920]
nagachika 2018-09-01 11:03:24 +0900 (Sat, 01 Sep 2018) New Revision: 64602 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64602 Log: merge revision(s) 63994: [Backport #14920] reduce tzset * time.c (rb_localtime_r): call tzset() only after TZ environment variable is changed. Modified directories: branches/ruby_2_5/ Modified files: branches/ruby_2_5/hash.c branches/ruby_2_5/time.c branches/ruby_2_5/version.h Index: ruby_2_5/time.c =================================================================== --- ruby_2_5/time.c (revision 64601) +++ ruby_2_5/time.c (revision 64602) @@ -646,12 +646,18 @@ static struct vtm *localtimew(wideval_t https://github.com/ruby/ruby/blob/trunk/ruby_2_5/time.c#L646 static int leap_year_p(long y); #define leap_year_v_p(y) leap_year_p(NUM2LONG(modv((y), INT2FIX(400)))) +int ruby_tz_update; + static struct tm * rb_localtime_r(const time_t *t, struct tm *result) { #if defined __APPLE__ && defined __LP64__ if (*t != (time_t)(int)*t) return NULL; #endif + if (!ruby_tz_update) { + ruby_tz_update = 1; + tzset(); + } #ifdef HAVE_GMTIME_R result = localtime_r(t, result); #else @@ -677,7 +683,7 @@ rb_localtime_r(const time_t *t, struct t https://github.com/ruby/ruby/blob/trunk/ruby_2_5/time.c#L683 #endif return result; } -#define LOCALTIME(tm, result) (tzset(),rb_localtime_r((tm), &(result))) +#define LOCALTIME(tm, result) rb_localtime_r((tm), &(result)) #ifndef HAVE_STRUCT_TM_TM_GMTOFF static struct tm * Index: ruby_2_5/version.h =================================================================== --- ruby_2_5/version.h (revision 64601) +++ ruby_2_5/version.h (revision 64602) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_5/version.h#L1 #define RUBY_VERSION "2.5.2" -#define RUBY_RELEASE_DATE "2018-08-18" -#define RUBY_PATCHLEVEL 82 +#define RUBY_RELEASE_DATE "2018-09-01" +#define RUBY_PATCHLEVEL 83 #define RUBY_RELEASE_YEAR 2018 -#define RUBY_RELEASE_MONTH 8 -#define RUBY_RELEASE_DAY 18 +#define RUBY_RELEASE_MONTH 9 +#define RUBY_RELEASE_DAY 1 #include "ruby/version.h" Index: ruby_2_5/hash.c =================================================================== --- ruby_2_5/hash.c (revision 64601) +++ ruby_2_5/hash.c (revision 64602) @@ -3294,6 +3294,9 @@ env_str_new2(const char *ptr) https://github.com/ruby/ruby/blob/trunk/ruby_2_5/hash.c#L3294 static int env_path_tainted(const char *); +static const char TZ_ENV[] = "TZ"; +extern int ruby_tz_update; + static rb_encoding * env_encoding_for(const char *name, const char *ptr) { @@ -3375,6 +3378,9 @@ env_delete(VALUE obj, VALUE name) https://github.com/ruby/ruby/blob/trunk/ruby_2_5/hash.c#L3378 RB_GC_GUARD(name); path_tainted = 0; } + else if (ENVMATCH(nam, TZ_ENV)) { + ruby_tz_update = 0; + } return value; } return Qnil; @@ -3734,6 +3740,9 @@ env_aset(VALUE obj, VALUE nm, VALUE val) https://github.com/ruby/ruby/blob/trunk/ruby_2_5/hash.c#L3740 path_tainted_p(value); } } + else if (ENVMATCH(name, TZ_ENV)) { + ruby_tz_update = 0; + } return val; } Index: ruby_2_5 =================================================================== --- ruby_2_5 (revision 64601) +++ ruby_2_5 (revision 64602) Property changes on: ruby_2_5 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r63994 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/