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/10/16 01:34:17 UTC

DO NOT REPLY [Bug 48008] New: touch task truncates timestamps

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

           Summary: touch task truncates timestamps
           Product: Ant
           Version: 1.7.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: alex-pub.apache-ant@reflexion.net


When I use a touch task with a mapper
<touch
  mkdirs="true"
  verbose="${TALK}"
>
  <fileset dir="${orig-dir}"/>
  <globmapper from="*" to="${shadow-dir}/*"/>
</touch>

Produces empty files that are OLDER than sources.
After running this task and using ls --time-style=full-iso, I get the following
timestamp for source:
   2009-09-30 07:44:26.290894100 -0400

And this timestamp for target
   2009-09-30 07:44:26.290000000 -0400

Notice that target now is older than source.

This breaks <ant-contrib:outofdate> task later on.

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

DO NOT REPLY [Bug 48008] touch task truncates timestamps

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48008

Alexander Pogrebnyak <al...@reflexion.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |

--- Comment #3 from Alexander Pogrebnyak <al...@reflexion.net> 2009-11-17 10:54:22 UTC ---
Is it possible to add "roundup" attribute to Touch task, similar in concept to
one in Zip task.

Then if the attribute is set, you can do 

newFile.setLastModified( origFile.lastModified() + 1 ) as proposed in Comment 2

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

DO NOT REPLY [Bug 48008] touch task truncates timestamps

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48008

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX

--- Comment #1 from Stefan Bodewig <bo...@apache.org> 2009-10-20 23:22:48 UTC ---
Ant uses the lastModified and setLastModified methods in java.io.File
http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html which doesn't allow a
granularity smaller than millisecond.

I don't understand why outofdate seems to be rounding up here but as far as I
can see there isn't anything touch could do differently as it set the last
modified time to the one read from the source file.

CANTFIX rather than WONTFIX.

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

DO NOT REPLY [Bug 48008] touch task truncates timestamps

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48008

--- Comment #2 from Alexander Pogrebnyak <al...@reflexion.net> 2009-10-21 04:57:09 UTC ---
(In reply to comment #1)
> Ant uses the lastModified and setLastModified methods in java.io.File
> http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html which doesn't allow a
> granularity smaller than millisecond.
> 
> I don't understand why outofdate seems to be rounding up here but as far as I
> can see there isn't anything touch could do differently as it set the last
> modified time to the one read from the source file.
> 
> CANTFIX rather than WONTFIX.

How about setting it to
newFile.setLastModified( origFile.lastModified() + 1 )

This will definitely round it in the right direction.  Plus it would probably
integrate better with the tools external to ant (e.g. make), that could have
used the newly created file.

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