Bug #14598
closed[2.6.0 Preview1] Flood of error message occurs when throwing an error including "\n" in its message.
Description
2.6.0-preview1にて表題の現象にぶつかったため報告致します。
バージョン:
ruby 2.6.0preview1 (2018-02-24 trunk 62554) [x86_64-darwin17]
環境:
MacOS 10.13.3
Macbook Pro(Core i7, 16GB RAM)
再現方法:
ruby -e 'fail "\n"'
現象:
fail/raiseで文字列を飛ばしたとき、"\n"が含まれていると、
エラーメッセージの出力で大量のログが流されてしまいます。
以下、上から三行目まで切り取ったものです。
"""
Traceback (most recent call last):
-e:1:in <main>': (RuntimeError) a?$-p ??N?
?{T
?(?
"""
出力先をリダイレクトするとエラーメッセージは正しく表示されるので、
端末出力のみで起きるのではないかと思います。
ちなみに、2.5.0で試したところ再現しませんでした。
Updated by minoritea (Minori Tokuda) over 6 years ago
- Subject changed from [2.6.0 Preview1] fail/raiseで"\n"を飛ばしたときにエラーメッセージであふれてしまう to [2.6.0 Preview1] Flood of error message occurs when throwing an error including "\n" in its message.
Sorry to have sent the japanese report. I had to send it to ruby-dev.
Updated by minoritea (Minori Tokuda) over 6 years ago
I tried to translate the original text.
Version:
ruby 2.6.0preview1 (2018-02-24 trunk 62554) [x86_64-darwin17]
Environment:
MacOS 10.13.3
Macbook Pro(Core i7, 16GB RAM)
How to reproduce:
ruby -e 'fail "\n"'
On calling fail/raise with a message string which includes "\n", the output floods in screen.
The three lines from the top are below:
"""
Traceback (most recent call last):
-e:1:in ': (RuntimeError)
a?$-p ??N??{T?(?
"""
If I redirected the output to another process or file, the error is displayed correctly.
Therefore, this event might cause in terminals only.
By the way, I tried it at 2.5.0 and it did not reproduce.
Updated by nobu (Nobuyoshi Nakada) over 6 years ago
- Status changed from Open to Closed
Applied in changeset trunk|r62728.
eval_error.c: fix underflow
- eval_error.c (print_errinfo): get rid of negative string length.
[ruby-core:86086] [Bug #14598]