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


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

bug #11070: w32 process spawning corrupts argument list

Submitted by:  Carl-Adam Brengesjo <ptah>
Submitted on:  Sat Nov 20 23:43:27 2004  
Category: NoneSeverity: 2 - Minor
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Sat Nov 20 23:43:27 2004, 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.

class Test
static void Main()

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

<target name="all">


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

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

<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"/>


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


[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
[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

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

Carl-Adam Brengesjo <ptah>
Project Member


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


CC list is empty


Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.


Please enter the title of George Orwell's famous dystopian book (it's a date):



No Changes Have Been Made to This Item

Back to the top

Powered by Savane 3.1-cleanup