Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331380 - process builders should clone environment from connection, not modify it
Summary: process builders should clone environment from connection, not modify it
Status: RESOLVED FIXED
Alias: None
Product: PTP
Classification: Tools
Component: Core (show other bugs)
Version: 4.0.5   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 4.0.6   Edit
Assignee: Chris Recoskie CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-29 18:04 EST by Chris Recoskie CLA
Modified: 2010-11-29 21:39 EST (History)
2 users (show)

See Also:


Attachments
patch (3.47 KB, patch)
2010-11-29 21:21 EST, Chris Recoskie CLA
recoskie: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.