diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-06 18:07:04 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-06 18:07:04 +0000 |
commit | 6c0822f0f5e934f6197f5a1be577764a74b30c7f (patch) | |
tree | 97b7011c368acb0f5075248ccd89458d37065b40 | |
parent | 03e6d4eadbe402422505e1a0e0167de1f050c212 (diff) |
merge revision(s) 39858: [Backport #8135]
* parse.y (simple_re_meta): escape all closing characters, not only
round parenthesis. [ruby-core:53578] [Bug #8133]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@40169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 2 | ||||
-rw-r--r-- | test/ruby/test_regexp.rb | 12 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 16 insertions, 5 deletions
@@ -1,3 +1,8 @@ +Sun Apr 7 03:01:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * parse.y (simple_re_meta): escape all closing characters, not only + round parenthesis. [ruby-core:53578] [Bug #8133] + Sun Apr 7 02:54:40 2013 Narihiro Nakamura <authornari@gmail.com> * gc.c: Improve accuracy of objspace_live_num() and @@ -5974,7 +5974,7 @@ simple_re_meta(int c) switch (c) { case '$': case '*': case '+': case '.': case '?': case '^': case '|': - case ')': + case ')': case ']': case '}': case '>': return TRUE; default: return FALSE; diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 308b30ae9c..46fd4531a0 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -180,9 +180,15 @@ class TestRegexp < Test::Unit::TestCase end def test_source_escaped_paren - bug7610 = '[ruby-core:51088]' - s = '\(a\)' - assert_equal(/#{s}/, eval("%r(#{s})"), bug7610) + bug7610 = '[ruby-core:51088] [Bug #7610]' + bug8133 = '[ruby-core:53578] [Bug #8133]' + [ + ["(", ")", bug7610], ["[", "]", bug8133], + ["{", "}", bug8133], ["<", ">", bug8133], + ].each do |lparen, rparen, bug| + s = "\\#{lparen}a\\#{rparen}" + assert_equal(/#{s}/, eval("%r#{lparen}#{s}#{rparen}"), bug) + end end def test_source_unescaped @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-04-07" -#define RUBY_PATCHLEVEL 108 +#define RUBY_PATCHLEVEL 109 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 4 |