bugDotGNU Portable.NET - Bugs: bug #11070, w32 process spawning corrupts...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #11070: w32 process spawning corrupts argument list

Submitter:  Carl-Adam Brengesjo <ptah>
Submitted:  Sat 20 Nov 2004 11:43:27 PM UTC
   
 
Category:  None Severity:  2 - Minor
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Sat 20 Nov 2004 11:43:27 PM UTC, original submission:  

Discovered this while working with csant and MS.NET 2.0 (beta), but as it's caused in support/spawn.c it affects the rest of pnet aswell.  However, I cannot explain why this hasn't showed up before (e.g. when I was using .net 1.1).

A simple testcase causes something simlar to:

fatal error CS2021: File name '"C:\DOCUME~1\ptah\LOCALS~1\Temp\CMD235.tmp"' is too long or invalid

I tried to run the commandline csant output to me, perfect result. no warnings/errors whatsoever, I couldn't get it what was causing the errors.

At first I thought it was .NET 2.0 which internally used temp files during comppile, but very soon I realized it was actually pnet which, for various reasons, rewrites the argument list and executes a complete different one from the one printed by csant.

Anyways, spawn.c writes "the options to a temporary file instead" and then append the arguments list with the filename of this temporary file instead. And it's that temp file csc is whining about.

I was able to work around the problem by increasing the maximum argument list length allowed on line 105 (and thus preventing pnet to use a temp file) but I'm not sure of the consequenses of this, and more permanent solution is required.

PS. Any idea why this havn't shown up before? I mean, we're using csant and that spawn function every time we compile pnetlib on cygwin/w32.

test.cs:
class Test
{
static void Main()
{
}
}

test.csant:
<?xml version="1.0">
<project name="test" default="all">

<target name="all">

<compile
output="test.exe"
target="exe"
unsafe="true"
debug="true"
nostdlib="false"
optimize="false"
install="false"
installasdefault="false">

<sources>
<includes name="**/*.cs"/>
</sources>

<references>
<file name="System.dll"/>
<file name="System.Windows.Forms.dll"/>
</references>

<arg compiler="cscc" value="-flatin1-charset"/>
<arg compiler="csc" value="/nowarn:162"/>
<arg compiler="csc" value="/nowarn:164"/>
<arg compiler="csc" value="/nowarn:169"/>
<arg compiler="csc" value="/nowarn:219"/>
<arg compiler="csc" value="/nowarn:649"/>
<arg compiler="csc" value="/nowarn:414"/>
</compile>

</target>

<target name="clean">
<delete file="test.exe"/>
<delete file="test.pdb"/>
</target>

</project>

console.log:
[ptah@foo:~/dev/test]$ ls -la
total 2
drwxr-xr-x+   2 ptah     None            0 Nov 21 00:26 ./
drwxr-xr-x+   7 ptah     None            0 Nov 20 22:47 ../
-rwxr-xr-x    1 ptah     None           41 Nov 20 22:49 test.cs*
-rwxr-xr-x    1 ptah     None          894 Nov 20 22:49 test.csant*
[ptah@foo:~/dev/test]$ csant --compiler csc
Building project `test'
Building target `all' for project `test'
csc /nologo /debug+ /unsafe /optimize- /target:exe /out:test.exe /define:DEBUG;TRACE /reference:System.dll;System.Windows.Forms.dll /nowarn:162 /nowarn:164 /nowarn:169 /nowarn:219 /nowarn:649 /nowarn:414 test.cs
fatal error CS2021: File name '"C:\DOCUME~1\ptah\LOCALS~1\Temp\CMD238.tmp"' is too long or invalid
* Target `all' for project `test' failed *
* Project `test' build failed *
[ptah@foo:~/dev/test]$ cd ../pnet/csant
[ptah@foo:~/dev/pnet/csant]$ cat ../support/spawn.c|grep -n 64
105:                    if(len >= 64)
[ptah@foo:~/dev/pnet/csant]$ scite ../support/spawn.c
[ptah@foo:~/dev/pnet/csant]$ cat ../support/spawn.c|grep -n 1024
105:                    if(len >= 1024)
[ptah@foo:~/dev/pnet/csant]$ cd ../support && make && cd ../csant && make && make install
...snippet...
[ptah@foo:~/dev/pnet/csant]$ cd ../../test && csant --compiler csc
Building project `test'
Building target `all' for project `test'
csc /nologo /debug+ /unsafe /optimize- /target:exe /out:test.exe /define:DEBUG;TRACE /reference:System.dll;System.Windows.Forms.dl
l /nowarn:162 /nowarn:164 /nowarn:169 /nowarn:219 /nowarn:649 /nowarn:414 test.cs
Leaving target `all' for project `test'
Ending project `test'
[ptah@foo:~/dev/test]$ ./test.exe
[ptah@foo:~/dev/test]$

(running Windows XP SP2 + up-to-date cygwin)

Carl-Adam Brengesjo <ptah>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

No changes have been made to this item

Back to the top

Powered by Savane 3.13-758e.
Corresponding source code