Unix timestamp formats
A free file archiver for extremely high compression
Brought to you by:
ipavlov
Hi all,
In order to support more timestamps formats, 7-Zip could benefit from the following enhancement:
In CExtraSubBlock::ExtractUnixTime, disable the first part of the if clause and check the flag based on the variable index:
if (//index != NUnixTime::kMTime ||
(flags & (1 << index)) == 0 ||
size < 4)
Relevant documentation:
https://opensource.apple.com/source/zip/zip-6/unzip/unzip/proginfo/extra.fld
Also, GetProperty should not report S_OK when a piece of information cannot be obtained. This can be achieved in the following manner:
In CHandler::GetProperty, add the following variable near the start:
HRESULT result = S_OK;
For kpidCTime, kpidATime, and kpidMTime, add an else branch like this:
if (defined)
prop = utc;
else
result = S_FALSE;
Finally, return the result:
RETURN result;
With kind regards
Björn
1) read zip specification:
Do you mean that someone does not follow that zip specification clause?
2) I decide what must return interface functions like
GetProperty().And I decided it in past many years ago.
If I change it now, it will break compatibility, and all programs that use 7z.dll probably will not work anymore with new version.
So I will not do it.
Last edit: Igor Pavlov 2019-12-19
In ZipHandler.cpp, CHandler::GetProperty calls extra.GetUnixTime(true, ... where the first parameter indicates that the called function should look in the central directory, but as you explained kpidCTime and kpidATime have to be read from the local header. Does 7-Zip keep copies of the local header for finding this information later?
7-Zip doesn't read Local headers in most cases, when it opens archive. It reads only central directory.
So you don't see local properties.
7-Zip can read all local headers in open operation, only if there is some problem with central directory.
I have a patch for ArchiveAccess that works. I would like to see those changes in 7-Zip as well, because that makes patch management easier. So, would you like to have these changes in 7-Zip as well, and in that case, how would you like to receive them?