ruby-changes:30836
From: nagachika <ko1@a...>
Date: Thu, 12 Sep 2013 01:52:44 +0900 (JST)
Subject: [ruby-changes:30836] nagachika:r42915 (ruby_2_0_0): merge revision(s) 42820: [Backport #8856]
nagachika 2013-09-12 01:52:36 +0900 (Thu, 12 Sep 2013) New Revision: 42915 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42915 Log: merge revision(s) 42820: [Backport #8856] * string.c (str_gsub): use BEG(0) for whole matched position not return value from rb_reg_search(), for \K matching. [ruby-dev:47694] [Bug #8856] Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/string.c branches/ruby_2_0_0/test/ruby/test_regexp.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 42914) +++ ruby_2_0_0/ChangeLog (revision 42915) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Thu Sep 12 01:44:01 2013 Nobuyoshi Nakada <nobu@r...> + + * string.c (str_gsub): use BEG(0) for whole matched position not + return value from rb_reg_search(), for \K matching. + [ruby-dev:47694] [Bug #8856] + Thu Sep 12 01:34:07 2013 Charlie Somerville <charliesome@r...> * object.c (rb_class_inherited_p): allow iclasses to be tested for Index: ruby_2_0_0/string.c =================================================================== --- ruby_2_0_0/string.c (revision 42914) +++ ruby_2_0_0/string.c (revision 42915) @@ -3905,7 +3905,7 @@ str_gsub(int argc, VALUE *argv, VALUE st https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/string.c#L3905 if (OBJ_TAINTED(val)) tainted = 1; - len = beg - offset; /* copy pre-match substr */ + len = beg0 - offset; /* copy pre-match substr */ if (len) { rb_enc_str_buf_cat(dest, cp, len, str_enc); } Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 42914) +++ ruby_2_0_0/version.h (revision 42915) @@ -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-09-12" -#define RUBY_PATCHLEVEL 303 +#define RUBY_PATCHLEVEL 304 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 9 Index: ruby_2_0_0/test/ruby/test_regexp.rb =================================================================== --- ruby_2_0_0/test/ruby/test_regexp.rb (revision 42914) +++ ruby_2_0_0/test/ruby/test_regexp.rb (revision 42915) @@ -500,6 +500,12 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_regexp.rb#L500 assert_equal('foo[\z]baz', "foobarbaz".sub!(/(b..)/, '[\z]')) end + def test_regsub_K + bug8856 = '[ruby-dev:47694] [Bug #8856]' + result = "foobarbazquux/foobarbazquux".gsub(/foo\Kbar/, "") + assert_equal('foobazquux/foobazquux', result, bug8856) + end + def test_KCODE assert_nil($KCODE) assert_nothing_raised { $KCODE = nil } Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r42820 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/