From: David Flanagan Date: 2007-10-23T13:24:00+09:00 Subject: Re: Simple One liner crashes YARV trap ('INT', &oldTrap) crashes Ruby 1.9.0 code generator Brent, I can't reproduce this on Linux: $ruby1.9 -v -e 'trap("INT", &oldTrap)' ruby 1.9.0 (2007-10-18 patchlevel 0) [i686-linux] -e:1:in `method_missing': undefined local variable or method `oldTrap' for main:Object (NameError) from -e:1:in `
' $ ruby1.9 -v -e 'oldTrap=lambda{}; trap("INT", &oldTrap)' ruby 1.9.0 (2007-10-18 patchlevel 0) [i686-linux] David Brent Roman wrote: > The one line Ruby text: > > trap ('INT', &oldTrap) > > crashes my snapshot of Ruby 1.9.0 > > with the following backtrace: > > > /home/brent/ESP/gen2/software/ruby/ruby19-mbari/vm_dump.c:588 > /home/brent/ESP/gen2/software/ruby/ruby19-mbari/error.c:212 > /home/brent/ESP/gen2/software/ruby/ruby19-mbari/error.c:228 > /home/brent/ESP/gen2/software/ruby/ruby19-mbari/compile.c:2545 > /home/brent/ESP/gen2/software/ruby/ruby19-mbari/compile.c:3586 > /home/brent/ESP/gen2/software/ruby/ruby19-mbari/compile.c:181 > /home/brent/ESP/gen2/software/ruby/ruby19-mbari/iseq.c:297 > /home/brent/ESP/gen2/software/ruby/ruby19-mbari/iseq.c:308 > /home/brent/ESP/gen2/software/ruby/ruby19-mbari/iseq.c:282 > /home/brent/ESP/gen2/software/ruby/ruby19-mbari/eval.c:232 > /home/brent/ESP/gen2/software/ruby/ruby19-mbari/eval.c:262 > /home/brent/ESP/gen2/software/ruby/ruby19-mbari/main.c:32 > > ------------------------------------------------------- > [BUG] setup_arg: unknown node: NODE_STR > > ruby 1.9.0-mbari (2007-10-18) [i686-linux] > > > Note that my snapshot is about 2 weeks old. However, I have been > watching the core list and have not heard about this problem. > This crash should be very easy to reproduce. > Would anyone with an unpatched, fresh snapshot > of 1.9.0 care to confirm that it is broken. > > My guess is that YARV is choking on the the &proc expression > in the context of the trap kernel method as this can also be a String. > Note that it does not even complain about the missing > local variable/method "oldTrap". If you define a Proc called oldTrap > first, the trap('INT', &oldTrap) will bomb in exactly the same way. > However, > > trap('INT', "junk") > > fails gracefully with ArgumentError: wrong trap - junk > > I have already managed to port a few thousand lines of our app > over to Ruby 1.9 without much incident. I really had been quite > impressed with its stability. I'm hoping that this has an easy fix. > > - brent > >