digitalmars.D.bugs - [Issue 9966] New: Use of spawnlp and spawnl in 'link.c' does not account for paths/filenames with spaces.
- d-bugmail puremagic.com (40/40) Apr 20 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9966
http://d.puremagic.com/issues/show_bug.cgi?id=9966 Summary: Use of spawnlp and spawnl in 'link.c' does not account for paths/filenames with spaces. Product: D Version: D2 Platform: x86_64 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: psryland gmail.com The call to spawnlp (link.c, line 734ish) passes the variable 'cmd' containing a filepath to the linker as parameters 2 and 3. However if that path contains white space, the linker misinterprets the 3rd parameter as multiple command line arguments. I think the code should be changed to something like this: #if _WIN32 if (status == -1) { char* quotedCmd = (char *)alloca(strlen(cmd) + 3); sprintf(quotedCmd,"\"%s\"",cmd); // spawnlp returns intptr_t in some systems, not int status = spawnlp(0,cmd,quotedCmd,args,NULL); } #endif a similar issue exists with spawnl (link.c, line 780ish) if the linker executable should happen to contain a white space. Appologies for not just submitting a pull request, but I'm very new to the code (cloned the repo for the first time last night) and am not sure if this is the correct solution w.r.t coding conventions or the wider issues of paths with or without white space/quotes. fyi, the linker path I was using (from sc.ini) was: LINKCMD64=D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64\link.exe -Paul -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 20 2013