[racket] setup sandbox eval with submodule
I just tried it with module+ (just to see what would happen), and it seems to be going on forever (which makes sense), but it doesn’t even give me a cycle in loading path error, which is weird. Is this a bug?
On May 16, 2014, at 7:42 PM, Alexander D. Knauth <alexander at knauth.org> wrote:
> Well, I think you have to use module, not module+, and for some reason the quoted module name doesn’t work, and the (submod “.” some-lang) doesn’t work, but (submod “Untitled.rkt” some-lang) does:
>
> #lang racket
> (require racket/sandbox
> scribble/eval)
>
> (require rackunit)
>
> (module some-lang racket
> (provide (all-defined-out))
> (define (#%top-interaction f x y) (f x y))
> (define #%module-begin '...))
>
> (define ev
> (call-with-trusted-sandbox-configuration
> (lambda ()
> (parameterize ([sandbox-output 'string]
> [sandbox-error-output 'string])
> (let ([the-eval (make-base-eval)])
> (the-eval `(require (submod "Untitled.rkt" some-lang)))
> the-eval)))))
>
> (check-equal? (ev '(+ 1 2)) 3)
>
> On May 14, 2014, at 9:41 AM, David Van Horn <dvanhorn at cs.umd.edu> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> I'd like to create a sandbox evaluator that uses a language created in
>> a submodule. So something like this:
>>
>> #lang racket
>> (require racket/sandbox
>> scribble/eval)
>>
>> (module+ some-lang
>> (provide (all-defined-out))
>> (define #%top-interaction '...)
>> (define #%module-begin '...))
>>
>> (define ev
>> (call-with-trusted-sandbox-configuration
>> (lambda ()
>> (parameterize ([sandbox-output 'string]
>> [sandbox-error-output 'string])
>> (let ([the-eval (make-base-eval)])
>> (the-eval `(require ???????))
>> the-eval)))))
>>
>> But I'm lost figuring out what to put for ??????? to make this work
>> out. Is there a way to make this work?
>>
>> Thanks,
>> David
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
>>
>> iQIcBAEBAgAGBQJTc3KaAAoJEIVEqZR2RxA8MDQP/jSDd+PXgvXVp4PgH7ZGpOFy
>> sUijCZXk8CmqNfTB7gLRn/1B66yKCib3w5l/3gwGnfMixKN0Zk7IstJAWYAM8IeA
>> Hc57VD80mef/H+pwJvFI6Eac9q39TiD+JjT0EblM0b3M9LvrxVBnmBr7s+uO0RyB
>> g+wOLFXwFVAJkTJjFmyHL3YI7y5nMFeKSa95XapiMK4oS/6mVfV7n6RIgLkpwTFF
>> ylxxMRgWRyHe41HmgzObfjD0NXBvqKOxgkC4vRq+eR6EYWndN1Re56wePGl7Dx8N
>> QcQDlGMWtWW4Eed9RmjoUMtrmjln0JtxyX5yZK9X9snKVrRfQ0MwXNKNvoC90b0w
>> uzQzS7Ow1gT8adwYl0bmElZTL3AaIRrPl086NV3xH5xyA9WVWHlrMZORsqb+ZDCc
>> FQMEV+bNUwBLcSv4hpfVfPk/VOlfQM9Q61RGFcSYAWNg7aXzEgz37pYb5wAZ7uYg
>> KdUMbAqLnUcZySowIYv5iKTNjG7dy/XmboPlBXrp0bZwxdV3Rz1UDMAJPO/b1GIO
>> 7zKVUTVL6U2S9qJ0a8rpCGpN1hcqZYlqQjf6Dpp9mvjljp+Mr3Bvnncco/wrgk4B
>> p7fXE5KlcGO4A4IAtjpZTL4Uj/YqFh0PfMNRhLP472RoH2nGWI6SKqp/ODAAh71V
>> 9t47ns+G/SJi1e7XtIne
>> =Ndma
>> -----END PGP SIGNATURE-----
>> ____________________
>> Racket Users list:
>> http://lists.racket-lang.org/users
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140516/c54d1570/attachment.html>