From e4a26cb4b77435863d8c9fd39b2dbc3c14651f73 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 14 Nov 2017 23:50:55 +0000 Subject: use only file base name, not cwd, when computing PDF ID (pdftex r782) git-svn-id: svn://tug.org/texlive/trunk@45808 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/pdftexdir/ChangeLog | 8 ++++++++ Build/source/texk/web2c/pdftexdir/NEWS | 5 +++++ Build/source/texk/web2c/pdftexdir/utils.c | 25 +++++-------------------- 3 files changed, 18 insertions(+), 20 deletions(-) (limited to 'Build/source/texk') diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog index 5e383f4bafa..5894ab1a4fb 100644 --- a/Build/source/texk/web2c/pdftexdir/ChangeLog +++ b/Build/source/texk/web2c/pdftexdir/ChangeLog @@ -1,3 +1,11 @@ +2017-11-14 Anders Kaseorg + + * 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 * pdftosrc.cc: Support also xpdf-3.04 if XPDF304 is defined. diff --git a/Build/source/texk/web2c/pdftexdir/NEWS b/Build/source/texk/web2c/pdftexdir/NEWS index 692eb588bb7..65ec164b9c0 100644 --- a/Build/source/texk/web2c/pdftexdir/NEWS +++ b/Build/source/texk/web2c/pdftexdir/NEWS @@ -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: diff --git a/Build/source/texk/web2c/pdftexdir/utils.c b/Build/source/texk/web2c/pdftexdir/utils.c index 67ff8e9db46..c93a878199d 100644 --- a/Build/source/texk/web2c/pdftexdir/utils.c +++ b/Build/source/texk/web2c/pdftexdir/utils.c @@ -1,5 +1,5 @@ /* -Copyright 1996-2015 Han The Thanh, +Copyright 1996-2017 Han The Thanh, This file is part of pdfTeX. @@ -697,9 +697,10 @@ void unescapehex(poolpointer in) 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,29 +708,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); -- cgit v1.2.3