Project

General

Profile

Actions

Bug #16919

closed

IRB でマジックコメントの : の後に任意の文字を入力するとエラーが発生する

Added by Anonymous over 4 years ago. Updated over 4 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
[ruby-dev:50930]

Description

再現手順

irb(main):001:0> #coding:u

実際に起きた結果

irb(main):001:0> #coding:Traceback (most recent call last):
	38: from /usr/local/opt/ruby/bin/irb:23:in `<main>'
	37: from /usr/local/opt/ruby/bin/irb:23:in `load'
	36: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/gems/2.7.0/gems/irb-1.2.3/exe/irb:11:in `<top (required)>'
	35: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb.rb:399:in `start'
	34: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb.rb:470:in `run'
	33: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb.rb:470:in `catch'
	32: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb.rb:471:in `block in run'
	31: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb.rb:536:in `eval_input'
	30: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb/ruby-lex.rb:134:in `each_top_level_statement'
	29: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb/ruby-lex.rb:134:in `catch'
	28: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb/ruby-lex.rb:135:in `block in each_top_level_statement'
	27: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb/ruby-lex.rb:135:in `loop'
	26: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb/ruby-lex.rb:138:in `block (2 levels) in each_top_level_statement'
	25: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb/ruby-lex.rb:166:in `lex'
	24: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb.rb:517:in `block in eval_input'
	23: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb.rb:695:in `signal_status'
	22: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb.rb:518:in `block (2 levels) in eval_input'
	21: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb/input-method.rb:262:in `gets'
	20: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/forwardable.rb:235:in `readmultiline'
	19: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/forwardable.rb:235:in `readmultiline'
	18: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/reline.rb:174:in `readmultiline'
	17: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/reline.rb:236:in `inner_readline'
	16: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/reline.rb:236:in `loop'
	15: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/reline.rb:237:in `block in inner_readline'
	14: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/reline.rb:266:in `read_io'
	13: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/reline.rb:266:in `loop'
	12: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/reline.rb:307:in `block in read_io'
	11: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/reline.rb:238:in `block (2 levels) in inner_readline'
	10: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/reline.rb:238:in `each'
	 9: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/reline.rb:239:in `block (3 levels) in inner_readline'
	 8: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/reline/line_editor.rb:843:in `input_key'
	 7: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/reline/line_editor.rb:879:in `process_auto_indent'
	 6: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb/ruby-lex.rb:96:in `block in set_auto_indent'
	 5: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/irb/ruby-lex.rb:78:in `ripper_lex_without_warning'
	 4: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/ripper/lexer.rb:45:in `lex'
	 3: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/ripper/lexer.rb:103:in `lex'
	 2: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/ripper/lexer.rb:125:in `parse'
	 1: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/ripper/lexer.rb:125:in `parse'
-:1: unknown encoding name: u (ArgumentError)

期待した結果

irb(main):001:0> #coding:utf-8
=> nil

この結果期待した理由

旧バージョンでは期待通りに動いたから。

Actions

Also available in: Atom PDF

Like0
Like0Like0