Skip to content

Make the command-line PDF output reproducible.

Chris Lamb requested to merge (removed):reproducible-output into master

Whilst working on the Reproducible Builds effort [0], we noticed that inkscape generates output that is not reproducible:

  $ cp /usr/share/icons/gnome/scalable/places/debian-swirl.svg .
  $ inkscape -z debian-swirl.svg --export-width=25 --export-pdf=a.pdf
  $ sleep 1
  $ inkscape -z debian-swirl.svg --export-width=25 --export-pdf=b.pdf
  $ sha1sum *.pdf
  bee6f300a8fce628e94febd0700fa97f90aa7b37  a.pdf
  32f26595ec1957c7e714174e007c452f6cb5dd79  b.pdf

This is affecting (at least) the "debian-astro" package:

│ │ │ ├── ./usr/share/pixmaps/Debian-Astro-logo.pdf
│ │ │ │ ├── pdftk {} output - uncompress
│ │ │ │ │ @@ -357,15 +357,15 @@
│ │ │ │ │  <<
│ │ │ │ │  /Type /Catalog
│ │ │ │ │  /Pages 1 0 R
│ │ │ │ │  >>
│ │ │ │ │  endobj
│ │ │ │ │  6 0 obj
│ │ │ │ │  <<
│ │ │ │ │ -/CreationDate (D:20180315093948-12'00)
│ │ │ │ │ +/CreationDate (D:20190418180346+14'00)
│ │ │ │ │  /Producer (cairo 1.15.10 \(http://cairographics.org\))
│ │ │ │ │  >>
│ │ │ │ │  endobj xref

After applying this patch (which uses SOURCE_DATE_EPOCH [1]):

$ export SOURCE_DATE_EPOCH=1521324801 $ […] $ sha1sum *.pdf 620bf8469600ab744ffa6fcc3eee4c6845f4f159 a.pdf 620bf8469600ab744ffa6fcc3eee4c6845f4f159 b.pdf

This was originally filed in Debian as #893314 [2].

[0] https://reproducible-builds.org/ [1] https://reproducible-builds.org/specs/source-date-epoch/ [2] https://bugs.debian.org/893314

Signed-off-by: Chris Lamb chris@chris-lamb.co.uk

Edited by Chris Lamb

Merge request reports