[plt-scheme] Specifying directory sandbox evalutes file requires relative to

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Aug 29 17:13:12 EDT 2008

At Fri, 29 Aug 2008 21:37:11 +0100, "Noel Welsh" wrote:
> I have a problem creating an interaction-environment with a require
> statement that uses a file require.  This is used for Scribble
> documentation, which lives in a sub-directory called scribblings.  The
> require statement requires a file in the same directory using a line
> like:
>   (file "db.ss")

Don't use `file' for relative references like this. The `file' form is
intended as a way to reach files that you can't access in the
restricted, portable way that is supported by a plain string. In this
case, you just want a string...

> It works fine in testing, but when I come to build the package using
> "planet create" it seems that the require statement is resolved
> relative to the top level directory, so it breaks.  I can fix it:
>   (file "scribblings/db.ss")

... specifically, just "scribblings/db.ss".

Setup PLT and Planet packaging set the current directory to the one
containing the "info.ss" file when building docs, and I think Planet
probably requires that "info.ss" file to be in the package's root.
Since `interaction-eval' is dynamic, it depends on the current
directory instead of the enclosing file.

> but now I get this really weird error message:
> WARNING: collected information for key multiple times: (exporting-libraries #f)
> "modcollapse.ss" broke the contract
>   (->
>    (or/c symbol? module-path-index?)
>    (or/c
>     ...etc...
>     path?))
> on collapse-module-path-index; expected <(or/c (and/c module-path?
> (or/c symbol? (cons/c (symbols (quote lib)) any/c) (cons/c (symbols
> (quote file)) any/c) (cons/c (symbols (quote planet)) any/c) (cons/c
> (symbols (quote quote)) any/c))) path?)>, given: (planet
> "../generic/connection.ss" ("untyped" "snooze.plt" 2))
> This require statement points outside the package!  It does not appear
> anywhere in my code, so I assume it is created in generating the
> Scribble docs.

This must be a bug in `setup/modcollapse'. Does your code have a
"../generic/connection.ss" relative path somewhere? Or some other form
of reference to "connection.ss"? 


Posted on the users mailing list.