Bugs item #1539295, was opened at 2006-08-12 12:28 Message generated for change (Comment added) made by nnorwitz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1539295&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Distutils Group: None Status: Open Resolution: None Priority: 5 Submitted By: Albert Strasheim (albertstrasheim) Assigned to: Nobody/Anonymous (nobody) Summary: Long command lines don't work on Windows Initial Comment: Windows has a 32k command line limit, described here: http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx The SciPy project is running into problems when using distutils to compile LAPACK from source, because the large number of source files results in a command line of more than 70,000 characters. Windows has a way of dealing with this problem, namely putting the command line arguments in a file and passing that file to executable with prepended with an @, i.e. you want to run something like lib.exe @tempdir\tempargs.lnk SCons takes care of this through it's TEMPFILE mechanism which uses the TempFileMunge class which can be perused here: http://scons.tigris.org/source/browse/scons/trunk/src/engine/SCons/Platform/__init__.py?rev=1582&view=markup I think this problem can easily be addressed in distutils by modifying the _spawn_nt method in spawn.py to switch to this temp file method when the command line length exceeds some threshold. ---------------------------------------------------------------------- >Comment By: Neal Norwitz (nnorwitz) Date: 2006-08-12 17:16 Message: Logged In: YES user_id=33168 Thanks for the patch! It looks pretty good, but there are a few changes (and additions) I would like to see. I don't understand why you use 2k in the patch, but mention the limit is 32k. You should use mkstemp() instead of mktemp(). That will open the file for you, so you can just do os.write(fd, data). You will need to close the file. I would prefer to see a single os.spawnv() call. You would need tmp defined (but possibly None) and in the finally, you would have to check if tmp: os.remove(). It would also be nice to see test and doc updates. The tests are in Lib/distutils/tests. Thanks again for the patch. ---------------------------------------------------------------------- Comment By: Albert Strasheim (albertstrasheim) Date: 2006-08-12 17:09 Message: Logged In: YES user_id=945096 Looks like the max length on Windows 95 might be as low as 256 characters, but I'm not sure about this. It seems Windows 98 and Windows Me have a limit of 2048 characters. SCons assumes 2048 characters on any Windows system, so I did the same. ---------------------------------------------------------------------- Comment By: Albert Strasheim (albertstrasheim) Date: 2006-08-12 17:03 Message: Logged In: YES user_id=945096 Attached a first try at a patch. Some things that could still be changed: - We might want to print a different log info message when using a temp file instead of calling the command directly - Restructure the code so that the spawnv call only appears in one place The setup.py I attached should allow anyone to duplicate this problem. ---------------------------------------------------------------------- Comment By: Albert Strasheim (albertstrasheim) Date: 2006-08-12 14:56 Message: Logged In: YES user_id=945096 Okay, I'll see what I can do. ---------------------------------------------------------------------- Comment By: Neal Norwitz (nnorwitz) Date: 2006-08-12 14:53 Message: Logged In: YES user_id=33168 Albert, could you try to work up a patch implementing this? It would be much more likely to get fixed that way. It should also work with older Windows (9x/ME). Cheers, n ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1539295&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com