You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Iulian Musat <iu...@cst.ro> on 2000/06/07 11:55:55 UTC

bug with "tar" task

Hello everybody!


I found a bug related to building tar files with tar task.

In org.apache.tools.ant.taskdefs.Tar:

    protected void tarFile(File file, TarOutputStream tOut, String
vPath)
        throws IOException
    {
	[....]
        te.setModTime(file.lastModified() / 1000);
	[...]
    }

The return of lastModified is divided by 1000 to translate milliseconds
to seconds, but
org.apache.tools.ant.tar.TarEntry.setModTime expect a Java time (in
milliseconds) also:
    public void setModTime(long time) {
        this.modTime  = time / 1000;
    }   

Fixed:
in org.apache.tools.ant.taskdefs.Tar.tarFile remove the "/ 1000".

Suggestion:
Probably a function to translate Java time to unix time will be a good
idea (take a look into org.apache.tools.ant.tar.TarEntry: there are a
lot of "/ 1000" :-)

Thank you.

Re: Feature

Posted by Ken Wood <kw...@i2.com>.
You didn't specify in detail what you
want, but there is a command line option:

  ant -logfile FILE_NAME.

Is that what you want?

Brill Pappin wrote:
> 
> I'd like a way to redirect output to a log file... is this already built
> into Ant, or is someone working on it?
> 
> - Brill Pappin

-

Feature

Posted by Brill Pappin <jo...@jmonkey.com>.
I'd like a way to redirect output to a log file... is this already built
into Ant, or is someone working on it?

- Brill Pappin


Re: bug with "tar" task

Posted by Iulian Musat <iu...@cst.ro>.
Thank you very much !
Till now I didn't use untar task :-)

Iulian

Re: bug with "tar" task

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "IM" == Iulian Musat <iu...@cst.ro> writes:

 IM> Hello everybody!  I found a bug related to building tar files
 IM> with tar task.

Thanks Iulian for reporting this, I've appended a trivial patch with
your solution for completeness.

I haven't been aware of this feature of the Tar task and thought I
should use it in the Untar task (if Ant is run by a Java 2 VM). The
second patch enables Untar to reset the modification time of extracted
files.

 IM> Suggestion: Probably a function to translate Java time to unix
 IM> time will be a good idea (take a look into
 IM> org.apache.tools.ant.tar.TarEntry: there are a lot of "/ 1000"

You're probably right. I don't know whether the org.apache.tools.tar
package is an exclusive part of jakarta-ant or if there are other
projects with copies of it. Therefore I didn't dare to touch it.

Stefan