[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

workings of the freaky freaky sandbox

Nick Grandy

5/3/2008 8:39:00 AM

hi all,

a couple questions directed towards a greater understanding of the
workings of the freaky freaky sandbox
(http://code.whytheluckystiff.ne...), 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 = Sandbox.safe
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,
(http://www.ruby-forum.com/to...) 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
things?

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

thanks,
nick