# Workings of the freaky freaky sandbox

**URL:** <https://www.ruby-forum.com/t/workings-of-the-freaky-freaky-sandbox/136542>\
**Category:** Ruby\
**Created:** [May 3, 2008, 10:40am UTC](https://www.ruby-forum.com/t/workings-of-the-freaky-freaky-sandbox/136542 "2008-05-03T10:40:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Grandy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@Nick\_Grandy](https://www.ruby-forum.com/u/Nick_Grandy)\
**Post date:** [May 3, 2008, 10:40am UTC](https://www.ruby-forum.com/t/workings-of-the-freaky-freaky-sandbox/136542/1 "2008-05-03T10:40:04Z")

</div>

hi all,

a couple questions directed towards a greater understanding of the  
workings of the freaky freaky sandbox  
([http://code.whytheluckystiff.net/sandbox/](http://code.whytheluckystiff.net/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 = 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/topic/150864](http://www.ruby-forum.com/topic/150864)) 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
