ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28874] New: - Execute class has buggy patchEnvironment() implementation
Date Mon, 10 May 2004 14:48:54 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28874>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28874

Execute class has buggy patchEnvironment() implementation

           Summary: Execute class has buggy patchEnvironment()
                    implementation
           Product: Ant
           Version: 1.5.4
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: xavier.witdouck@ubs.com


When trying to extend an environment for a forked VM for example, it is 
possible to specify modified environment variables, such as pre-pending 
something to the PATH for example.  The modified environment is worked out 
within the Execute class' patchEnvironment() method which has two fundamental 
problems which could cause things to go subtly wrong.

1.  It does case sensitive matching of environment variable keys on all 
platforms.  This should not be the case on Windows.  Our XP machines use "Path" 
for the PATH environment variable, however this is not necessarily guaranteed.  
Personally I suggest to extend the <env> element with an optional boolean 
attribute to specify whether the environment variable is case sensitive or not.

2.  Looking at the patchEnvironment() implementation, it matches keys by using 
string.startsWith() which means that PATH_CAT also matches PATH substring.  
This could dangerously cause some environment variables to be dropped off your 
forked process leading to all sorts of potential problems.  Keys should be 
matched for exact length match as well as contents, and also check case 
insestive matches according to the platform or possibly some user specification.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message