unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Guillaume Le Vaillant <glv@posteo.net>
To: 49640@debbugs.gnu.org
Subject: [bug#49640] [PATCH core-updates] gnu: ghostscript: Improve reproducibility of PDF document generation
Date: Mon, 19 Jul 2021 11:45:07 +0000	[thread overview]
Message-ID: <87eebucyt8.fsf@kitej> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 731 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-ghostscript-Improve-reproducibility-of-PDF-docum.patch --]
[-- Type: text/x-patch, Size: 2038 bytes --]

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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

             reply	other threads:[~2021-07-19 11:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 11:45 Guillaume Le Vaillant [this message]
2021-07-19 14:35 ` [bug#49640] [PATCH core-updates] gnu: ghostscript: Improve reproducibility of PDF document generation Ludovic Courtès
2021-07-19 15:23   ` bug#49640: " Guillaume Le Vaillant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eebucyt8.fsf@kitej \
    --to=glv@posteo.net \
    --cc=49640@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).