Bug 47914

Summary: < and > not quoted by quoteArgument causes failure on Windows
Product: Ant Reporter: Nick Pellow <npellow>
Component: CoreAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: major    
Priority: P2    
Version: 1.7.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Nick Pellow 2009-09-28 17:41:19 UTC
Because the Executor uses the cmd.exe to launch the command - if an argument contains a < or a > this gets interpreted by cmd as an input/output redirection and causes the command to fail.

The fix for this should be fairly easy. An extra OR clause in the quoteArgument method of the Commandline class.

       // WIN9x uses a bat file for executing commands
                   || (IS_WIN_9X && argument.indexOf(';') != -1)
                   || (IS_WIN_9X && (argument.indexOf('<') || argument.indexOf('>')) != -1)
Comment 1 Stefan Bodewig 2009-09-29 07:10:16 UTC
The situation is a bit more complex since the same escapes would apply to anything executed via any of the launchers that use a separate interpreter (ScriptCommandLauncher, OS2CommandLauncher, WinNTCommandLauncher and potentially PerlScriptCommandLauncher - I don't know enough about Netware).

So escaping things based on the OS would be wrong, it would have to happen based on the launcher.

Even Win95 should use the Java13CommandLauncher by default, doesn't it?