ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 34893] New: - unzip task input file remains open after exception
Date Thu, 12 May 2005 13:21:37 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34893>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34893

           Summary: unzip task input file remains open after exception
           Product: Ant
           Version: unspecified
          Platform: All
        OS/Version: Windows Server 2003
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: gjfdh@yahoo.com


The JVM is left dirty after the unzip task throws an exception due to a 
corrupt or otherwise improperly formatted zip file.  The JVM is left holding 
the input file open.

Here's a test case.  The build file, below, uses the subant task to capture, 
log, and otherwise ignore the exception from unzip.  The build file creates a 
zero-length zip file (xxx.zip).  The unzip task is run on the zip and an 
exception is thrown.  The build then attempts to delete the zip and cannot do 
so because (I presume) the JVM is holding an open lock.  The only way to 
recover, once you are in this state, that I have found is to exit the JVM.

I looked through the ant source code but was unable to find the bug myself, so 
I don't have a suggested fix for this one.  Most users who run ant from the 
command line would not see this bug because the JVM would exit after the unzip 
exception.  However, this bug is important to users whose JVM continues to 
execute after ant is invoked (e.g. ant users who are invoking ant from within 
a greater Java or Jython program).  The open corrupt zip file can cause a 
logjam of errors when it cannot be removed.





<project default="default">
   <target name="do-unzip">
      <touch file="xxx.zip"/>
      <unzip src="xxx.zip" dest="."/>
   </target>
   <target name="default">
      <subant target="do-unzip" failonerror="false">
        <fileset dir="." includes="build.xml"/>
      </subant>
      <delete file="xxx.zip"/>
   </target>
</project>


C:\>%ant_home%\bin\ant -verbose
Apache Ant version 1.6.2 compiled on July 16 2004
Buildfile: build.xml
Detected Java version: 1.4 in: C:\Program Files\IBM\Java142\jre
Detected OS: Windows 2003
parsing buildfile C:\build.xml with URI = file:///C:/build.xml
Project base dir set to: C:\
Build sequence for target `default' is [default]
Complete build sequence is [default, do-unzip, ]

default:
   [subant] calling target do-unzip in build file C:\build.xml
parsing buildfile C:\build.xml with URI = file:///C:/build.xml
Project base dir set to: C:\
   [subant] Entering C:\build.xml...
Build sequence for target `do-unzip' is [do-unzip]
Complete build sequence is [do-unzip, default, ]

do-unzip:
    [unzip] Expanding: C:\xxx.zip into C:\
   [subant] Exiting C:\build.xml.
   [subant] Failure for target 'do-unzip' of: C:\build.xml
   [subant] The following error occurred while executing this line:
   [subant] C:\build.xml:4: Error while expanding C:\xxx.zip
   [delete] Deleting: C:\xxx.zip

BUILD FAILED
C:\build.xml:10: Unable to delete file C:\xxx.zip
        at org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:471)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
        at org.apache.tools.ant.Main.runBuild(Main.java:673)
        at org.apache.tools.ant.Main.startAnt(Main.java:188)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)

Total time: 1 second
C:\>

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message