[racket] Weird bug/feature with require, raco links, and xinit

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Nov 2 09:14:06 EDT 2012

30 minutes ago, Laurent wrote:
> [...]
> 
> Now if on a login shell you type:
> $ xinit -- :1
> you should get:
> p in a.rkt: a
> p in b.rkt: base
> which does not look fine.

I don't know what exactly would be different when you run things from
xinit, but these problems can happen when a file can be accessed in
two ways and Racket can't see that it's the same file.  In your case,
it looks like there were two "a.rkt" files that are distinct, so you
end up with two parameters with different values.

I occasionally run into this when I symlink directories, and the
result is similar: I can get into a state where a file is reachable in
two different paths so they're considered different modules.  I think
that the rule of thumb to avoid such problems (besides the obvious one
of not using symlinks etc) is to always use string requires for
linking modules within a single collection/package/whatever, and
always use symbolic requires to refer to other collections.

There can still be a problem though, since you did the linking with
raco link so there shouldn't be any path issues, so it might be worth
it to find out the source of the problem, still.  To do debug such
things, you can run `env | sort' in your usual shell and in your
xinitrc, then look for the cause of the difference.  Even if you have
no idea which variable can make a difference, it's easy to convert the
`env' output into the shell code that sets these variables and then
runs racket, then you just need to remove variables from both scripts
until you find the offending one.  (This is a good way to debug such
environmental problems in general, btw.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.