[Mono-bugs] [Bug 63430][Nor] New - Mono incorrectly handles file names containing blancs when using UseShellExecute = false in startup info of Process

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 19 Aug 2004 06:40:14 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by gert.driesen@pandora.be.

http://bugzilla.ximian.com/show_bug.cgi?id=63430

--- shadow/63430	2004-08-19 06:40:14.000000000 -0400
+++ shadow/63430.tmp.3925	2004-08-19 06:40:14.000000000 -0400
@@ -0,0 +1,82 @@
+Bug#: 63430
+Product: Mono: Runtime
+Version: unspecified
+OS: 
+OS Details: Windows XP
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gert.driesen@pandora.be               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mono incorrectly handles file names containing blancs when using UseShellExecute = false in startup info of Process
+
+(I'm not sure, but I think this is a regression in Mono 1.0/1.0.1 as I 
+can recall that this worked fine before)
+
+On Windows, the Mono System.Diagnostics.Process class incorrectly handles 
+file names containing blancs (spaces/whitespace) when 
+ProcessStartInfo.UseShellExecute is false.
+
+When specifying a file name containing a blanc, Mono will pass the part 
+of the file name that comes after the blanc as command line argument to 
+the process that is being started.
+
+You can reproduce this by compiling the following code :
+
+using System;
+using System.Diagnostics;
+
+public class EntryPoint {
+  public static void Main(string[] args) {
+    Console.WriteLine("Number of commandline arguments: " + args.Length);
+
+    if (args.Length != 1) {
+      Console.WriteLine("Specify a single filename (containing blancs) as 
+argument.");
+      Environment.Exit(1);
+    }
+
+    Console.WriteLine("filename specified: {0}", args[0]);
+
+    Process process = new Process();
+    process.StartInfo.FileName = args[0];
+    process.StartInfo.UseShellExecute = false;
+    process.Start();
+    process.WaitForExit();
+  }
+}
+
+After building the test app, copy the built assembly to a directory of 
+which the name contains a blanc (eg. "c:\test folder").
+
+Next, start the built app, and pass it the location of the test app in 
+the directory with name containing a blanc as command line argument.
+
+eg. mono test.exe "c:\test folder\test.exe"
+
+When using Mono, you'll get the following result :
+
+Number of command line arguments: 1
+filename specified: c:\test folder\test.exe
+Number of command line arguments: 1
+filename specified: folder\test.exe
+
+Unhandled Exception: System.ComponentModel.Win32Exception: The system 
+cannot find the file specified
+...
+
+As you can see, Mono pass the part of the file name after the blanc (in 
+this case "folder\test.exe") to the process that is started.
+
+When using MS.NET, you'll get the following output :
+
+Number of command line arguments: 1
+filename specified: c:\test folder\test.exe
+Number of command line arguments: 0
+Specify a single filename (containing blancs) as argument.