Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 331380

Summary: process builders should clone environment from connection, not modify it
Product: [Tools] PTP Reporter: Chris Recoskie <recoskie>
Component: CoreAssignee: Chris Recoskie <recoskie>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: ptp-inbox, vivkong
Version: 4.0.5   
Target Milestone: 4.0.6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch recoskie: iplog-

Description Chris Recoskie CLA 2010-11-29 18:04:06 EST
We found a problem where if you added an environment variable to your project, and then do a build, you cannot seem to remove the environment variable.

After debugging for a while, I think I've figured it out...  after you build the project, the environment variables that were used to launch the remote process are erroneously fed back into the build system's environment variable supplier.  Once you delete the user defined variable, the system still thinks that there was an original value coming from the build system that was shadowed by the user modified value.  Hence when you delete the value, there is another entry for it that shows up with its origin listed as "Build System."  This entry can't be deleted.

The reason for this is as follows.  When an RSEProcessBuilder is created, it gets its environment map from its parent connection.  However, instead of copying the map, it uses it directly.  This means that the original environment for the parent connection gets modified whenever you send a differing environment to a process builder that uses the connection.  Thereafter, when the build system asks the connection for its environment, it gets the modified one, even though the environment for the connection should never be modified.

The solution is to have the process builder clone the environment map instead of using it directly.  That way any changes the process builder makes won't be reflected in its parent connection.

At the same time, the javadoc for IRemoteConnection says that getEnv() is supposed to return an unmodifiable map.  The RSEConnection violates this contract and returns a modifiable map.

Patch coming tonight/tomorrow.
Comment 1 Chris Recoskie CLA 2010-11-29 21:21:40 EST
Created attachment 184090 [details]
patch

There was a similar problem in Remote Tools.  My patch addresses both.
Comment 2 Chris Recoskie CLA 2010-11-29 21:39:32 EST
Patch applied to ptp_4_0 and HEAD.