https://issues.apache.org/bugzilla/show_bug.cgi?id=48980

           Summary: complete-ant-cmd.pl can cache empty completion list if
                    ant fails with OOM
           Product: Ant
           Version: 1.7.1
          Platform: All
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Other
        AssignedTo: [email protected]
        ReportedBy: [email protected]


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.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to