Create/Extract NTFS Extra Data field for Timestamp etc
SD-1800, originally created on 12/20/2010 01:58:10 by David Pierson
We should have the ability to create the NTFS Extra Data field (0x000a) via an option in FastZip, and an easy way to create it in ZipFile and ZipOutputStream.
This would hold the NTFS Last Modified timestamp, avoiding the problem of the 2 second granularity of the standard entry timestamp.
Relevant forum threads:
I see that there is already an 'NTTaggedData' class in the extra data handling that appears to handle the NTFS extra data block, but the only place it's referenced from the library is the ifdefed out block at:
https://github.com/icsharpcode/SharpZipLib/blob/fed3bd219f8bd2bac5287b6217b9c4c384bed35f/src/ICSharpCode.SharpZipLib/Zip/ZipEntry.cs#L1103
There is a comment there about disabling it by default to match InfoZip, but i'm not sure what the logic should be at this point - is there a reason to not use the data if present in the zip? (or maybe restrict it to extraction on Windows hosts?)
No idea. I have had it on my agenda to look through the extra data fields...
@Numpsy I added that #if RESPECT_NT_TIMESTAMP a long time ago for an admittedly rather specific use case:
Zero Intall is a cross-platform package manager. The Linux version uses CLIs like tar and unzip (InfoZIP) to extract archives. The Windows version uses SharpZipLib. After extracting archives both versions verify the files using checksums which include the timestamps. Therefore I needed SharpZipLib to produce identical timetamps to InfoZIP.
Perhaps a better, although still rather clumsy, alternative to the #if block might be a public static bool config toggle.
I'm not sure what the default should be as far as extraction goes (as far as FastZip goes, does it need an additional option on top of 'restore timestamps'? don't recall apps like 7-zip offering that).
Saying that, not sure what's supposed to happen if an entry contains both NTFS and Unix extra datas (I don't think anything actually prevents both from existing, even if that would be unusual?)