[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#893314: marked as done (inkscape: please make the command-line PDF output reproducible)



Your message dated Mon, 08 Oct 2018 14:44:04 +0000
with message-id <E1g9WlQ-0002Kf-Ci@fasolo.debian.org>
and subject line Bug#893314: fixed in inkscape 0.92.3-4
has caused the Debian Bug report #893314,
regarding inkscape: please make the command-line PDF output reproducible
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
893314: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=893314
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Source: inkscape
Version: 0.92.3~pre0-1
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps toolchain
X-Debbugs-Cc: reproducible-bugs@lists.alioth.debian.org

Hi,

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

Patch attached. After applying:

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

:)


 [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby@debian.org / chris-lamb.co.uk
       `-
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index f606805..5c1479f 100644
--- a/src/extension/internal/cairo-render-context.cpp
+++ b/src/extension/internal/cairo-render-context.cpp
@@ -26,7 +26,10 @@
 
 
 #include <signal.h>
+#include <limits.h>
 #include <errno.h>
+#include <time.h>
+#include <stdlib.h>
 #include <2geom/pathvector.h>
 
 #include <glib.h>
@@ -796,6 +799,12 @@ CairoRenderContext::setupSurface(double width, double height)
     cairo_surface_t *surface = NULL;
     cairo_matrix_t ctm;
     cairo_matrix_init_identity (&ctm);
+    char buffer[25];
+    char *endptr;
+    char *source_date_epoch;
+    time_t now;
+    struct tm *build_time;
+    unsigned long long epoch;
     switch (_target) {
         case CAIRO_SURFACE_TYPE_IMAGE:
             surface = cairo_image_surface_create(_target_format, (int)ceil(width), (int)ceil(height));
@@ -804,6 +813,38 @@ CairoRenderContext::setupSurface(double width, double height)
         case CAIRO_SURFACE_TYPE_PDF:
             surface = cairo_pdf_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height);
             cairo_pdf_surface_restrict_to_version(surface, (cairo_pdf_version_t)_pdf_level);
+            source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+            if (source_date_epoch) {
+                errno = 0;
+                epoch = strtoull(source_date_epoch, &endptr, 10);
+                if ((errno == ERANGE && (epoch == ULLONG_MAX || epoch == 0))
+                        || (errno != 0 && epoch == 0)) {
+                    g_printerr ("Environment variable $SOURCE_DATE_EPOCH: strtoull: %s\n",
+                                strerror(errno));
+                    exit (1);
+                }
+                if (endptr == source_date_epoch) {
+                    g_printerr ("Environment variable $SOURCE_DATE_EPOCH: No digits were found: %s\n",
+                                endptr);
+                    exit (1);
+                }
+                if (*endptr != '\0') {
+                    g_printerr ("Environment variable $SOURCE_DATE_EPOCH: Trailing garbage: %s\n",
+                                endptr);
+                    exit (1);
+                }
+                if (epoch > ULONG_MAX) {
+                    g_printerr ("Environment variable $SOURCE_DATE_EPOCH: must be <= %lu but saw: %llu\n",
+                                ULONG_MAX, epoch);
+                    exit (1);
+                }
+                now = (time_t)epoch;
+                build_time = gmtime(&now);
+                strftime(buffer, 25, "%Y-%m-%dT%H:%M:%S%z", build_time);
+                cairo_pdf_surface_set_metadata (surface,
+                                                CAIRO_PDF_METADATA_CREATE_DATE,
+                                                buffer);
+            }
             break;
 #endif
 #ifdef CAIRO_HAS_PS_SURFACE

--- End Message ---
--- Begin Message ---
Source: inkscape
Source-Version: 0.92.3-4

We believe that the bug you reported is fixed in the latest version of
inkscape, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 893314@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Mattia Rizzolo <mattia@debian.org> (supplier of updated inkscape package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Mon, 08 Oct 2018 11:27:04 +0200
Source: inkscape
Binary: inkscape inkscape-tutorials
Architecture: source
Version: 0.92.3-4
Distribution: unstable
Urgency: medium
Maintainer: Debian Multimedia Maintainers <debian-multimedia@lists.debian.org>
Changed-By: Mattia Rizzolo <mattia@debian.org>
Description:
 inkscape   - vector-based drawing program
 inkscape-tutorials - vector-based drawing program - tutorials
Closes: 893314 910379
Changes:
 inkscape (0.92.3-4) unstable; urgency=medium
 .
   [ Mattia Rizzolo ]
   * d/bash-completion: fix completion to use the runtime-evaluating _have()
     instead of the static check have().  LP: #1792835
   * Mark inkscape-tutorials as Multi-Arch:foreign (from the m-a hinter).
   * Bump Standards-Version to 4.2.1, no changes needed.
   * Add patch from upstream to make the command-line PDF output reproducible.
     Thanks to Chris Lamb <lamby@debian.org> for the patch!  Closes: #893314
 .
   [ Andrej Shadura ]
   * Add patch from upstream to fix crash when resizing elements with snapping
     enabled.  Closes: #910379; LP: #1796046
Checksums-Sha1:
 99c2bace653c0cc42210e6b0535d2fe06eff04ee 2891 inkscape_0.92.3-4.dsc
 e1886317f8e6d4fb340f6a783fe410aaff9f28a7 31606442 inkscape_0.92.3.orig.tar.bz2
 45b91f8021f6451f52097e52c7f196d4b4bd3df5 181 inkscape_0.92.3.orig.tar.bz2.asc
 61c7cdbe6dde97f569e03262404c12185c19eddc 31560 inkscape_0.92.3-4.debian.tar.xz
 e77df02501a2f03670481ae035fbaf112ba971af 15895 inkscape_0.92.3-4_amd64.buildinfo
Checksums-Sha256:
 4723617f56bfb624e8f740f3dfca196b2eea59aea4e4292df7d7f668831da8fe 2891 inkscape_0.92.3-4.dsc
 063296c05a65d7a92a0f627485b66221487acfc64a24f712eb5237c4bd7816b2 31606442 inkscape_0.92.3.orig.tar.bz2
 ed14f691817a58fce0c6eeb26bcdc649325b4edbc82783d0d6ddea727f994217 181 inkscape_0.92.3.orig.tar.bz2.asc
 da2bda722673fb070cece6c6cb29a7a938f88d2f0065a6290c03f740151b32ee 31560 inkscape_0.92.3-4.debian.tar.xz
 a5265ab282418dd2adbff7490283f073d609f39a381771e14d94c07f007463e9 15895 inkscape_0.92.3-4_amd64.buildinfo
Files:
 473eb6329bef3425c7dfaff6c362df91 2891 graphics optional inkscape_0.92.3-4.dsc
 4ef7171cc1de9e1608d8c49b77fed99e 31606442 graphics optional inkscape_0.92.3.orig.tar.bz2
 c4de7212503d8bac443efaa25c1881ea 181 graphics optional inkscape_0.92.3.orig.tar.bz2.asc
 cff5eace55b734cb9b2462754a791fff 31560 graphics optional inkscape_0.92.3-4.debian.tar.xz
 bd0d6eb52f2fc41b67874d45d8a535fb 15895 graphics optional inkscape_0.92.3-4_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEi3hoeGwz5cZMTQpICBa54Yx2K60FAlu7XYsACgkQCBa54Yx2
K61V3g/9GLPyqZyEi0GWQYu6DsQq2bu6YaT0qLN+WGfecG6u+KMGmf70hvMAw5q/
BL9dQdl18X68VDbWTzgodFR/taB+iQ5JpT1yfM37Misz5Jueq/O+I9eq/GZwUeSh
F1TndpgqfbyZ6GYGKgkJCcSr1H+JJwJXHCql7USCWPW6JPyNO5VjQ9Xa99yfOdKe
i3KE5L901JUdouACb7pR4x2ylGL2u8tFfEji8mpebtVwSxTmYXUolPeSrKu7GZ+n
Q3R0Q8ANhtfgeqCwwIumGxxmLCpulOXxqWyCY4P4f3X8WVt68IFi/7d0mmOVCFdK
/YdUD49Z18+hG30qD2qZ7eVO0azun/iksKgskzcC1vQFfI1CBOgbOmr+LR95i+om
FDfqKBmuwNnoZXlKyYO9vxatyXcxKsJdEkZyJdKsSW7Nv2BZTDhb9WurgrtMTpy2
av+ECibrzpVp2EdeEC7G20bRxvR5nQvxysHWMrKi8N5yLLznPQxIKoge3335XqqH
tG+rZAEthR5iMFjOHbwgL+ZJBDPOhiCsJit9/fixYh/M3bJDS98ruhzyMXH+O31o
XnotMQL7LSYdvoifb5gizaTpN1W81uzF480v+5Nx1YNNbxWAfaedSsOERGqisY/O
20aS6jTXRnXYL0CO5TYwMObQ5Y5Iq3hreViNeBJ91bn0p63+bqE=
=MjX7
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: