BUG: rdmd cmd line argument bug

Bruno Medeiros brunodomedeirosATgmail at SPAM.com
Tue May 30 11:58:58 PDT 2006


Dave wrote:
> In article <e5c3t9$2vvq$1 at digitaldaemon.com>, Bruno Medeiros says...
>> The Windows version of rdmd passes incorrect command line arguments to 
>> the program to be run. Here's a test program:
>>
>>   import std.stdio;
>>
>>   int main(char[][] args) {
>>     writefln("ARGS: ", args.length, " ", args);
>>     return 0;
>>   }
>>
>> Here's a correct run with dmd (the program gets the correct args):
>>
>> $ dmd -run ./printargs.d AA BB CC
>> ARGS: 4 [d:\#scripts\printargs.exe,AA,BB,CC]
>>
>> Here's what happens when you run the same program with rdmd:
>>
>> $ rdmd -run ./printargs.d AA BB CC
>> ARGS: 3 
>> [d:\#scripts\printargs.exe,-ofc:/Home/phoenix/LOCALS~1/Temp\-phoenix-0-0
>> -523934D89A617F8383F6035B5D2CC826.exe,-odc:/Home/phoenix/LOCALS~1/Temp\]
>>
>> The Linux version of rdmd seems to run fine (I haven't tested myself, I 
>> asked someone else on #D)
>>
> 
> rdmd doesn't need '-run'. If I run it with the above code, I get this on linux:
> 
> ARGS: 4 [/tmp/rd-0-834-509947-D7B8821E97DC98D3C34D2F29E2EE2115,AA,BB,CC]
> 
> and this on Windows:
> 
> ARGS: 4
> [C:\DOCUME~1\SOMEUS~1\LOCALS~1\Temp\rd-someuser-0-0-A46C236CDE107E3B9F053881E4257C2D.exe,AA,BB,CC]
> 
> (the line-break was inserted by the news reader)
> 
> args[0] is the actual path to the 'cached' executable.
> 
> 

Hum, I found it does work after all, but only when called from the 
Windows Command prompt! If I call it from a MinGW shell I get an error 
(which was what originally made think one wasn't supposed to use -run). 
Substituting dmd for the very printargs.exe, here's what is found:

When one runs rdmd from the Win CMD shell:

 > rdmd dummy.d
ARGS: 5 [C:\devel\D.tools\dmd\bin\dmd.exe,-quiet,dummy.d,-ofc:\Home\phoenix\
LOCALS~1\Temp\dummy-phoenix-0-0-A46C236CDE107E3B9F053881E4257C2D.exe,-odc:\H
ome\phoenix\LOCALS~1\Temp\]

(DMD would run fine)
But when one runs rdmd from the MinGW bash shell:

$ rdmd dummy.d
ARGS: 5 [c:\devel\D.tools\dmd\bin\dmd.exe,-quiet,dummy.d,-ofc:/Home/phoenix/
LOCALS~1/Temp\dummy-phoenix-0-0-A46C236CDE107E3B9F053881E4257C2D.exe,-odc:/H
ome/phoenix/LOCALS~1/Temp\]

Some of the slashes are inverted, and that makes OPTLINK choke. Weird. 
How does rdmd have this different behaviour, I mean, how does it even 
know it's running under a different shell/environ/whatever? :/


-- 
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d-bugs mailing list