Skip to content
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

takari-lifecycle jar entries timestamp depends on user's timezone #172

Closed
hboutemy opened this issue Aug 24, 2024 · 4 comments · Fixed by #185
Closed

takari-lifecycle jar entries timestamp depends on user's timezone #172

hboutemy opened this issue Aug 24, 2024 · 4 comments · Fixed by #185
Milestone

Comments

@hboutemy
Copy link

hboutemy commented Aug 24, 2024

we can force a timezone when repbuilding for Reproducible Builds, like https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/io/takari/maven/maven-timeline/maven-timeline-2.0.0.buildspec

but this is not ideal (not a blocker like #171): it would be easier to have a zip output that is independent from user's timezone

here is what is done in plexus-archiver to solve this: https://github.com/codehaus-plexus/plexus-archiver/blob/master/src/main/java/org/codehaus/plexus/archiver/zip/AbstractZipArchiver.java#L688

@hboutemy hboutemy changed the title takari-lifecycle jar entries timestamp depends on user's default timezone takari-lifecycle jar entries timestamp depends on user machine's default timezone Aug 24, 2024
@hboutemy hboutemy changed the title takari-lifecycle jar entries timestamp depends on user machine's default timezone takari-lifecycle jar entries timestamp depends on user's timezone Aug 24, 2024
@cstamas
Copy link
Member

cstamas commented Aug 25, 2024

Am unsure I get this issue: it is ZIP format that have no notion of time zone. Takari stores timestamps with "dos epoch", and it is on unpack that TZ shift may occur (and not on creation).

From ZIP: "The ZIP format has no notion of time zone, so timestamps are only meaningful if it is known what time zone they were created in."

Moreover, Takari uses constant timestamp the "doc epoch": https://github.com/jvanzyl/provisio-archiver/blob/4d4bb73e90c4bf6443177d5215e1548dce13a1c6/src/main/java/ca/vanzyl/provisio/archive/Archiver.java#L25 (in millis, so UTC).

Hence, ZIP files created by Takari Lifecycle (Takari Archiver) are always having same (local) timestamp, but unpacker MAY shift them (given they are local), no?

@hboutemy
Copy link
Author

"dos epoch" is GMT based, Java converts it to local time before storing the local time in zip binary: this is how user's timezone influences bytes saved into the zip file = what we experience when we check bit-for-bit reproducibility of the zip bytes

@cstamas cstamas added this to the 2.1.8 milestone Aug 27, 2024
@hboutemy
Copy link
Author

just test building with -Duser.timezone='Etc/UTC+..' with different values and you will see how the output binary currently changes
target is that it is stable...

@cstamas
Copy link
Member

cstamas commented Sep 9, 2024

This needs new takari-archiver, fix is here jvanzyl/provisio-archiver#34

cstamas added a commit that referenced this issue Sep 9, 2024
This is a reproducibility related fix, as previous versions
of takari-lifecycle produced JARs were reproducible only in
same TZ as original. Fix was to use latest takari-archiver
1.0.3 that contains the fix.

Fixes #172
cstamas added a commit that referenced this issue Sep 9, 2024
This is a reproducibility related fix, as previous versions
of takari-lifecycle produced JARs were reproducible only in
same TZ as original. Fix was to use latest takari-archiver
1.0.3 that contains the fix.

Fixes #172
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants