ruby-changes:52112
From: nagachika <ko1@a...>
Date: Sun, 12 Aug 2018 20:51:07 +0900 (JST)
Subject: [ruby-changes:52112] nagachika:r64320 (ruby_2_5): merge revision(s) 63252: [Backport #14707]
nagachika 2018-08-12 20:51:02 +0900 (Sun, 12 Aug 2018) New Revision: 64320 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64320 Log: merge revision(s) 63252: [Backport #14707] string.c: fix scanned substring with `\K` * string.c (scan_once): fix the matched substring with `\K`, the beginning of that string may differ from the matched position. [ruby-core:86663] [Bug #14707] Modified directories: branches/ruby_2_5/ Modified files: branches/ruby_2_5/string.c branches/ruby_2_5/test/ruby/test_string.rb branches/ruby_2_5/version.h Index: ruby_2_5/test/ruby/test_string.rb =================================================================== --- ruby_2_5/test/ruby/test_string.rb (revision 64319) +++ ruby_2_5/test/ruby/test_string.rb (revision 64320) @@ -1537,6 +1537,8 @@ CODE https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/ruby/test_string.rb#L1537 assert_nil($~) assert_equal(3, S("hello hello hello").scan("hello".taint).count(&:tainted?)) + + assert_equal(%w[1 2 3], S("a1 a2 a3").scan(/a\K./)) end def test_size Index: ruby_2_5/version.h =================================================================== --- ruby_2_5/version.h (revision 64319) +++ ruby_2_5/version.h (revision 64320) @@ -1,6 +1,6 @@ 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-12" -#define RUBY_PATCHLEVEL 67 +#define RUBY_PATCHLEVEL 68 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_5/string.c =================================================================== --- ruby_2_5/string.c (revision 64319) +++ ruby_2_5/string.c (revision 64320) @@ -8950,6 +8950,7 @@ scan_once(VALUE str, VALUE pat, long *st https://github.com/ruby/ruby/blob/trunk/ruby_2_5/string.c#L8950 else { match = rb_backref_get(); regs = RMATCH_REGS(match); + pos = BEG(0); end = END(0); } if (pos == end) { Index: ruby_2_5 =================================================================== --- ruby_2_5 (revision 64319) +++ ruby_2_5 (revision 64320) Property changes on: ruby_2_5 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r63252 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/