[前][次][番号順一覧][スレッド一覧]

ruby-changes:60596

From: usa <ko1@a...>
Date: Tue, 31 Mar 2020 07:44:52 +0900 (JST)
Subject: [ruby-changes:60596] 209f345158 (ruby_2_5): merge revision(s) 62743: [Backport #16687]

https://git.ruby-lang.org/ruby.git/commit/?id=209f345158

From 209f34515819ae4147bbd76e8b8efa9f6261cf1d Mon Sep 17 00:00:00 2001
From: usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Mon, 30 Mar 2020 22:44:13 +0000
Subject: merge revision(s) 62743: [Backport #16687]

	Fix FrozenError on `Ripper.slice`

	Currently `Ripper.slice` raises a FrozenError

	```ruby
	require 'ripper'
	p Ripper.slice('foo', 'ident')
	```

	```
	/path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:193:in `concat': can't modify frozen String (FrozenError)
		from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:193:in `block in compile'
		from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:190:in `scan'
		from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:190:in `compile'
		from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:169:in `initialize'
		from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:151:in `new'
		from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:151:in `token_match'
		from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:144:in `slice'
		from /tmp/tmp.kb4cnhvum2/test.rb:2:in `<main>'
	```

	This patch will fix the problem.

	[Fix GH-1837]

	From: Masataka Pocke Kuwabara <kuwabara@p...>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

diff --git a/ext/ripper/lib/ripper/lexer.rb b/ext/ripper/lib/ripper/lexer.rb
index 9220257..72cc910 100644
--- a/ext/ripper/lib/ripper/lexer.rb
+++ b/ext/ripper/lib/ripper/lexer.rb
@@ -192,7 +192,7 @@ class Ripper https://github.com/ruby/ruby/blob/trunk/ext/ripper/lib/ripper/lexer.rb#L192
       if m = /[^\w\s$()\[\]{}?*+\.]/.match(pattern)
         raise CompileError, "invalid char in pattern: #{m[0].inspect}"
       end
-      buf = ''
+      buf = +''
       pattern.scan(/(?:\w+|\$\(|[()\[\]\{\}?*+\.]+)/) do |tok|
         case tok
         when /\w/
diff --git a/version.h b/version.h
index d1abb18..dca5674 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.5.8"
 #define RUBY_RELEASE_DATE "2020-03-31"
-#define RUBY_PATCHLEVEL 220
+#define RUBY_PATCHLEVEL 221
 
 #define RUBY_RELEASE_YEAR 2020
 #define RUBY_RELEASE_MONTH 3
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]