TEMPFILE for long paths incorrectly parses executable names containing spaces.
This issue was originally created at: 2007-08-09 10:17:15.
This issue was reported by: stuartreynolds.
stuartreynolds said at 2007-08-09 10:17:15
If I set any of
env['AR'] = "C:\Program Files\Microsoft Visual Studio 8\VC\bin\lib.exe"
env['AR'] = '"C:\Program Files\Microsoft Visual Studio 8\VC\bin\lib.exe"'
env['AR'] = r'"C:\Program\ Files\Microsoft Visual Studio 8\VC\bin\lib.exe"'
env['AR'] = r'"C:\Program\\ Files\Microsoft Visual Studio 8\VC\bin\lib.exe"'
env['AR'] = r'"C:\Program\\\ Files\Microsoft Visual Studio 8\VC\bin\lib.exe"'
env['AR'] = r'"C:\Program\\\\ Files\Microsoft Visual Studio 8\VC\bin\lib.exe"'
env['AR'] = r'"C:\Program\\\\\ Files\Microsoft Visual Studio 8\VC\bin\lib.exe"'
env['AR'] = r'"C:\Program\\\\\\ Files\Microsoft Visual Studio 8\VC\bin\lib.exe"'
....
and
lib.exeis run through$TEMPFILEbecause of an excessively long command line, then scons identifies the command incorrectly and tries to run:
C:\Program @c:\users\sir\appdata\local\temp\tmpeg19n3.lnk
Using tempfile c:\users\sir\appdata\local\temp\tmpoc2lyo.lnk for command line:
"C:\Program Files\Microsoft Visual Studio 8\VC\bin\lib.exe" /nologo /OUT:xxxxx\y
I think this is a bug in scons. Where breaking "
cmd arg1 arg2 ...." into "cmd @tempfile" it seems be to searching for the first space after the start of the string and does not respect quotes or escape characters contained within. If I type ""C:\Program Files\MyVisualStudio\bin\win32\lib.exe" @tempfile" at a DOS prompt, that works fine.
SCons by Steven Knight et al.:
script: v0.97.D001, 2007/05/17 11:35:19, by knight on roxbury
engine: v0.97.D001, 2007/05/17 11:35:19, by knight on roxbury
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 The SCons Foundation
Windows Vista Home edition.
Running through Windows python installation from a cygwin shell.
Here's a SConstruct that reproduces the problem
import os.path
d = os.path.join( "xxxxx", "yyyyyy", "zzzzzz", "aaaaaa" )
try:
os.makedirs( d )
except OSError, e:
pass
# Create a bunch of source files in xxxxx
numSources = 100
sources = []
for x in range(numSources):
source = os.path.join( d, str(x)+ ".cpp" )
sources += [ source ]
print "Making source: ", source
open( source, 'w' ).close()
env = Environment()
# Path to alternative build tools:
env['AR'] = r'"C:\Program Files\Microsoft Visual Studio 8\VC\bin\lib.exe"'
env['CXX'] = r'"C:\Program Files\Microsoft Visual Studio 8\VC\bin\cl.exe"'
env.StaticLibrary( os.path.join( d, "foo.lib" ), sources )
mightyllamas said at 2008-03-29 19:45:45 *** Issue #629 has been marked as a duplicate of this issue. ***
mightyllamas said at 2008-03-30 11:20:37
Here's a patch which adds a $"VARNAME" variable syntax, which expands the variable once, and does not try to further substitute it. For discussion, the mail list thread: http://scons.tigris.org/servlets/BrowseList?list=dev&by=thread&from=643036
the mslink and mslib builders have been changed to use $"AR" and $"LINK".
There is also a new test file included which gives both TEMPFILE and executable paths with spaces some exercise.
This has been tested on ubuntu 7.10. It has been tested as best I can on win xp/python 2.3, but ran into a lot of test suite grief while doing so. It at least worked for the case here, and in a few others that I cooked up.
mightyllamas said at 2008-03-30 11:23:11
Created an attachment (id=350)
patch to add $"VARNAME"
mightyllamas said at 2008-03-30 11:24:00 Created an attachment (id=351) test to exercise tempfile and paths with spaces
mightyllamas said at 2008-04-08 15:29:30 *** Issue #1965 has been marked as a duplicate of this issue. ***
gregnoel said at 2008-06-05 16:49:07 Bug party triage
gregnoel said at 2008-12-26 13:29:16 Adjust triage of issues.
Votes for this issue: 10.
mightyllamas attached spaced.patch at 2008-03-30 11:23:11. patch to add $"VARNAME"
mightyllamas attached tempfiletest.py at 2008-03-30 11:24:00. test to exercise tempfile and paths with spaces
mightyllamas said this issue is duplicated by #629 at 2008-03-29 19:45:47.
mightyllamas said this issue is duplicated by #1965 at 2008-04-08 15:29:31.
In addition to two already closed duplicates, it looks like #2780 is also an instance of this problem. Since both that issue and this one have a patch attached, leaving both open for now until someone gets a look.