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

From: Dmitry Pavlov (dpavlov at ipa.nw.ru)
Date: Wed Apr 30 14:23:25 EDT 2014

Matthew,

 > You can make things work by changing "collects/compiler/embed.rkt" to
 > replace #"................." with more than 17 dots.

Thank you! I put extra three dots, and all went well.

 > 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

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)?

Best regards,

Dmitry



On 04/28/2014 09:09 PM, Matthew Flatt wrote:
> There shouldn't be a limit, but the way that `raco exe` tries to make
> enough space apparently isn't right.
>
> The current strategy is to record the original full path (because a
> synthesized relative path could imitate it), the executable name
> (because that's part of the destination relative path), and about 17
> extra bytes (to accommodate the path of runtime files relative to the
> executable, not counting the executable name). In a distribution, the
> path to the file relative to the executable is supposed to fit within
> the same space.
>
> I think 17 bytes turns out to be slightly too little for the base
> relative path, even in Unix syntax. That base relative path becomes 5
> bytes longer on Windows, because "/"s turn into "\\"s.
>
> You can make things work by changing "collects/compiler/embed.rkt" to
> replace
>
>   #"................."
>
> with more than 17 dots.
>
> 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? You might
> notice a dependency on some path length that isn't covered by the
> current strategy, for example.
>
> Meanwhile, you might see a workaround that doesn't involve changing
> "embed.rkt", such as moving your source files to a more deeply nested
> directory (which is not a nice workaround, but I think it can likely
> succeed).
>
> Note that a synthesized relative path (for the distribution executable)
> may keep part of original paths (at the source locations) so that files
> stay relative to each other in the same way as in the source.
> 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.
>
> At Mon, 28 Apr 2014 20:25:03 +0400, Dmitry Pavlov wrote:
>>
>> accidentally hit the send button...
>>
>>> I use raco exe and raco distribute on a regular basis.
>>> Today I added another (define-runtime-path) into my program
>>> and got the following error from raco distribute:
>>>
>>> copy-and-patch-binaries: not enough room in executable for revised
>>> #rx#"rUnTiMe-paths[)]" table
>>>     context...:
>>>      C:\Program Files\Racket\collects\compiler\distribute.rkt:367:4: loop
>>>      C:\Program Files\Racket\collects\compiler\distribute.rkt:15:2:
>>> assemble-distribution7
>>>      C:\Program
>>> Files\Racket\share\pkgs\compiler-lib\compiler\commands\exe-dir.rkt:
>>> [running body]
>>>      C:\Program Files\Racket\collects\raco\raco.rkt: [running body]
>>>      C:\Program Files\Racket\collects\raco\main.rkt: [running body]
>>>
>>> On Linux everything works fine.
>>
>> I have more than 50 (define-runtime-path)s in different modules.
>> Is that too many for raco distribute on Windows? Are there workarounds
>> for this problem?
>>
>> Best regards,
>>
>> Dmitry
>>
>> ____________________
>>    Racket Users list:
>>    http://lists.racket-lang.org/users
> ____________________
>    Racket Users list:
>    http://lists.racket-lang.org/users
>
>


Posted on the users mailing list.