Bug#874102: texlive-bin: please make the PDF IDs reproducible

Chris Lamb lamby at debian.org
Sun Sep 3 08:30:11 UTC 2017


Source: texlive-bin
Version: 2017.20170613.44572-5
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: buildpath toolchain
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed
that texlive-bin was generating PDFs that vary in their "ID" field.

The ID varies because texlive generates it based on the build path
being included in the digest.

For more info, please see:

  http://tug.org/pipermail/tex-live/2017-June/040398.html
  http://tug.org/pipermail/tex-live/2017-July/040419.html
  http://tug.org/pipermail/tex-live/2017-September/040573.html

Patch attached.

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


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
diff --git a/debian/patches/reproducible-pdf-ids b/debian/patches/reproducible-pdf-ids
new file mode 100644
index 0000000..f1441d6
--- /dev/null
+++ b/debian/patches/reproducible-pdf-ids
@@ -0,0 +1,32 @@
+--- texlive-bin-2017.20170613.44572.orig/texk/web2c/pdftexdir/utils.c
++++ texlive-bin-2017.20170613.44572/texk/web2c/pdftexdir/utils.c
+@@ -707,29 +707,13 @@ void printID(strnumber filename)
+     md5_byte_t digest[16];
+     char id[64];
+     char *file_name;
+-    char pwd[4096];
+     /* start md5 */
+     md5_init(&state);
+     /* get the time */
+     initstarttime();
+     md5_append(&state, (const md5_byte_t *) start_time_str, strlen(start_time_str));
+     /* get the file name */
+-    if (getcwd(pwd, sizeof(pwd)) == NULL)
+-        pdftex_fail("getcwd() failed (%s), path too long?", strerror(errno));
+-#ifdef WIN32
+-    {
+-        char *p;
+-        for (p = pwd; *p; p++) {
+-            if (*p == '\\')
+-                *p = '/';
+-            else if (IS_KANJI(p))
+-                p++;
+-        }
+-    }
+-#endif
+     file_name = makecstring(filename);
+-    md5_append(&state, (const md5_byte_t *) pwd, strlen(pwd));
+-    md5_append(&state, (const md5_byte_t *) "/", 1);
+     md5_append(&state, (const md5_byte_t *) file_name, strlen(file_name));
+     /* finish md5 */
+     md5_finish(&state, digest);
diff --git a/debian/patches/series b/debian/patches/series
index 65b6637..076b59b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -14,3 +14,4 @@ disable-seetex-stdin-tests
 upupstream-xdvi-desktop-file
 mf-xt-fix-expose-events
 fix-gcc7-errors
+reproducible-pdf-ids


More information about the Reproducible-bugs mailing list