droid icon indicating copy to clipboard operation
droid copied to clipboard

Folders in Tar files give date last modified of when DROID run rather than accurate date

Open paulyoung84 opened this issue 5 years ago • 1 comments

When DROID profiles a TAR file, if there is a folder inside the TAR file in date last modified it returns the date of when DROID was run, rather than the date which can accurate date. Example attached.

image image

paulyoung84 avatar Jul 28 '20 09:07 paulyoung84

It appears that when we create a TarArchiveEntry for a folder, we only take the name from the folder and use it to initialize org.apache.commons.compress.archivers.tar.TarArchiveEntry As per the documentation, the modTime is just initialized as current time

https://commons.apache.org/proper/commons-compress/apidocs/org/apache/commons/compress/archivers/tar/TarArchiveEntry.html#TarArchiveEntry-java.lang.String-boolean-

Relevant information: TarEntries can be constructed from nothing but a name. This allows the programmer to construct the entry by hand, for instance when only an InputStream is available for writing to the archive, and the header information is constructed from other information. In this case the header fields are set to defaults and the File is set to null.

Implementation Suggestion: When creating the TarEntry, either use a different constructor which can then populate correct values in header or explicitly set the modified time as soon as the TarEntry is constructed

sparkhi avatar Jul 28 '20 13:07 sparkhi