[MacRuby] #878: Can't catch an exception of Sandbox.
#878: Can't catch an exception of Sandbox. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Test Script: {{{ #!ruby $ cat t.rb Sandbox.no_writes.apply! begin Sandbox.no_network.apply! rescue => e p e end p :ok }}} Result: {{{ $ DYLD_LIBRARY_PATH=. ./macruby -I./lib t.rb /Users/watson/src/MacRuby/t.rb:4:in `<main>': Couldn't apply sandbox: `Operation not permitted` (SecurityError) }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/878> MacRuby <http://macruby.org/>
#878: Can't catch an exception of Sandbox. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by watson1978@…): If change rb_eSecurityError to rb_eRuntimeError in sandbox.c, catch it. {{{ $ DYLD_LIBRARY_PATH=. ./macruby -I./lib t.rb nil #<RuntimeError: Couldn't apply sandbox: `Operation not permitted`> :ok }}} Is it specifications not to have catch? -- Ticket URL: <http://www.macruby.org/trac/ticket/878#comment:1> MacRuby <http://macruby.org/>
#878: Can't catch an exception of Sandbox. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by lsansonetti@…): I believe it's because SecurityError is a special class that isn't caught by default rescue blocks. {{{ $ macruby -e "p SecurityError.ancestors" [SecurityError, Exception, NSObject, Kernel] $ macruby -e "p RuntimeError.ancestors" [RuntimeError, StandardError, Exception, NSObject, Kernel] }}} Only StandardError exceptions are caught in default rescue blocks, I think. -- Ticket URL: <http://www.macruby.org/trac/ticket/878#comment:2> MacRuby <http://macruby.org/>
#878: Can't catch an exception of Sandbox. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by watson1978@…): in #842, can catch exception of SecurityError. [[BR]] Is this another exception? -- Ticket URL: <http://www.macruby.org/trac/ticket/878#comment:3> MacRuby <http://macruby.org/>
#878: Can't catch an exception of Sandbox. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by watson1978@…): I am very Sorry. I mistook X( {{{ Sandbox.no_writes.apply! begin Sandbox.no_network.apply! rescue SecurityError => e p e end p :ok }}} {{{ $ macruby t.rb #<SecurityError: Couldn't apply sandbox: `Operation not permitted`> :ok }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/878#comment:4> MacRuby <http://macruby.org/>
#878: Can't catch an exception of Sandbox. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by lsansonetti@…): Yeah, it looks like it's behaving normally :) -- Ticket URL: <http://www.macruby.org/trac/ticket/878#comment:5> MacRuby <http://macruby.org/>
#878: Can't catch an exception of Sandbox. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: minor | Milestone: Component: MacRuby | Resolution: invalid Keywords: | ----------------------------------+----------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => invalid Comment: I'm closing the bug as "invalid". -- Ticket URL: <http://www.macruby.org/trac/ticket/878#comment:6> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby