Repository navigation
don't limit outputTimestamp to zip (MS DOS) range - #311
Conversation
|
You mean the contract has to come from the caller and not by the producing lib? Shit in, shit out? |
|
the contract is: "give a stable binary output" I don't give any judgement on the provided value: it's the desired hint, and the JDK does not fail when using that hint |
fd36ed9 to
009c817
Compare
michael-o
left a comment
There was a problem hiding this comment.
Here is yet another problem I have:
This class is designed for JARs only, no tar or alike.
|
I am confused about the first statement. What did I miss? |
|
jar, with their manifest, is one use case for MavenArchiver |
|
let's stop discussing about theory and not understanding each other: import java.io.*;
import java.util.zip.*;
public class ZipFile {
public static void main(String[] args) throws IOException {
FileOutputStream fos = new FileOutputStream("compressed.zip");
ZipOutputStream zipOut = new ZipOutputStream(fos);
ZipEntry zipEntry = new ZipEntry("f.txt");
zipEntry.setTime(0);
zipOut.putNextEntry(zipEntry);
zipOut.close();
fos.close();
}
}once run: I see no issue everything looks fine: yes, a timestamp not valid in MS DOS time range is encoded as definitively, JDK does a great job: I don't see any reason to limit values for Reproducible Builds |
This I understand, but this specific class is for ZIP files only. |
This is irrelevant because Maven Archiver uses Plexus Archiver which uses Commons Compress. You need to test with Commons Compress first: https://github.com/codehaus-plexus/plexus-archiver/blob/d88dfdcaa41704a7a3b2fcab4247d51f8ca6cbc2/src/main/java/org/codehaus/plexus/archiver/zip/AbstractZipArchiver.java#L36-L40 We need to make sure that Commons Compress does the right thing and does not modify the value beyond java.util.zip. Then this is fine. |
|
again mixing concerns: if the zip creation tool using the timestamp does not use it the right way, we need to fix the zip creation tool not block the configuration in an obscure way, that makes it tricky now just to prove that the zip tool is misusing the value: please help instead of just forcing me to prove a problem that was never proven before "solving" it |
|
merging, then we can work on creating a sample jar file and investigate how it differs from sample JDK zip |
|
@hboutemy Just for the record, I added the check to align with the behavior of the Also, plexus-archiver uses My personal preference would be to clamp the date to DATE_MIN, as @bmarwell suggested in #308. From a Reproducible Builds perspective, the key requirement is not a specific minimum date, but that the build process is deterministic: given the same source, it must always produce bit-for-bit identical binaries, clamping the date fits in this scenario. There has already been a lot of work to ensure things behave correctly. ZIP’s core spec enforces 1980-01-01 as the minimum date, and while extended timestamp fields can encode earlier dates, they’re not consistently portable or respected. That’s why the Reproducible Builds community typically normalizes JAR entry dates to 1980. |
fixes #308
drops check added in #22 and documented in #255
there is no reason to limit the value to something related to zip format: the timestamp may also be used for tar or any other archive format
failing a plugin for Reproducible Builds default timestamp value just creates a bad experience, that is really tricky to understand (default value of a plugin parameter injected from a property): if value has been defined with a value like "10", it's because user does not care about the effective timestamp in his archives, he just wants Reproducible Builds
let's keep things simple and not mix concerns: Reproducible Builds is about getting stable output, not a contract on precise zip entries timestamp