You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2009/01/28 01:31:34 UTC

DO NOT REPLY [Bug 45902] Up-to-date checks for JARs broken due to comparison of dir timestamps

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





--- Comment #1 from Jesse Glick <jg...@netbeans.org>  2009-01-27 16:31:33 PST ---
I think I have a reproducible test case finally, after seeing it happen to me
on my own build script:

<project name="testant45902" default="x" basedir=".">
    <target name="x">
        <delete dir="demo"/>
        <mkdir dir="demo/src/p"/>
        <touch file="demo/src/p/X.java"/>
        <touch file="demo/src/p/x.properties"/>
        <mkdir dir="demo/build"/>
        <copy todir="demo/build">
            <fileset dir="demo/src" includes="**/*.java"/>
        </copy>
        <sleep seconds="1"/>
        <echo>(first JAR task)</echo>
        <jar jarfile="demo/jar.jar">
            <fileset dir="demo/build"/>
            <fileset dir="demo/src" excludes="**/*.java"/>
        </jar>
        <sleep seconds="1"/>
        <touch file="demo/src/p/y.properties"/>
        <sleep seconds="1"/>
        <delete file="demo/src/p/y.properties"/>
        <echo>(second JAR task)</echo>
        <jar jarfile="demo/jar.jar">
            <fileset dir="demo/build"/>
            <fileset dir="demo/src" excludes="**/*.java"/>
        </jar>
        <sleep seconds="1"/>
        <echo>(third JAR task)</echo>
        <jar jarfile="demo/jar.jar">
            <fileset dir="demo/build"/>
            <fileset dir="demo/src" excludes="**/*.java"/>
        </jar>
        <echo>(fourth JAR task)</echo>
        <jar jarfile="demo/jar.jar">
            <fileset dir="demo/build"/>
            <fileset dir="demo/src" excludes="**/*.java"/>
        </jar>
    </target>
</project>

tmp$ /space/ant170/bin/ant -f testant45902.xml 
Buildfile: testant45902.xml

x:
Deleting directory /tmp/demo
Created dir: /tmp/demo/src/p
Creating /tmp/demo/src/p/X.java
Creating /tmp/demo/src/p/x.properties
Created dir: /tmp/demo/build
Copying 1 file to /tmp/demo/build
(first JAR task)
Building jar: /tmp/demo/jar.jar
Creating /tmp/demo/src/p/y.properties
Deleting: /tmp/demo/src/p/y.properties
(second JAR task)
(third JAR task)
(fourth JAR task)

BUILD SUCCESSFUL
Total time: 4 seconds

tmp$ /space/ant171/bin/ant -f testant45902.xml 
Buildfile: testant45902.xml

testant45902.x:
Deleting directory /tmp/demo
Created dir: /tmp/demo/src/p
Creating /tmp/demo/src/p/X.java
Creating /tmp/demo/src/p/x.properties
Created dir: /tmp/demo/build
Copying 1 file to /tmp/demo/build
(first JAR task)
Building jar: /tmp/demo/jar.jar
Creating /tmp/demo/src/p/y.properties
Deleting: /tmp/demo/src/p/y.properties
(second JAR task)
Building jar: /tmp/demo/jar.jar
(third JAR task)
Building jar: /tmp/demo/jar.jar
(fourth JAR task)
Building jar: /tmp/demo/jar.jar

BUILD SUCCESSFUL
Total time: 4 seconds

When running with -v under 1.7.1 you can see that <jar> is getting confused by
directory timestamps:

....
(second JAR task)
p omitted as /tmp/demo/jar.jar:p/ is up to date.
p/X.java omitted as /tmp/demo/jar.jar:p/X.java is up to date.
p added as p/ is outdated.
p/x.properties omitted as /tmp/demo/jar.jar:p/x.properties is up to date.
Building jar: /tmp/demo/jar.jar
....

If I take by-the-second timestamp info in the demo dir after completion, I see

19:26:47 build
19:26:47 build/p
19:26:47 build/p/X.java
19:26:51 jar.jar
19:26:47 src
19:26:50 src/p
19:26:47 src/p/X.java
19:26:47 src/p/x.properties

and inside jar.jar:

19:26:52 META-INF/
19:26:50 META-INF/MANIFEST.MF
19:26:48 p/
19:26:48 p/X.java
19:26:48 p/x.properties


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