Workings of the freaky freaky sandbox

hi all,

a couple questions directed towards a greater understanding of the
workings of the freaky freaky sandbox
(, which i hope might be
addressed by _why or others familiar with such things.

let’s say i have a class that is referenced from inside the sandbox, eg:

ffbox =
ffbox.ref MyClass
ffbox.ref OtherClass
ffbox.eval “m = OtherClass.get_myclass”

where get_myclass returns an instance of MyClass. in my understanding,
and according to the specs posted here,
( the variable m will be an
instance inside the sandbox of a Sandbox::Ref. however, in practice
it seems as though m is an instance of MyClass that is being
marshalled to get it into the sandbox. what exactly is going on here?

a secondary question: while the instance is being marshalled and
unmarshalled, i get a “dump format error (user class)”, which
apparently derives from marshal.c in the ruby source code. when i
dump and load MyClass without a sandbox involved, it works fine. so,
any thoughts on what is causing the marshalling error in the sandbox
context? is it possible that the BoxedClass class is confusing

i acknowledge that i have delved only briefly into the sandbox source
code. my apologies if my questions are ill-informed.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs