Rubinus crashes with an incorrect syntax error in 1.9 mode #1692

iblue opened this Issue Apr 30, 2012 · 10 comments


None yet
7 participants

iblue commented Apr 30, 2012

This code is a minimal snipped that allows to reproduce the bug. It runs without problems in MRI 1.9.2-p290. When executed in rubinius with RBXOPT=-X19, it fails.

class Foo
  def bar(method, *args, &block)
    self.class.send :define_method, method do |*args, &block|
      @object.send method, *args, &block
iblue@nerdpol:~/rubinius-bug$ ruby -v
rubinius 2.0.0dev (1.9.3 4e73aaf9 yyyy-mm-dd JI) [i686-pc-linux-gnu]
iblue@nerdpol:~/rubinius-bug$ RBXOPT=-X19 ruby rubinius-bug.rb 
A syntax error has occurred:
    duplicate block argument name
    near line /home/iblue/rubinius-bug/rubinius-bug.rb:3, column 60

    self.class.send :define_method, method do |*args, &block|

         Rubinius::Melbourne(Rubinius::Melbourne19)#syntax_error at /home/iblue/.rvm/rubies/rbx-head/runtime/19/melbourne.rbc:68
           Rubinius::Melbourne(Rubinius::Melbourne19)#parse_file at /home/iblue/.rvm/rubies/rbx-head/runtime/19/melbourne.rbc:84
                            Rubinius::Compiler::FileParser#parse at /home/iblue/.rvm/rubies/rbx-head/runtime/19/compiler/stages.rbc:235
  Rubinius::Compiler::Parser(Rubinius::Compiler::FileParser)#run at /home/iblue/.rvm/rubies/rbx-head/runtime/19/compiler/stages.rbc:217
                                          Rubinius::Compiler#run at /home/iblue/.rvm/rubies/rbx-head/runtime/19/compiler/compiler.rbc:370
                                      Rubinius::Compiler.compile at /home/iblue/.rvm/rubies/rbx-head/runtime/19/compiler/compiler.rbc:84
                               Rubinius::CodeLoader#compile_file at kernel/delta/codeloader.rb:166
                                  Rubinius::CodeLoader#load_file at kernel/delta/codeloader.rb:147
                                Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:63
                                Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:109
                                         Rubinius::Loader#script at kernel/loader.rb:631
                                           Rubinius::Loader#main at kernel/loader.rb:835

When run without RBXOPT=-X19, everything works.


jc00ke commented Apr 30, 2012

@iblue just an FYI, but we're targeting 1.9.3, not 1.9.2 anymore. Still, good find!


steveklabnik commented May 9, 2012

I am also seeing this with Draper.

iblue commented May 12, 2012

My stripped down reproduction code originates from draper.


brixen commented Jul 31, 2012

Simpler reproduction

def a(&b)
  c { |&b| }

iblue commented Jul 31, 2012

When are you going to fix this? It's the main reason that keeps us from using rubinius for our production code.


brixen commented Jul 31, 2012

Soon? Patches welcome :)

IPGlider closed this in d4b6901 Aug 9, 2012


IPGlider commented Aug 9, 2012

@iblue, @steveklabnik This should be fixed now.


IPGlider commented Aug 9, 2012

@brixen, @dbussink I have done some test after my last commit and found that it solves the duplicate block argument name by reproducing the same behavior than MRI parser but more bugs arise.

git clone
cd draper
git checkout 782d3872
bundle install
bundle exec rake spec

Those test pass in MRI 1.9.3 but not in RBX, should we reopen this ticket or open a new one?

Also I don't know how to spec this behaviour right now, I would appreciate some help.


dbussink commented Aug 9, 2012

Please open a new issue with exact details on what the issue is, so including backtraces etc. and also please try to minimize the test case to make fixing it easier for us.

@Gibheer Gibheer added a commit to Gibheer/rubinius that referenced this issue Aug 14, 2012

@IPGlider @Gibheer IPGlider + Gibheer Check not in block. Fixes #1692 3eda54d

@roshats roshats added a commit to roshats/rubinius that referenced this issue Jun 26, 2014

@IPGlider @roshats IPGlider + roshats Check not in block. Fixes #1692 1e51881
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment