Matt Benson wrote:

--- Antoine_Lévy-Lambert <[EMAIL PROTECTED]> wrote:


Now I have found the reason why I did not generate
the md5sum files when building the ant 1.6.1 distribution.
the <delete> task in the src-dist target failed, and
md5sum files are normally generated after this delete.
I had not paid attention to this failure.
I do not know why the delete failed, maybe this was


BUILD FAILED

C:\dev\asf\ant\build.xml:1210: Unable to delete
directory C:\dev\asf\ant\apache-ant-1.6.1



Were any or all of the files in the directory deleted?


$ find . | wc -l
1051
[EMAIL PROTECTED] /cygdrive/c/dev/asf/ant/apache-ant-1.6.1
$ gzip -cd ../distribution/src/apache-ant-1.6.1-src.tar.gz | tar tvf - | wc -l
1785
So 734 files were deleted, 1051 remained.


Since this is on Windoze, you may be being bitten by
that weird bug Peter tried to fix in <delete>.

Could well be.

 I have
been hit by it A LOT as I have worked on my
<redirector> stuff.  Apparently the Windows JVMs have
trouble letting go of resources so that sometimes an
attempt to delete a file you have created within the
life of the same VM fail.  I didn't want to believe
it, but it got to the point that my unit tests'
tearDown() methods were failing nearly every time... I
tried the magic solution to any Windows problem
(reboot) to no avail.  Web searches turned up the
dubious advice of calling System.gc(), which finally,
in desperation, I tried, only to discover that it
actually worked.  I verified the results with Sun JVMs
1.4.2 and 1.5.0beta, plus IBM 1.3.1 .  I was going to
commit my changes, but I am still waiting on my
access... the patch is attached.

-Matt



__________________________________




I think it is OK to check in this fix in the HEAD branch, along with a blurb about it in WHATSNEW.
Let's wait until you get your access though, it should not take long.


Antoine

------------------------------------------------------------------------

--- src/main/org/apache/tools/ant/taskdefs/Delete.java  2004-02-13 
09:05:46.000000000 -0600
+++ groundwork/Delete.java      2004-02-12 16:47:44.000000000 -0600
@@ -22,6 +22,7 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.condition.Os;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.PatternSet;
import org.apache.tools.ant.types.selectors.AndSelector;
@@ -535,12 +536,15 @@
//  protected and private methods
//************************************************************************
    /**
-     * Attempt to fix possible race condition when deleting
-     * files on WinXP. If the delete does not work,
+     * Accommodate Windows bug encountered in both Sun and IBM JDKs.
+     * Others possible. If the delete does not work, call System.gc(),
     * wait a little and try again.
     */
    private boolean delete(File f) {
        if (!f.delete()) {
+            if (Os.isFamily("windows")) {
+                System.gc();
+            }
            try {
                Thread.sleep(DELETE_RETRY_SLEEP_MILLIS);
                return f.delete();



------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to