-
Notifications
You must be signed in to change notification settings - Fork 24
don't limit outputTimestamp to zip (MS DOS) range #311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is yet another problem I have:
private JarArchiver archiver; |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
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