[Mono-bugs] [Bug 520650] New: Process.Start inherits environment even when EnvironmentVariables.Clear has been used
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Jul 9 10:52:04 EDT 2009
http://bugzilla.novell.com/show_bug.cgi?id=520650
Summary: Process.Start inherits environment even when
EnvironmentVariables.Clear has been used
Classification: Mono
Product: Mono: Class Libraries
Version: 2.4.x
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: P5 - None
Component: System
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: Csaba.Halasz at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b2)
Gecko/20081212 Minefield/3.1b2
If you create a ProcessStartInfo and call EnvironmentVariables.Clear,
subsequent Process.Start call will inherit the current environment instead of
clearing it.
Reproducible: Always
Steps to Reproduce:
Compile and run following test code, after setting environment variable "foo"
to some value. (Similar works for linux with sh -c echo $foo)
using System;
using System.Diagnostics;
class MainClass
{
static void Main()
{
string Cmd = "cmd";
string Args = "/c echo %foo%";
ProcessStartInfo Info = new ProcessStartInfo();
Info.FileName = Cmd;
Info.UseShellExecute = false;
Info.Arguments = Args;
Process.Start(Info);
Info.EnvironmentVariables.Clear();
Process.Start(Info);
}
}
Actual Results:
C:\temp>set foo=bar
C:\temp>MainClass.exe
bar
%foo%
C:\temp>mono MainClass.exe
bar
bar
Expected Results:
bar
%foo%
Problem seems to be in mcs/class/System/System.Diagnostics/Process.cs, method
Start_noshell. It uses the HaveEnvVars property of the ProcessStartInfo, which
returns false for an empty but existing set.
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list