[racket] raco distribute has a problem with runtime paths on win32

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Apr 30 14:56:01 EDT 2014

At Wed, 30 Apr 2014 22:23:25 +0400, Dmitry Pavlov wrote:
>  > Assuming so, could you look for "rUnTiMe-paths" in the initial ".exe"
>  > and the distribution ".exe" to try to tell whether the strategy of
>  > using a fixed number of additional "."s is really enough?
> 
> I did not notice anything particular at the first glance, but
> here it is if you would like to take a look:
> 
> Before raco distribute:
> http://pastebin.com/nS2ncPRy
> After raco distribute:
> http://pastebin.com/hY9bYDAt

Thanks! I think I see the problem: some original paths use "/" as a
separator, while the `raco dist` process turns those into "\\", and the
normalization to "\\" makes a path longer. I think the solution is for
`raco exe` to normalize paths to "\\" in the first place.

> I actually can not figure out why three extra dots made a difference.
> ../lsm/Win32/Release/era-lsm.dll broke with 17 dots,
> while ../gauss-everhart/Win32/Release/gauss-everhart.dll
> worked perfectly and did not need those extra dots.
> That is a bit odd to me: the latter has the same
> level of nesting as the former, but longer names in the way.
> 
>  > Sometimes, that strategy ends up saving more information about the
>  > source directories than you'd like to appear in an executable, such as
>  > a user's directory name. We need some strategy to avoid that extra
>  > information while preserving relative file locations when needed.
> 
> Yes, I noticed that too. There is certainly no need to save the full
> directory structure (starting from C:\) to some "exts\\ert\\r0"
> directory. Some deeper common ancestor should suffice (is the
> directory structure needs to be saved at all)?

In your example, the obstacle is that `raco dist` must include both

 C:\program files\racket\share\pkgs\srfi-lite-lib\srfi\29\bundles

and

 C:\repo\era\rea\epm2004-booka\venus.rea

in the distribution, and `raco dist` currently has no way of knowing
whether the relative path from "bundles" to "venus.rea" is significant.
For example, "bundles" might contain some non-Racket file with the
relative path

 ..\..\..\..\..\..\..\..\repo\era\rea\epm2004-booka\venus.rea

where that relative path is expected to work after `raco dist` copies
everything into place for the distribution.

Of course, "bundles" doesn't contain such a relative path. Possibly,
the fact that "bundles" is in the main installation and "venus.rea"
isn't should be a clue for `raco dist`. Or maybe relative locations of
runtime files should be assumed irrelevant unless a programmer
explicitly declares otherwise.


Posted on the users mailing list.