Project

General

Profile

Actions

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.

Status:
Closed
Target version:
-
ruby -v:
2.3.0
[ruby-core:72773]

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.

Updated by noniq (Stefan Daschek) almost 9 years ago

  • 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)

Updated by javawizard (Alex Boyd) almost 9 years ago

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?

Updated by javawizard (Alex Boyd) almost 9 years ago

  • Assignee set to keiju (Keiju Ishitsuka)

Updated by javawizard (Alex Boyd) almost 9 years ago

Ping... Any update on this?

Updated by javawizard (Alex Boyd) over 8 years ago

  • Subject changed from IRB: Final newline missing in truncated backtraces to [PATCH] IRB: Final newline missing in truncated backtraces

Ping again...

Actions #6

Updated by hsbt (Hiroshi SHIBATA) over 8 years ago

  • 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]

Updated by hsbt (Hiroshi SHIBATA) over 8 years ago

  • 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

Updated by usa (Usaku NAKAMURA) over 8 years ago

  • Backport changed from 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED

Updated by usa (Usaku NAKAMURA) over 8 years ago

  • 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.

Updated by nagachika (Tomoyuki Chikanaga) over 8 years ago

  • 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.

Updated by naruse (Yui NARUSE) over 8 years ago

  • 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0