Bug #5912


Interpreter crashes when trying to invoke implicit block via Binding#eval

Added by ryanlecompte (Ryan LeCompte) over 10 years ago. Updated over 9 years ago.

Target version:
ruby -v:
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.1]


Here's how to reproduce the problem:

[1] pry(main)> def foo
[1] pry(main)* binding
[1] pry(main)* end
=> nil
[2] pry(main)> b = foo { puts 'hi!' }
=> #Binding:0x007f8b7a0e2ec0
[3] pry(main)> b.eval('').call
(pry):5: [BUG] Segmentation fault
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.1]

-- control frame ----------
c:0020 p:---- s:0071 b:0071 l:000070 d:000070 CFUNC :call
c:0019 p:0019 s:0068 b:0068 l:000fc8 d:001bc8 EVAL (pry):5
c:0018 p:---- s:0066 b:0066 l:000065 d:000065 FINISH
c:0017 p:---- s:0064 b:0064 l:000063 d:000063 CFUNC :eval
c:0016 p:0223 s:0058 b:0057 l:000056 d:000056 METHOD /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry-
c:0015 p:0041 s:0049 b:0049 l:000048 d:000048 METHOD /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry-
c:0014 p:0022 s:0044 b:0044 l:000028 d:000043 BLOCK /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry-
c:0013 p:---- s:0042 b:0042 l:000041 d:000041 FINISH
c:0012 p:---- s:0040 b:0040 l:000039 d:000039 CFUNC :loop
c:0011 p:0009 s:0037 b:0037 l:000028 d:000036 BLOCK /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry-
c:0010 p:---- s:0035 b:0035 l:000034 d:000034 FINISH
c:0009 p:---- s:0033 b:0033 l:000032 d:000032 CFUNC :catch
c:0008 p:0067 s:0029 b:0029 l:000028 d:000028 METHOD /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry-
c:0007 p:0188 s:0023 b:0023 l:001858 d:001858 METHOD /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry-
c:0006 p:0164 s:0018 b:0018 l:000e60 d:000e60 TOP /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry-
c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :load
c:0003 p:0127 s:0007 b:0007 l:000fc8 d:000270 EVAL /Users/ryan/.rvm/gems/ruby-1.9.2-p290/bin/pry:19
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000fc8 d:000fc8 TOP

-- Ruby level backtrace information ----------------------------------------
/Users/ryan/.rvm/gems/ruby-1.9.2-p290/bin/pry:19:in <main>' /Users/ryan/.rvm/gems/ruby-1.9.2-p290/bin/pry:19:in load'
/Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry- <top (required)>' /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry- start'
/Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry- repl' /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry- catch'
/Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry- block in repl' /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry- loop'
/Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry- block (2 levels) in repl' /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry- rep'
/Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry- re' /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pry- eval'
(pry):5:in <main>' (pry):5:in call'

-- C level backtrace information -------------------------------------------

You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details:

Abort trap: 6

Interestingly enough, if you type it all on a single line, it works!

def foo; binding; end; b = foo { puts 'hi!' }; b.eval('').call

But then afterwards, if you type:


It will crash the interpreter.

Related issues 1 (0 open1 closed)

Is duplicate of Backport193 - Backport #5634: yield and bindingClosedusa (Usaku NAKAMURA)11/15/2011Actions
Actions #1

Updated by ko1 (Koichi Sasada) about 10 years ago

  • Assignee set to ko1 (Koichi Sasada)
Actions #2

Updated by shyouhei (Shyouhei Urabe) about 10 years ago

  • Status changed from Open to Assigned

Updated by ko1 (Koichi Sasada) over 9 years ago

  • Category set to core
  • Status changed from Assigned to Closed
  • Target version set to 2.0.0

Close this ticket because I can't reproduce it on trunk (2.0).

Please re-open if you can reproduce this issue.


Also available in: Atom PDF