Bug 47914 - < and > not quoted by quoteArgument causes failure on Windows
Summary: < and > not quoted by quoteArgument causes failure on Windows
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: 1.7.1
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2009-09-28 17:41 UTC by Nick Pellow
Modified: 2009-09-29 07:10 UTC (History)
0 users


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