Project

General

Profile

Bug #11969

[PATCH] IRB: Final newline missing in truncated backtraces

Added by noniq (Stefan Daschek) almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
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.

Associated revisions

Revision 966e020a
Added by hsbt (Hiroshi SHIBATA) over 3 years ago

  • lib/irb.rb: avoid to needless truncation when using back_trace_limit option. [fix GH-1205][ruby-core:72773][Bug #11969]

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

Revision 53943
Added by hsbt (Hiroshi SHIBATA) over 3 years ago

  • lib/irb.rb: avoid to needless truncation when using back_trace_limit option. [fix GH-1205][ruby-core:72773][Bug #11969]

Revision 53943
Added by hsbt (Hiroshi SHIBATA) over 3 years ago

  • lib/irb.rb: avoid to needless truncation when using back_trace_limit option. [fix GH-1205][ruby-core:72773][Bug #11969]

Revision 53943
Added by hsbt (Hiroshi SHIBATA) over 3 years ago

  • lib/irb.rb: avoid to needless truncation when using back_trace_limit option. [fix GH-1205][ruby-core:72773][Bug #11969]

Revision 53943
Added by hsbt (Hiroshi SHIBATA) over 3 years ago

  • lib/irb.rb: avoid to needless truncation when using back_trace_limit option. [fix GH-1205][ruby-core:72773][Bug #11969]

Revision 26154da3
Added by usa (Usaku NAKAMURA) over 3 years ago

merge revision(s) 53943: [Backport #11969]

    * lib/irb.rb: avoid to needless truncation when using back_trace_limit option.
      [fix GH-1205][ruby-core:72773][Bug #11969]

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

Revision 54263
Added by usa (Usaku NAKAMURA) over 3 years ago

merge revision(s) 53943: [Backport #11969]

* lib/irb.rb: avoid to needless truncation when using back_trace_limit option.
  [fix GH-1205][ruby-core:72773][Bug #11969]

Revision 3aa4a0b9
Added by nagachika (Tomoyuki Chikanaga) over 3 years ago

merge revision(s) 53943: [Backport #11969]

    * lib/irb.rb: avoid to needless truncation when using back_trace_limit option.
      [fix GH-1205][ruby-core:72773][Bug #11969]

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

Revision 54322
Added by nagachika (Tomoyuki Chikanaga) over 3 years ago

merge revision(s) 53943: [Backport #11969]

* lib/irb.rb: avoid to needless truncation when using back_trace_limit option.
  [fix GH-1205][ruby-core:72773][Bug #11969]

Revision 07c9743e
Added by naruse (Yui NARUSE) over 3 years ago

merge revision(s) 53943: [Backport #11969]

    * lib/irb.rb: avoid to needless truncation when using back_trace_limit option.
      [fix GH-1205][ruby-core:72773][Bug #11969]

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

Revision 54370
Added by naruse (Yui NARUSE) over 3 years ago

merge revision(s) 53943: [Backport #11969]

* lib/irb.rb: avoid to needless truncation when using back_trace_limit option.
  [fix GH-1205][ruby-core:72773][Bug #11969]

History

Updated by noniq (Stefan Daschek) almost 4 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 4 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 4 years ago

  • Assignee set to keiju (Keiju Ishitsuka)

Updated by javawizard (Alex Boyd) almost 4 years ago

Ping... Any update on this?

Updated by javawizard (Alex Boyd) over 3 years ago

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

Ping again...

#6

Updated by hsbt (Hiroshi SHIBATA) over 3 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 3 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 3 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 3 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 3 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 3 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.

Also available in: Atom PDF