mail-archives/mono-bugs/2004-June/016704.html

174 строки
5.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 59576][Maj] New - Incorrect command line parameters passed by System.Diagnostics.Process
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:bugzilla-daemon%40bugzilla.ximian.com">
<META NAME="robots" CONTENT="index,nofollow">
<LINK REL="Previous" HREF="016703.html">
<LINK REL="Next" HREF="016705.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 59576][Maj] New - Incorrect command line parameters passed by System.Diagnostics.Process
</H1>
<B>bugzilla-daemon@bugzilla.ximian.com
</B>
<A HREF="mailto:bugzilla-daemon%40bugzilla.ximian.com"
TITLE="[Mono-bugs] [Bug 59576][Maj] New - Incorrect command line parameters passed by System.Diagnostics.Process">bugzilla-daemon@bugzilla.ximian.com
</A><BR>
<I>Thu, 3 Jun 2004 16:28:33 -0400 (EDT)</I>
<P><UL>
<LI> Previous message: <A HREF="016703.html">[Mono-bugs] [Bug 51851][Nor] Changed - MONO Bug loading Hierarchical XML into DataSet
</A></li>
<LI> Next message: <A HREF="016705.html">[Mono-bugs] [Bug 59576][Maj] Changed - Incorrect command line parameters passed by System.Diagnostics.Process
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#16704">[ date ]</a>
<a href="thread.html#16704">[ thread ]</a>
<a href="subject.html#16704">[ subject ]</a>
<a href="author.html#16704">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>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 <A HREF="mailto:dol@2a.pl.">dol@2a.pl.</A>
<A HREF="http://bugzilla.ximian.com/show_bug.cgi?id=59576">http://bugzilla.ximian.com/show_bug.cgi?id=59576</A>
--- shadow/59576 2004-06-03 16:28:33.000000000 -0400
+++ shadow/59576.tmp.15831 2004-06-03 16:28:33.000000000 -0400
@@ -0,0 +1,110 @@
+Bug#: 59576
+Product: Mono: Runtime
+Version: unspecified
+OS:
+OS Details: Windows XP SP1
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: misc
+AssignedTo: <A HREF="mailto:mono-bugs@ximian.com">mono-bugs@ximian.com</A>
+ReportedBy: <A HREF="mailto:dol@2a.pl">dol@2a.pl</A>
+QAContact: <A HREF="mailto:mono-bugs@ximian.com">mono-bugs@ximian.com</A>
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Incorrect command line parameters passed by System.Diagnostics.Process
+
+Description of Problem:
+
+On Win32 command line parameters to processes created via
+System.Diagnostics.Process are passed incorrectly to the new process. This
+problem is connected with an idiosyncrasy of the Win32 CreateProcess call.
+
+
+Steps to reproduce the problem:
+
+1. Create test1.cs file with the following contents:
+
+---- test1.cs
+using System.Diagnostics;
+
+class test1
+{
+ public static void Main()
+ {
+ Process p = new Process();
+
+ p.StartInfo.UseShellExecute = false;
+ p.StartInfo.FileName = &quot;notepad.exe&quot;;
+ p.StartInfo.Arguments = &quot;test1.cs&quot;;
+
+ p.Start();
+
+ }
+}
+---- test1.cs end
+
+2. Compile test1.cs to test1.exe.
+
+3. Start test1.exe in directory containing test1.cs file.
+
+
+Actual Results:
+
+Notepad is started as expected, but test1.cs file is not loaded.
+
+
+Expected Results:
+
+Notepad should start and test1.cs should be loaded into it.
+
+
+How often does this happen?
+
+Always.
+
+
+Additional Information:
+
+As I have mentioned at the beginning of the report, CreateProcess call in
+Win32 has one 'feature' that is poorly documented and frequently confuses
+programmers. Its second parameter 'lpCommandLine' should contain full path
+of the started EXE file (ARGV[0]), followed by actual command line
+parameters (ARGV[1],...).
+
+In the above example .NET runtime sets command line to:
+
+&quot;notepad.exe&quot; test1.cs
+
+
+Mono sets this to:
+
+test1.cs
+
+
+It seems to me that the problem is in CreateProcess call in
+mono/mono/metadata/process.c file in
+ves_icall_System_Diagnostics_Process_Start_internal function.
+
+In line 866 (in version 1.24 of the file):
+
+ret=CreateProcess (shell_path, mono_string_chars (cmd), NULL, NULL, TRUE,
+CREATE_UNICODE_ENVIRONMENT, env_vars, dir, &amp;startinfo, &amp;procinfo);
+
+second parameter - currently 'mono_string_chars (cmd)' should be a
+concatenation (using C# syntax): &quot;\&quot;&quot; + shell_path + &quot;\&quot; &quot; + cmd.
+
+It seems that putting EXE name in quotes does not cause problems and it is
+necessary for sure, when full path name contains spaces (otherwise
+parameter parsing code in various C libs can get confused).
+
+I cannot provide you with a patch because I do not have a full compilation
+environment to verify it. Sorry.
+
+I can only suggest downloading Process Explorer utility from:
+<A HREF="http://www.sysinternals.com/ntw2k/freeware/procexp.shtml">http://www.sysinternals.com/ntw2k/freeware/procexp.shtml</A>
+
+With this utility, one can easily see various details about running
+processes, including command line parameters.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI> Previous message: <A HREF="016703.html">[Mono-bugs] [Bug 51851][Nor] Changed - MONO Bug loading Hierarchical XML into DataSet
</A></li>
<LI> Next message: <A HREF="016705.html">[Mono-bugs] [Bug 59576][Maj] Changed - Incorrect command line parameters passed by System.Diagnostics.Process
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#16704">[ date ]</a>
<a href="thread.html#16704">[ thread ]</a>
<a href="subject.html#16704">[ subject ]</a>
<a href="author.html#16704">[ author ]</a>
</LI>
</UL>
</body></html>