REBOL3 tracker
  0.9.12 beta
Ticket #0001892 User: anonymous

Project:



rss
TypeBug Statussubmitted Date4-Oct-2011 21:04
Versionalpha 111 CategoryPlatform Submitted byBrianH
PlatformWindows Severityminor Prioritynormal

Summary Windows command START /d messes up system/options, and system/options/boot is relative
Description When R3 is called on Windows with START /d the zeroth argument is the path to R3 that was passed to START, even if it is a relative path. If the path is relative then it is relative to the current directory at the point of the call to START, not to the path that is the current directory when R3 starts (what was specified as the /d parameter). This makes the startup code for R3 choke, many of the system/options wrong, and %rebol.r not load.

For that matter, the system/options/boot path is starting up set to the zeroth argument even when START isn't used, and sys/start isn't performing a clean-path on it anymore. When START /d isn't used at least that path is relative to the starting directory, but it's still a bad idea.

We need a better way to figure out the exe path on Windows than to just go off of the zeroth argument. And the resulting system/options/boot should be a full absolute path.
Example code
; R3 called from C:\ with START /d to the R3 directory and --boot base
>> print mold system/options/boot
%REBOL/2.100/r3.exe  ; should be %/C/REBOL/2.100/r3.exe
>> print mold what-dir
%/C/REBOL/2.100/

; This makes it look for %rebol.r in %/C/REBOL/2.100/REBOL/2.100/rebol.r

Assigned ton/a Fixed in- Last Update20-Apr-2014 21:02


Comments
(0003205)
BrianH
4-Oct-2011 21:31

To work around this I have to use some arcane tricks to get an absolute path when calling R3 from a batch file, like this CHAT batch script:

@cd REBOL\2.100\
@start "" /max "%~dp0\REBOL\2.100\r3.exe" --do "chat"
(0003219)
BrianH
22-Dec-2011 16:34

Andreas Bolka wrote this in AltME:

"Is there a way to figure out, what directory a command launches from, which will work across platforms?"

Yes and no. There are platform-specific ways. This is the gist of it:

- Linux: readlink("/proc/self/exe")
- OSX: _NSGetExecutablePath
- Win32: GetModuleFileNameW

(We recently discussed this issue in relation to R3 as well.)
(0004406)
giuliolunati
20-Apr-2014 21:02

Bug affects also linux-x86 and linux-arm
Real path of executable can be obtained via realpath() (linux+glibc)

Date User Field Action Change
20-Apr-2014 21:02 giuliolunati Comment : 0004406 Added -
22-Dec-2011 16:34 BrianH Comment : 0003219 Added -
4-Oct-2011 22:34 BrianH Comment : 0003205 Modified -
4-Oct-2011 21:32 BrianH Comment : 0003205 Modified -
4-Oct-2011 21:31 BrianH Comment : 0003205 Modified -
4-Oct-2011 21:31 BrianH Comment : 0003205 Added -
4-Oct-2011 21:04 BrianH Ticket Added -