ruby-changes:37183
From: naruse <ko1@a...>
Date: Fri, 16 Jan 2015 11:05:51 +0900 (JST)
Subject: [ruby-changes:37183] naruse:r49264 (ruby_2_2): merge revision(s) 49058: [Backport #10670]
naruse 2015-01-16 11:05:37 +0900 (Fri, 16 Jan 2015) New Revision: 49264 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49264 Log: merge revision(s) 49058: [Backport #10670] * re.c (unescape_nonascii): append excape sequence as-is not unescaped character, to get rid of unexpected meta-character. [ruby-core:67193] [Bug #10670] Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/ChangeLog branches/ruby_2_2/re.c branches/ruby_2_2/test/ruby/test_m17n.rb branches/ruby_2_2/version.h Index: ruby_2_2/re.c =================================================================== --- ruby_2_2/re.c (revision 49263) +++ ruby_2_2/re.c (revision 49264) @@ -2298,9 +2298,10 @@ unescape_nonascii(const char *p, const c https://github.com/ruby/ruby/blob/trunk/ruby_2_2/re.c#L2298 case 'M': /* \M-X, \M-\C-X, \M-\cX */ p = p-2; if (enc == rb_usascii_encoding()) { + const char *pbeg = p; c = read_escaped_byte(&p, end, err); if (c == (char)-1) return -1; - rb_str_buf_cat(buf, &c, 1); + rb_str_buf_cat(buf, pbeg, p-pbeg); } else { if (unescape_escaped_nonascii(&p, end, enc, buf, encp, err) != 0) Index: ruby_2_2/ChangeLog =================================================================== --- ruby_2_2/ChangeLog (revision 49263) +++ ruby_2_2/ChangeLog (revision 49264) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1 +Fri Jan 16 11:04:35 2015 Nobuyoshi Nakada <nobu@r...> + + * re.c (unescape_nonascii): append excape sequence as-is not + unescaped character, to get rid of unexpected meta-character. + [ruby-core:67193] [Bug #10670] + Sat Jan 3 21:17:58 2015 Nobuyoshi Nakada <nobu@r...> * thread.c (rb_thread_variable_get): fix dynamic symbol keys. Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 49263) +++ ruby_2_2/version.h (revision 49264) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.0" -#define RUBY_RELEASE_DATE "2015-01-03" -#define RUBY_PATCHLEVEL 6 +#define RUBY_RELEASE_DATE "2015-01-16" +#define RUBY_PATCHLEVEL 7 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 1 -#define RUBY_RELEASE_DAY 3 +#define RUBY_RELEASE_DAY 16 #include "ruby/version.h" Index: ruby_2_2/test/ruby/test_m17n.rb =================================================================== --- ruby_2_2/test/ruby/test_m17n.rb (revision 49263) +++ ruby_2_2/test/ruby/test_m17n.rb (revision 49264) @@ -1579,4 +1579,13 @@ class TestM17N < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_m17n.rb#L1579 assert_same(str, str.scrub!) assert_equal("\uFFFD\uFFFD\uFFFD", str) end + + def test_escaped_metachar + bug10670 = '[ruby-core:67193] [Bug #10670]' + + escape_plain = /\A[\x5B]*\z/.freeze + + assert_match(escape_plain, 0x5b.chr(::Encoding::UTF_8), bug10670) + assert_match(escape_plain, 0x5b.chr, bug10670) + end end Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r49058 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/