From e3b8195afa170f6909e607ce349bb29bf3d8a65b Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Wed, 2 Nov 2011 17:40:04 -0400 Subject: [PATCH] Fix the default `sandbox-make-code-inspector'. It now creates an inspector based on the original code inspector instead of the (implicit) wrong default used by `make-inspector'. Change `sandbox-make-inspector' too, to make it explicit. (cherry picked from commit 90f7a98dd6d16686ce6874387536a6cf93671f8b) --- collects/racket/sandbox.rkt | 6 +++-- collects/scribblings/reference/sandbox.scrbl | 26 +++++++++++--------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/collects/racket/sandbox.rkt b/collects/racket/sandbox.rkt index 62cfc6b27d..02777130e5 100644 --- a/collects/racket/sandbox.rkt +++ b/collects/racket/sandbox.rkt @@ -202,9 +202,11 @@ (define sandbox-exit-handler (make-parameter default-sandbox-exit-handler)) -(define sandbox-make-inspector (make-parameter make-inspector)) +(define sandbox-make-inspector + (make-parameter (lambda () (make-inspector (current-inspector))))) -(define sandbox-make-code-inspector (make-parameter make-inspector)) +(define sandbox-make-code-inspector + (make-parameter (lambda () (make-inspector (current-code-inspector))))) (define sandbox-make-logger (make-parameter current-logger)) diff --git a/collects/scribblings/reference/sandbox.scrbl b/collects/scribblings/reference/sandbox.scrbl index ac6efcc285..3a3b6966af 100644 --- a/collects/scribblings/reference/sandbox.scrbl +++ b/collects/scribblings/reference/sandbox.scrbl @@ -676,22 +676,24 @@ other resources intact.} @defparam[sandbox-make-inspector make (-> inspector?)]{ -A parameter that determines the procedure used to create the inspector -for sandboxed evaluation. The procedure is called when initializing -an evaluator, and the default parameter value is -@racket[make-inspector].} +A parameter that determines the (nullary) procedure that is used to +create the inspector for sandboxed evaluation. The procedure is called +when initializing an evaluator. The default parameter value is +@racket[(lambda () (make-inspector (current-inspector)))].} @defparam[sandbox-make-code-inspector make (-> inspector?)]{ -A parameter that determines the procedure used to create the code -inspector for sandboxed evaluation. The procedure is called when -initializing an evaluator, and the default parameter value is -@racket[make-inspector]. The @racket[current-load/use-compiled] -handler is setup to still allow loading of bytecode files under the -original code inspector when @racket[sandbox-path-permissions] allows -it through a @racket['read-bytecode] mode symbol, to make it possible -to load libraries.} +A parameter that determines the (nullary) procedure that is used to +create the code inspector for sandboxed evaluation. The procedure is +called when initializing an evaluator. The default parameter value is +@racket[(lambda () (make-inspector (current-code-inspector)))]. + +The @racket[current-load/use-compiled] handler is setup to allow loading +of bytecode files under the original code inspector when +@racket[sandbox-path-permissions] allows it through a +@racket['read-bytecode] mode symbol, which makes loading libraries +possible.} @defparam[sandbox-make-logger make (-> logger?)]{