ruby-changes:65760
From: usa <ko1@a...>
Date: Mon, 5 Apr 2021 07:44:33 +0900 (JST)
Subject: [ruby-changes:65760] b98aa3aaae (ruby_2_6): merge revision(s) 2f1895fa: [Backport #16767]
https://git.ruby-lang.org/ruby.git/commit/?id=b98aa3aaae From b98aa3aaaee29f86518cf3b70f3611bdc346ea17 Mon Sep 17 00:00:00 2001 From: usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> Date: Sun, 4 Apr 2021 22:44:23 +0000 Subject: merge revision(s) 2f1895fa: [Backport #16767] Fixed formatted substring expansion [Bug #16767] --- strftime.c | 2 ++ test/ruby/test_time.rb | 7 +++++++ 2 files changed, 9 insertions(+) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- strftime.c | 2 ++ test/ruby/test_time.rb | 7 +++++++ version.h | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) 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 2bd4bc8..6a55af1 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -851,6 +851,13 @@ class TestTime < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time.rb#L851 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 76a6117..395ec2a 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1 #define RUBY_VERSION "2.6.7" #define RUBY_RELEASE_DATE "2021-04-05" -#define RUBY_PATCHLEVEL 175 +#define RUBY_PATCHLEVEL 176 #define RUBY_RELEASE_YEAR 2021 #define RUBY_RELEASE_MONTH 4 -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/