complete-ant-cmd.pl is a helper script which allows BASH and KSH users to complete ant targets using shell completion facility. It works by calling ant -p to get list of possible targets, and caching the result. The cached result is stored in working directory, in file ".ant-targets-XXX.xml" (XXX stands for the build file name) Unfortunately, if ant -p fails (e.g. with OOM exception), empty completion list is cached for the directory. Once this happens, the completion stops working. Steps to reproduce (bash): 1. Associate complete-ant-cmd.pl with the bash completion facility: complete -C $ANT_HOME/bin/complete-ant-cmd.pl ant 2. create build file build.xml, containing the following input: <project name="test"> <target name="test"/> </project> 2. verify that ant completion works type ant and hit TAB (assuming TAB is the completion key) Expected result: the command line should be completed to $ ant test 3. Delete file ./.ant-targets-build.xml 4. Simulate exception in ant. One way to do so would be setting ANT_HOME to wrong location: export ANT_HOME=/tmp 5. type ant and hit TAB Expected result: ant Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher Expected result - 0 sized file called ./.ant-targets-build.xml will be created. 6. restore ANT_HOME to original value 7. type ant and hit TAB Completion will not work.
Created attachment 25179 [details] Proposed patch to the bug The proposed patch checks if the cache file exists, but is empty. In this case, the completion script proceeds to regenerating the cache file.
Omar, please don't assign the bug to yourself or the Ant developers won't see any changes.
I'm sorry I misspelled your name, will look into your patch shortly.
patch is in svn revision 927416 Thanks!