[MacRuby] #860: Assertion fails when MacRuby should throw an exception of "OptionParser::AmbiguousOption".
#860: Assertion fails when MacRuby should throw an exception of "OptionParser::AmbiguousOption". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Test Script: {{{ #!ruby $ cat test_opt.rb require 'optparse' opt = OptionParser.new flag = self.class opt.def_option("--open") {|x|} opt.def_option("-x") {|x| flag = x} opt.def_option("--option") {|x| flag = x} begin opt.parse!(%w"--op") rescue => e p e end begin opt.parse!(%w"-o") rescue => e p e end }}} Result of Ruby 1.9.1: {{{ $ ruby test_opt.rb #<OptionParser::AmbiguousOption: --op> #<OptionParser::AmbiguousOption: -o> }}} Result of MacRuby Trunk: {{{ $ macruby test_opt.rb #<OptionParser::AmbiguousOption: --op> Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3343. zsh: abort macruby test_opt.rb }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/860> MacRuby <http://macruby.org/>
#860: Assertion fails when MacRuby should throw an exception of "OptionParser::AmbiguousOption". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by martinlagardette@…): Reduction: {{{ #!ruby def complete raise catch(:ambiguous) { throw :ambiguous raise "Error" } end begin complete rescue # crashes here complete end }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/860#comment:1> MacRuby <http://macruby.org/>
#860: Assertion fails when MacRuby should throw an exception of "OptionParser::AmbiguousOption". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by martinlagardette@…): Even better reduction actually: {{{ #!ruby def complete raise Exception, catch(:ambiguous) { throw :ambiguous } end begin raise rescue # crashes here complete end }}} Also added the "raise Exception" just to avoid dealing with the `TypeError` exception (`exception object expected (TypeError)`) -- Ticket URL: <http://www.macruby.org/trac/ticket/860#comment:2> MacRuby <http://macruby.org/>
#860: Assertion fails when MacRuby should throw an exception of "OptionParser::AmbiguousOption". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by martinlagardette@…): The problem is the `throw` statement, that pops the exception from the VM, as of r3053 . Without it, everything works fine, and the size of the exception list is 2, as expected, instead of 1 after `throw` is called. -- Ticket URL: <http://www.macruby.org/trac/ticket/860#comment:3> MacRuby <http://macruby.org/>
#860: Assertion fails in pop_current_exception when catch/throw used in rescue ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Description changed by martinlagardette@…: Old description:
Test Script: {{{ #!ruby $ cat test_opt.rb require 'optparse'
opt = OptionParser.new flag = self.class
opt.def_option("--open") {|x|} opt.def_option("-x") {|x| flag = x} opt.def_option("--option") {|x| flag = x}
begin opt.parse!(%w"--op") rescue => e p e end
begin opt.parse!(%w"-o") rescue => e p e end }}}
Result of Ruby 1.9.1: {{{ $ ruby test_opt.rb #<OptionParser::AmbiguousOption: --op> #<OptionParser::AmbiguousOption: -o> }}}
Result of MacRuby Trunk: {{{ $ macruby test_opt.rb #<OptionParser::AmbiguousOption: --op> Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3343. zsh: abort macruby test_opt.rb }}}
New description: {{{ #!ruby $ cat test_catch_throw.rb begin raise rescue catch(:ambiguous) { throw :ambiguous } p :ok end }}} Result of Ruby 1.9.1: {{{ $ ruby test_catch_throw.rb :ok }}} Result of MacRuby Trunk: {{{ $ macruby test_catch_throw.rb Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3343. zsh: abort macruby test_opt.rb }}}+ -- -- Ticket URL: <http://www.macruby.org/trac/ticket/860#comment:4> MacRuby <http://macruby.org/>
#860: Assertion fails in pop_current_exception when catch/throw used in rescue ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by lsansonetti@…): Okay this one is really evil. -- Ticket URL: <http://www.macruby.org/trac/ticket/860#comment:5> MacRuby <http://macruby.org/>
#860: Assertion fails in pop_current_exception when catch/throw used in rescue ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Description changed by lsansonetti@…: Old description:
{{{ #!ruby $ cat test_catch_throw.rb begin raise rescue catch(:ambiguous) { throw :ambiguous } p :ok end }}}
Result of Ruby 1.9.1: {{{ $ ruby test_catch_throw.rb :ok }}}
Result of MacRuby Trunk: {{{ $ macruby test_catch_throw.rb Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3343. zsh: abort macruby test_opt.rb }}}+
New description: {{{ #!ruby $ cat test_catch_throw.rb begin raise rescue catch(:ambiguous) { throw :ambiguous } p :ok end }}} Result of Ruby 1.9.1: {{{ $ ruby test_catch_throw.rb :ok }}} Result of MacRuby Trunk: {{{ $ macruby test_catch_throw.rb Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3343. zsh: abort macruby test_opt.rb }}}+ Original report (involving optparse) which was deleted: {{{ $ cat test_opt.rb require 'optparse' opt = OptionParser.new flag = self.class opt.def_option("--open") {|x|} opt.def_option("-x") {|x| flag = x} opt.def_option("--option") {|x| flag = x} begin opt.parse!(%w"--op") rescue => e p e end begin opt.parse!(%w"-o") rescue => e p e end }}} Result of Ruby 1.9.1: {{{ $ ruby test_opt.rb #<OptionParser::AmbiguousOption: --op> #<OptionParser::AmbiguousOption: -o> }}} Result of MacRuby Trunk: {{{ $ macruby test_opt.rb #<OptionParser::AmbiguousOption: --op> Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3343. zsh: abort macruby test_opt.rb }}} -- -- Ticket URL: <http://www.macruby.org/trac/ticket/860#comment:6> MacRuby <http://macruby.org/>
#860: Assertion fails in pop_current_exception when catch/throw used in rescue ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Description changed by lsansonetti@…: Old description:
{{{ #!ruby $ cat test_catch_throw.rb begin raise rescue catch(:ambiguous) { throw :ambiguous } p :ok end }}}
Result of Ruby 1.9.1: {{{ $ ruby test_catch_throw.rb :ok }}}
Result of MacRuby Trunk: {{{ $ macruby test_catch_throw.rb Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3343. zsh: abort macruby test_opt.rb }}}+
Original report (involving optparse) which was deleted:
{{{ $ cat test_opt.rb require 'optparse'
opt = OptionParser.new flag = self.class
opt.def_option("--open") {|x|} opt.def_option("-x") {|x| flag = x} opt.def_option("--option") {|x| flag = x}
begin opt.parse!(%w"--op") rescue => e p e end
begin opt.parse!(%w"-o") rescue => e p e end }}}
Result of Ruby 1.9.1: {{{ $ ruby test_opt.rb #<OptionParser::AmbiguousOption: --op> #<OptionParser::AmbiguousOption: -o> }}}
Result of MacRuby Trunk: {{{ $ macruby test_opt.rb #<OptionParser::AmbiguousOption: --op> Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3343. zsh: abort macruby test_opt.rb }}}
New description: {{{ #!ruby $ cat test_catch_throw.rb begin raise rescue catch(:ambiguous) { throw :ambiguous } p :ok end }}} Result of Ruby 1.9.1: {{{ $ ruby test_catch_throw.rb :ok }}} Result of MacRuby Trunk: {{{ $ macruby test_catch_throw.rb Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3343. zsh: abort macruby test_opt.rb }}} Original report (involving optparse) which was deleted: {{{ $ cat test_opt.rb require 'optparse' opt = OptionParser.new flag = self.class opt.def_option("--open") {|x|} opt.def_option("-x") {|x| flag = x} opt.def_option("--option") {|x| flag = x} begin opt.parse!(%w"--op") rescue => e p e end begin opt.parse!(%w"-o") rescue => e p e end }}} Result of Ruby 1.9.1: {{{ $ ruby test_opt.rb #<OptionParser::AmbiguousOption: --op> #<OptionParser::AmbiguousOption: -o> }}} Result of MacRuby Trunk: {{{ $ macruby test_opt.rb #<OptionParser::AmbiguousOption: --op> Assertion failed: ((size_t)pos < current_exceptions.size()), function pop_current_exception, file vm.cpp, line 3343. zsh: abort macruby test_opt.rb }}} -- -- Ticket URL: <http://www.macruby.org/trac/ticket/860#comment:7> MacRuby <http://macruby.org/>
#860: Assertion fails in pop_current_exception when catch/throw used in rescue ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Changes (by vincent.isambart@…): * milestone: => MacRuby 1.0 -- Ticket URL: <http://www.macruby.org/trac/ticket/860#comment:8> MacRuby <http://macruby.org/>
#860: Assertion fails in pop_current_exception when catch/throw used in rescue ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by andre.lewis@…): Just a note, this issue has been causing me a lot of headache recently. I've resorted to returning exceptions inside rescue blocks instead of throwing them. Anyone have a better work-around? -- Ticket URL: <http://www.macruby.org/trac/ticket/860#comment:9> MacRuby <http://macruby.org/>
#860: Assertion fails in pop_current_exception when catch/throw used in rescue ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by lsansonetti@…): Andre: are you sure you're reproducing the same problem? The same assertion message does not mean the same problem. Here, it's a combination of catch/throw statements used inside a rescue block. If you do not use catch/throw (as I suspect, as they are not very popular), a reproduction of your problem would be great (on a separate ticket). -- Ticket URL: <http://www.macruby.org/trac/ticket/860#comment:10> MacRuby <http://macruby.org/>
#860: Assertion fails in pop_current_exception when catch/throw used in rescue ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by kouji@…): I fixed this in https://github.com/MacRuby/MacRuby/commit/60723bfc81846600a620c7a0ba1816fa6d... (implement) and https://github.com/MacRuby/MacRuby/commit/2d46a9416b70031d5df1a466d630839037... (test). Plaese check it and close this ticket. -- Ticket URL: <http://www.macruby.org/trac/ticket/860#comment:11> MacRuby <http://macruby.org/>
#860: Assertion fails in pop_current_exception when catch/throw used in rescue ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.11 Component: MacRuby | Resolution: fixed Keywords: | ----------------------------------+----------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: MacRuby 1.0 => MacRuby 0.11 Comment: I confirm the fix works. Closing! -- Ticket URL: <http://www.macruby.org/trac/ticket/860#comment:12> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby