Exports: SOURCE_DATE_EPOCH stands in for the clock, so output repeats

PNG, PDF, EPS, legacy `.ai`, packaged zips and saved `.vectorcraft` files
record the wall-clock time they were made in, so the same commands run twice
gave different bytes although the pixels matched (#2880):

  PDF   /CreationDate and /ModDate   D:20261018155816 vs D:20261018155817
  PNG   the `Creation Time` tEXt entry
  .vectorcraft  one byte of the stored date
  SVG   carries no time, and already repeated

`metadata::output_time` is the time a file records: `SOURCE_DATE_EPOCH` when it
holds a non-negative whole number of seconds, else the clock, as the
reproducible-builds specification defines it. A date a command is given
(`file.new {created}`, a save's `modified`) still wins over the variable, and a
blank, negative or non-numeric value is ignored so that an export is never
refused over the environment.

`metadata::now_unix` keeps the real clock and now has exactly two callers, both
of which must not be pinnable from the environment: the recovery heartbeat, and
the seed PDF encryption draws on.
This commit is contained in:
Hamza
2026-10-19 00:37:55 +07:00
committed by bflatastic
parent c9a2491ef7
commit 1c80b23745
16 changed files with 88 additions and 15 deletions
+19
View File
@@ -821,6 +821,25 @@ Not remembered: Color Settings, the document, anything else. Nothing is read or
desktop app starts, the presets it kept in its preferences file before this folder existed are moved into it; after
that the folder is the one place they live, so a preset deleted by `vectorcraft-cli` is gone in the app too.
### Reproducible output
PNG, PDF, EPS, legacy `.ai`, packaged zips and saved `.vectorcraft` files record the time they were
made in (PDF `CreationDate` and `ModDate`, the PNG `Creation Time` entry, a zip entry's date, a
document's `created` and `modified`), so the same commands run twice gave different bytes though the
pixels matched (#2880). Setting **`SOURCE_DATE_EPOCH`** to a non-negative whole number of seconds
since the epoch records that instant instead of the clock, and the bytes repeat
(<https://reproducible-builds.org/specs/source-date-epoch/>):
```sh
SOURCE_DATE_EPOCH=1791208980 vectorcraft-cli run --cmd file.new --params '{}' --export out.pdf
```
A command that takes its own date (`file.new {created}`, a save's `modified`) still wins over the
variable. A blank, negative or non-numeric value is ignored and the clock decides, so an export is
never refused over the environment. The variable does not reach the recovery heartbeat or the
random seed PDF encryption draws on, which must follow the real clock. SVG output carries no time
and was already reproducible.
### Parameter keys
`command_run`, each step of `command_batch`, `run --cmd … --params` and the control channel's `engine.execute` check