typst icon indicating copy to clipboard operation
typst copied to clipboard

Builds not reproducible across different platforms

Open Crissante opened this issue 2 years ago • 8 comments

Description

When building a document with date: none and identical Typst versions, currently v0.10.0, the build output should be reproducible across different platforms i.e. Linux and macOS builds should be byte-by-byte identical

Note that when using the same platform builds are reproducible as expected

Reproduction URL

No response

Operating system

Linux, macOS

Typst version

  • [X] I am using the latest version of Typst

Crissante avatar Dec 09 '23 06:12 Crissante

Would it maybe be possible to provide the 2 PDFs where they are different?

LaurenzV avatar Dec 09 '23 09:12 LaurenzV

Could be due to differences in font loading.

laurmaedje avatar Dec 09 '23 09:12 laurmaedje

Even better @LaurenzV @laurmaedje you can reproduce this with the minimal reproducible example below:

#set document(
  date: none,
)

Test

Crissante avatar Dec 10 '23 22:12 Crissante

Fwiw it seems like reproducibility has gotten even worse, since apparently now also the creation date is stored in the target PDF:

12 0 obj
<<
  /Creator (Typst 0.11.0)
  /CreationDate (D:20240417193127Z)
  /ModDate (D:20240417193127Z)
>>
endobj

Unfortunately even freezing the system time via faketime doesn't seem to work, since

  1. apparently there's times still micro-adjustments done, faking and freezing the time to be 1970-01-02 00:00:00 still resulted in the second sometimes being 1, sometimes 0.
  2. there are also parts at the bottom of the document which seem to be hashes of the file paths?
trailer
<<
  /Size 15
  /Root 14 0 R
  /Info 12 0 R
+  /ID [(/9ExdZ5vOtVgqt8s26BvCw==) (/9ExdZ5vOtVgqt8s26BvCw==)]
-  /ID [(uqtU5+OrMh3sE+PhrM0Elw==) (uqtU5+OrMh3sE+PhrM0Elw==)]
>>

MultisampledNight avatar Apr 17 '24 19:04 MultisampledNight

I guess it might be possible to make the files reproducible, still, by just searching for both culprits and deleting them. But I don't trust myself with enough knowledge about PDF and typst to know what this could impact.

MultisampledNight avatar Apr 17 '24 19:04 MultisampledNight

Something like a --reproducible flag would be cool, theoretically. I can imagine it'd be quite a ton of work though, and makes e.g. the datetime module and fs access a headache.

MultisampledNight avatar Apr 17 '24 19:04 MultisampledNight

@MultisampledNight just #set document(date: none) prevents that from happening. The IDs are also stable then.

laurmaedje avatar Apr 17 '24 20:04 laurmaedje

Apologies, I misunderstood! I thought document was an old name for page, but it's very real still today: https://typst.app/docs/reference/model/document/

MultisampledNight avatar Apr 17 '24 21:04 MultisampledNight

@Crissante I cannot reproduce this on 0.11.1. If you still can, please send the source file and the two differing PDFs. That would allow us to pin down the cause.

laurmaedje avatar Jul 15 '24 18:07 laurmaedje