pdftex[782] branches/stable: use only file base name, not cwd, when

commits+karl at tug.org commits+karl at tug.org
Wed Nov 15 00:50:41 CET 2017


Revision: 782
          http://tug.org/svn/pdftex?view=revision&revision=782
Author:   karl
Date:     2017-11-15 00:50:41 +0100 (Wed, 15 Nov 2017)
Log Message:
-----------
use only file base name, not cwd, when computing PDF ID

Modified Paths:
--------------
    branches/stable/doc/manual/ChangeLog
    branches/stable/doc/manual/pdftex-t.tex
    branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog
    branches/stable/source/src/texk/web2c/pdftexdir/NEWS
    branches/stable/source/src/texk/web2c/pdftexdir/utils.c

Modified: branches/stable/doc/manual/ChangeLog
===================================================================
--- branches/stable/doc/manual/ChangeLog	2017-11-02 18:15:22 UTC (rev 781)
+++ branches/stable/doc/manual/ChangeLog	2017-11-14 23:50:41 UTC (rev 782)
@@ -1,3 +1,9 @@
+2017-11-14  Karl Berry  <karl at freefriends.org>
+
+	* pdftex-t.tex (\pdftrailerid): absolute file name is no longer
+	used in the /ID seed, just the base name, for reproducibility.
+	(\pdfprimitive): clarify.
+
 2017-04-20  Karl Berry  <karl at freefriends.org>
 
 	* pdftex-t.tex (\currentpdftex): 1.40.18 (for TeX Live 2017).

Modified: branches/stable/doc/manual/pdftex-t.tex
===================================================================
--- branches/stable/doc/manual/pdftex-t.tex	2017-11-02 18:15:22 UTC (rev 781)
+++ branches/stable/doc/manual/pdftex-t.tex	2017-11-14 23:50:41 UTC (rev 782)
@@ -2433,7 +2433,7 @@
 \bookmark{\tex{pdftrailerid}}
 
 Use the \Something{general text} to seed the \type{/ID} value in the
-trailer, instead of the default combination of the absolute input file
+trailer, instead of the default combination of the input file
 name and starting time.  If the argument is empty, the \type{/ID} is
 omitted entirely.  Example: \type{\pdftrailerid{}}.  This can be useful
 in making reproducible \PDF{}s.  \introduced{1.40.17}
@@ -4326,11 +4326,11 @@
 \bookmark{\tex{pdfprimitive}}
 
 This command executes the primitive meaning of the following control
-sequence, if it has been redefined or made undefined. If the following
-control sequence is undefined and never was a primitive, nothing happens
-and no error is raised.  If the control sequence was initially
-expandable, \type{\pdfprimitive} expands either. Otherwise
-\type{\pdfprimitive} doesn't expand. \introduced{1.40.0}
+sequence, regardless of whether the control sequence has been redefined
+or made undefined. On the other hand, if the following control sequence
+never was a primitive, nothing happens and no error is raised.  If the
+control sequence was initially expandable, \type{\pdfprimitive} expands
+also. \introduced{1.40.0}
 
 
 \pdftexprimitive{\Syntax{\Tex{\pdfretval} \Whatever{read||only integer}}}

Modified: branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog
===================================================================
--- branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog	2017-11-02 18:15:22 UTC (rev 781)
+++ branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog	2017-11-14 23:50:41 UTC (rev 782)
@@ -1,3 +1,11 @@
+2017-11-14  Anders Kaseorg  <andersk at mit.edu>
+
+	* utils.c (printID): Do not hash the current directory name into
+	the PDF ID field, since any variability in it leads to
+	non-reproducible builds.
+	pdftex mailing list, 2 Sep 2017 01:52:43
+	https://bugs.debian.org/874102
+
 2017-10-17  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	* pdftosrc.cc: Support also xpdf-3.04 if XPDF304 is defined.

Modified: branches/stable/source/src/texk/web2c/pdftexdir/NEWS
===================================================================
--- branches/stable/source/src/texk/web2c/pdftexdir/NEWS	2017-11-02 18:15:22 UTC (rev 781)
+++ branches/stable/source/src/texk/web2c/pdftexdir/NEWS	2017-11-14 23:50:41 UTC (rev 782)
@@ -1,6 +1,11 @@
+- changes:
+  - do not hash current directory into PDF ID, for more reproducible builds.
+
 - bugfixes:
   - \ifpdfprimitive now correctly returns true for "\ " (r45394).
 
+- source: support xpdf-4 by default, or xpdf-3.04,
+  or poppler-0.59.0 and newer, or poppler-0.57.0 and older, via #defines.
 ---------------------------------------------------------------
 pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017)  (April 27, 2017)
 - changes:

Modified: branches/stable/source/src/texk/web2c/pdftexdir/utils.c
===================================================================
--- branches/stable/source/src/texk/web2c/pdftexdir/utils.c	2017-11-02 18:15:22 UTC (rev 781)
+++ branches/stable/source/src/texk/web2c/pdftexdir/utils.c	2017-11-14 23:50:41 UTC (rev 782)
@@ -1,5 +1,5 @@
 /*
-Copyright 1996-2015 Han The Thanh, <thanh at pdftex.org>
+Copyright 1996-2017 Han The Thanh, <thanh at pdftex.org>
 
 This file is part of pdfTeX.
 
@@ -697,9 +697,10 @@
   </blockquote>
   This stipulates only that the two IDs must be identical when the file is
   created and that they should be reasonably unique. Since it's difficult
-  to get the file size at this point in the execution of pdfTeX and
-  scanning the info dict is also difficult, we start with a simpler
-  implementation using just the first two items.
+  to get the file size at this point in the execution of pdfTeX, scanning
+  the info dict is also difficult, and any variability in the current
+  directory name leads to non-reproducible builds, we start with a
+  simpler implementation using just the current time and the file name.
  */
 void printID(strnumber filename)
 {
@@ -707,7 +708,6 @@
     md5_byte_t digest[16];
     char id[64];
     char *file_name;
-    char pwd[4096];
     /* start md5 */
     md5_init(&state);
     /* get the time */
@@ -714,22 +714,7 @@
     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);



More information about the pdftex-commits mailing list