Bug #11969
closed
[PATCH] IRB: Final newline missing in truncated backtraces
Added by noniq (Stefan Daschek) almost 9 years ago.
Updated over 8 years ago.
Description
If IRB shows a backtrace that gets truncated because of back_trace_limit
, the last line of the backtrace does not end with a newline.
Steps to reproduce:
$ irb -f --back-trace-limit 1
irb(main):001:0> foo
Actual output:
NameError: undefined local variable or method `foo' for main:Object
Did you mean? fork
from (irb):1
from /Users/stefan/.rbenv/versions/2.3.0/bin/irb:11:in `<main>'irb(main):002:0>
Expected output:
NameError: undefined local variable or method `foo' for main:Object
Did you mean? fork
from (irb):1
from /Users/stefan/.rbenv/versions/2.3.0/bin/irb:11:in `<main>'
irb(main):002:0>
Tested with Ruby 2.3.0, but this seems to affect older versions as well.
- Subject changed from IRB: Final newline missing in zruncated backtrace is missing final newline to IRB: Final newline missing in truncated backtraces
- Description updated (diff)
Opened https://github.com/ruby/ruby/pull/1205 a few days ago. Here's the patch:
diff --git a/lib/irb.rb b/lib/irb.rb
index 45f3280..92b79b3 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -525,7 +525,7 @@ def eval_input
print messages.join("\n"), "\n"
unless lasts.empty?
printf "... %d levels...\n", levels if levels > 0
- print lasts.join("\n")
+ print lasts.join("\n"), "\n"
end
print "Maybe IRB bug!\n" if irb_bug
end
This goes back at least to 1.8.6. Can we get this backported?
- Assignee set to keiju (Keiju Ishitsuka)
Ping... Any update on this?
- Subject changed from IRB: Final newline missing in truncated backtraces to [PATCH] IRB: Final newline missing in truncated backtraces
- Status changed from Open to Closed
Applied in changeset r53943.
- lib/irb.rb: avoid to needless truncation when using back_trace_limit option.
[fix GH-1205][ruby-core:72773][Bug #11969]
- Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED
- Backport changed from 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED
- Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: DONE, 2.2: REQUIRED, 2.3: REQUIRED
ruby_2_1 r54263 merged revision(s) 53943.
- Backport changed from 2.1: DONE, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: DONE, 2.2: DONE, 2.3: REQUIRED
Backported into ruby_2_2
branch at r54322.
- Backport changed from 2.1: DONE, 2.2: DONE, 2.3: REQUIRED to 2.1: DONE, 2.2: DONE, 2.3: DONE
ruby_2_3 r54370 merged revision(s) 53943.
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0