Bug 28067 - found and fixed a bug - ntvdm problem while running ant 1.5 using JDK 1.4.2_0x on Windows 2003 Server
Summary: found and fixed a bug - ntvdm problem while running ant 1.5 using JDK 1.4.2_0...
Status: RESOLVED FIXED
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: 1.5
Hardware: PC other
: P1 blocker (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords: ErrorMessage, FAQ
Depends on:
Blocks:
 
Reported: 2004-03-30 22:45 UTC by Irene Rusman
Modified: 2017-03-03 12:05 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Irene Rusman 2004-03-30 22:45:20 UTC
I found a bug in the Ant 1.5 on Windows 2003 expressing itself in ntvdm.exe 
exception:
************************************************************************
C:\WINDOWS\system32\ntvdm.exe
Error while setting up environment for the application. Choose "Close" to 
terminate the application.
************************************************************************
It happens when we source the current environment variables from the 
environment, rather than properties file, starting with 
<property environment="env"/>

Doing my research of the Ant 1.5 source code I established that while ant 1.5 
correctly reports Windows 2003 as an operating system being run in a verbose 
mode, when it's coming to choosing the executable for the command line, it 
wrongly picks command.com instead of cmd.exe.

I changed the logic of getProcEnvCommand() method in Execute.java to overcome 
this problem so that it will work with all systems it worked before, plus 
windows 2003.

I'll describe the change to the source code in getProcEnvCommand() method in 
Execute.java of Ant 1.5:
***************************************************************************
original code snippet with its author's comments (bug: the execution thread 
was testing "if" clause negatively and executing the code in "else" clause) 
***************************************************************************
...
else if (Os.isFamily("windows")) {
            // Determine if we're running under XP/2000/NT or 98/95
            if (!Os.isFamily("win9x")) {
                // Windows XP/2000/NT
                String[] cmd = {"cmd", "/c", "set" };
                return cmd;
            } else {
                // Windows 98/95
                String[] cmd = {"command.com", "/c", "set" };
                return cmd;
            }
...
******************************************************************************
new code snippet substituting the original one; the execution thread tests 
negatively the "if" clause and executes the "else" clause
******************************************************************************

 //IR debuggged code
        }else if (Os.isFamily("windows")) {
           // Determine if we're running under XP/2000/NT/2003 or 98/95
            if (Os.isFamily("win9x")) {
                // Windows 98/95
                String[] cmd = {"command.com", "/c", "set" };
                return cmd;
            } else {
                // Windows XP/2000/NT/2003
                String[] cmd = {"cmd", "/c", "set" };
                return cmd;
            }
**************************************************************************
I didn't check the source code of other Ant versions. If they have the same 
snippet causing ntvdm.exe exception you may want to use my fix for them too. 

Regards,
Irene.

Irene Rusman.
Sr. Software Engineer,
BEA Systems.
irusman@bea.com
office: 408.570.8529
Comment 1 Matt Benson 2004-03-30 23:23:15 UTC
Fixed in CVS; thanks!
Comment 2 Irene Rusman 2004-03-31 00:13:15 UTC
I just looked at the source code of Ant 1.6.1. It has the same 
snippet that will cause ntvdm.exe exception on Windows 2003. Please apply my 
fix for the versions Ant 1.5-1.6.1 and all the rest as needed.

Irene.

Irene Rusman
Sr. Software Engineer,
BEA Systems,
irusman@bea.com

Comment 3 Matt Benson 2004-04-01 21:45:25 UTC
Re:  "Please apply my fix for the versions Ant 1.5-1.6.1 and all the rest as 
needed."

FYI Generally these only get fixed in CVS for the next release...

Thanks,
Matt
Comment 4 Diane Schuda 2006-11-02 07:50:38 UTC
I am new to Apache but support an application that is using Ant 1.5 on Win2003. 
We are encountering this error. Where can I get this fix?
Comment 5 Steve Loughran 2006-11-02 07:55:32 UTC
Diane,

You need to get a later version of Ant, be it 1.6.5 or 1.7beta
Comment 6 betty 2017-03-03 12:04:02 UTC
(In reply to Matt Benson from comment #1)
> Fixed in CVS; thanks!

(In reply to Matt Benson from comment #3)
> Re:  "Please apply my fix for the versions Ant 1.5-1.6.1 and all the rest as 
> needed."
> 
> FYI Generally these only get fixed in CVS for the next release...
> 
> Thanks,
> Matt


test bugzilla
Comment 7 betty 2017-03-03 12:05:43 UTC
(In reply to Steve Loughran from comment #5)
> Diane,
> 
> You need to get a later version of Ant, be it 1.6.5 or 1.7beta


hello test!