ruby-changes:62391
From: nagachika <ko1@a...>
Date: Sat, 25 Jul 2020 11:56:48 +0900 (JST)
Subject: [ruby-changes:62391] 2e9626fddd (ruby_2_7): merge revision(s) 2f1895fa15386fb3cdc91c5604171290828b9da8: [Backport #16767]
https://git.ruby-lang.org/ruby.git/commit/?id=2e9626fddd From 2e9626fddd168bd12352b4f5dc3412c6a33ce44e Mon Sep 17 00:00:00 2001 From: nagachika <nagachika@r...> Date: Sat, 25 Jul 2020 11:56:28 +0900 Subject: merge revision(s) 2f1895fa15386fb3cdc91c5604171290828b9da8: [Backport #16767] Fixed formatted substring expansion [Bug #16767] diff --git a/strftime.c b/strftime.c index dd2b21f..446be7d 100644 --- a/strftime.c +++ b/strftime.c @@ -326,7 +326,9 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len, https://github.com/ruby/ruby/blob/trunk/strftime.c#L326 s += len; \ if (i > 0) case_conv(s, i, flags); \ if (precision > i) {\ + s += i; \ NEEDS(precision); \ + s -= i; \ memmove(s + precision - i, s, i);\ memset(s, padding ? padding : ' ', precision - i); \ s += precision; \ diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index 35e3172..ad8fe6c 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -885,6 +885,13 @@ class TestTime < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time.rb#L885 assert_equal(8192, Time.now.strftime('%8192z').size) end + def test_strftime_wide_precision + t2000 = get_t2000 + s = t2000.strftime("%28c") + assert_equal(28, s.size) + assert_equal(t2000.strftime("%c"), s.strip) + end + def test_strfimte_zoneoffset t2000 = get_t2000 t = t2000.getlocal("+09:00:00") diff --git a/version.h b/version.h index 269f278..d3dae72 100644 --- a/version.h +++ b/version.h @@ -2,11 +2,11 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L2 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 1 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 107 +#define RUBY_PATCHLEVEL 108 #define RUBY_RELEASE_YEAR 2020 #define RUBY_RELEASE_MONTH 7 -#define RUBY_RELEASE_DAY 23 +#define RUBY_RELEASE_DAY 25 #include "ruby/version.h" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/