diff mbox series

[bug#49640,core-updates] gnu: ghostscript: Improve reproducibility of PDF document generation

Message ID 87eebucyt8.fsf@kitej
State Accepted
Headers show
Series [bug#49640,core-updates] gnu: ghostscript: Improve reproducibility of PDF document generation | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Guillaume Le Vaillant July 19, 2021, 11:45 a.m. UTC
Hi,

When trying to solve a reproducibility issue when generating the
PDF documentation of the txr software (see [1]), Paul Patience noticed
that ghostscript writes a creation date in the PDF even when the
GS_GENERATE_UUIDS environment variable is set to "0".

The attached patch updates 'ghostscript-no-header-creationdate.patch' to
fix this issue.

Given the amount of rebuilds caused by modifying ghostscript, this
should go to core-updates, but is core-updates in freeze state already,
or can I push this patch right now?

Note: Even with this patch, there are still some cases where PDF
generation by ghostscript is not reproducible (for reasons not related
to creation date), like groff-doc.

[1]: https://bugs.gnu.org/49517

Comments

Ludovic Courtès July 19, 2021, 2:35 p.m. UTC | #1
Hi Guillaume,

Guillaume Le Vaillant <glv@posteo.net> skribis:

> When trying to solve a reproducibility issue when generating the
> PDF documentation of the txr software (see [1]), Paul Patience noticed
> that ghostscript writes a creation date in the PDF even when the
> GS_GENERATE_UUIDS environment variable is set to "0".
>
> The attached patch updates 'ghostscript-no-header-creationdate.patch' to
> fix this issue.
>
> Given the amount of rebuilds caused by modifying ghostscript, this
> should go to core-updates, but is core-updates in freeze state already,
> or can I push this patch right now?

[...]

> From db5962c68099f835350c24c8a3f889b9fa1f8a8e Mon Sep 17 00:00:00 2001
> From: Guillaume Le Vaillant <glv@posteo.net>
> Date: Mon, 19 Jul 2021 11:48:12 +0200
> Subject: [PATCH] gnu: ghostscript: Improve reproducibility of PDF document
>  generation
>
> * gnu/packages/patches/ghostscript-no-header-creationdate.patch: Disable
>   writing "xmp:ModifyDate" and "xmp:CreateDate" if GS_GENERATE_UUIDS is set to
>   "0" or "no".

LGTM, you can push to ‘core-updates’.  Was this submitted upstream?

Note: when ‘core-updates’ is frozen, we’ll fork ‘core-updates-frozen’ so
that people can happily keeping messing up on ‘core-updates’.  This was
suggested some months ago during the Guix Days and I think it can make
things smoother!

Thanks,
Ludo’.
Guillaume Le Vaillant July 19, 2021, 3:23 p.m. UTC | #2
Ludovic Courtès <ludo@gnu.org> skribis:

> LGTM, you can push to ‘core-updates’.

Done in db5962c68099f835350c24c8a3f889b9fa1f8a8e.
Thanks for the review.

> Was this submitted upstream?

No, in [1] upstream indicates explicitly that they don't want to
implement reproducible builds.

[1] https://bugs.ghostscript.com/show_bug.cgi?id=698208
diff mbox series

Patch

From db5962c68099f835350c24c8a3f889b9fa1f8a8e Mon Sep 17 00:00:00 2001
From: Guillaume Le Vaillant <glv@posteo.net>
Date: Mon, 19 Jul 2021 11:48:12 +0200
Subject: [PATCH] gnu: ghostscript: Improve reproducibility of PDF document
 generation

* gnu/packages/patches/ghostscript-no-header-creationdate.patch: Disable
  writing "xmp:ModifyDate" and "xmp:CreateDate" if GS_GENERATE_UUIDS is set to
  "0" or "no".
---
 .../ghostscript-no-header-creationdate.patch  | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/patches/ghostscript-no-header-creationdate.patch b/gnu/packages/patches/ghostscript-no-header-creationdate.patch
index 92ddbdade0..b19f3ab5d9 100644
--- a/gnu/packages/patches/ghostscript-no-header-creationdate.patch
+++ b/gnu/packages/patches/ghostscript-no-header-creationdate.patch
@@ -20,3 +20,25 @@  index 0fb067e..b342e2c 100644
      {
          struct tm tms;
          time_t t;
+--- orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdfe.c
++++ gnu-ghostscript-9.14.0/devices/vector/gdevpdfe.c
+@@ -692,6 +692,9 @@
+             pdf_xml_attribute_name(s, "xmlns:xmp");
+             pdf_xml_attribute_value(s, "http://ns.adobe.com/xap/1.0/");
+             pdf_xml_tag_end(s);
++            if (!getenv("GS_GENERATE_UUIDS") ||
++                (strcasecmp(getenv("GS_GENERATE_UUIDS"), "0") != 0 &&
++                 strcasecmp(getenv("GS_GENERATE_UUIDS"), "no") != 0))
+             {
+                 pdf_xml_tag_open_beg(s, "xmp:ModifyDate");
+                 pdf_xml_tag_end(s);
+@@ -700,6 +701,9 @@
+                 pdf_xml_tag_close(s, "xmp:ModifyDate");
+                 pdf_xml_newline(s);
+             }
++            if (!getenv("GS_GENERATE_UUIDS") ||
++                (strcasecmp(getenv("GS_GENERATE_UUIDS"), "0") != 0 &&
++                 strcasecmp(getenv("GS_GENERATE_UUIDS"), "no") != 0))
+             {
+                 pdf_xml_tag_open_beg(s, "xmp:CreateDate");
+                 pdf_xml_tag_end(s);
-- 
2.32.0