[Issue 278] New: dmd.conf search path dosn't work

Sean Kelly sean at f4.ca
Fri Aug 4 13:53:59 PDT 2006


Walter Bright wrote:
> Sean Kelly wrote:
>> I do all my switching in /etc/dmd.conf and recently had some weird 
>> problems when I tried using Build on Linux.  It turned out that I had 
>> an old dmd.conf file in /dmd/bin as well, and removing this fixed 
>> things. So I think the checking of /bin/dmd/dmd.conf may not work 
>> correctly.  I have /dmd/bin in my path, could it be that the argv[0] 
>> doesn't contain a fully qualified path name and so the function ends 
>> up looking in the current directory twice?
> 
> Easy enough to check, compile/run this program on your system:
> 
>> #include        <stdio.h>
>> #include        <assert.h>
>> #include        <stdlib.h>
>>
>> int main(argc,argv)
>> int argc;
>> char *argv[];
>> {       int i;
>>
>>         printf("%d arguments\n",argc);
>>         for (i = 0; i < argc; i++)
>>                 printf("arg[%d] = '%s'\n",i,argv[i]);
>>         assert(argv[argc] == NULL);
>>         return EXIT_SUCCESS;
>> }

I was being lazy and trying to avoid starting my Linux VM :-)  But I 
just wrote an app like the above, compiled it as "app", moved the 
executable to /dmd/bin, and ran it.  As suspected, argv[0] was "app" and 
not "/dmd/bin/app" as the DMD front-end seems to expect.  I also 
couldn't find a built-in way to determine the location of the executing 
process, so it may be that DMD will have to iterate across the PATH list 
as Build does.


Sean



More information about the Digitalmars-d-bugs mailing list