Re: [pdftex] Please make the CreationDate, ModDate and ID field deterministic
Maria Valentina Marin <[email protected]>
| Newsgroups | gmane.linux.debian.alioth.reproducible-builds,gmane.comp.tex.pdftex |
|---|---|
| Message-ID | <[email protected]> |
Hi, On 07/14/2015 12:39 AM, Karl Berry wrote: > Thanh is away for ~3 weeks. He will review both the SOURCE_DATE_EPOCH > patch (which I suspect will be fine) and Nicolas's other comments when > he's back. In addition to my patch to honour $SOURCE_DATE_EPOCH please find attached an additional patch which uses UTC in the printed timestamps to also make the timezone reproducible. I have patched the function makepdftime to use gmtime if $SOURCE_DATE_EPOCH is set. Otherwise the old behaviour will be kept. I have tested the patch in our autobuilders against 4 Debian packages that use pdflatex and these become reproducible. Cheers, akira _______________________________________________ Reproducible-builds mailing list Reproducible-builds-XbBxUvOt3X2LieD7tvxI8l/[email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds
Use-gmtime-to-produce-reproducible-output
(text/plain, 1.5 KB)
Description: Use gmtime instead of localtime to produce timezone independent output if SOURCE_DATE_EPOCH is set
--- a/texk/web2c/lib/texmfmp.c
+++ b/texk/web2c/lib/texmfmp.c
@@ -2876,7 +2876,7 @@ char start_time_str[TIME_STR_SIZE];
static char time_str[TIME_STR_SIZE];
/* minimum size for time_str is 24: "D:YYYYmmddHHMMSS+HH'MM'" */
-static void makepdftime(time_t t, char *time_str)
+static void makepdftime(time_t t, char *time_str, int utc)
{
struct tm lt, gmt;
@@ -2884,7 +2884,12 @@ static void makepdftime(time_t t, char *
int i, off, off_hours, off_mins;
/* get the time */
- lt = *localtime(&t);
+ if (utc){
+ lt = *gmtime(&t);
+ }
+ else {
+ lt = *localtime(&t);
+ }
size = strftime(time_str, TIME_STR_SIZE, "D:%Y%m%d%H%M%S", <);
/* expected format: "YYYYmmddHHMMSS" */
if (size == 0) {
@@ -2958,11 +2963,12 @@ void initstarttime(void)
uexit(EXIT_FAILURE);
}
start_time = epoch;
+ makepdftime(start_time, start_time_str, 1);
}
else {
start_time = time((time_t *) NULL);
+ makepdftime(start_time, start_time_str, 0);
}
- makepdftime(start_time, start_time_str);
}
}
@@ -3049,7 +3055,7 @@ void getfilemoddate(integer s)
if (stat(file_name, &file_data) == 0) {
size_t len;
- makepdftime(file_data.st_mtime, time_str);
+ makepdftime(file_data.st_mtime, time_str, 0);
len = strlen(time_str);
if ((unsigned) (poolptr + len) >= (unsigned) (poolsize)) {
poolptr = poolsize;
signature.asc
(application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVyykzAAoJEDc//sfLHTY+KSEQAJgmC/ROIpJYvx9GYltnQNEJ CLDyVtLr036vk0M8GVfkC6yt9oJ/dk1qqe6YGwTBira+uiMclvZrynJ9xVkqjcEI hZCdiRjSi6/GUrI3KmDzJnIVUApNtoADu913jfBgZTMWVZC2KbKRbxYmLsWJDMBM waaGLtnsJ9TsqxHRSumCsv+gbcdx2XVJKHBxOheY60UATIzsQKEJUmglSCXtaVmB n33mBFVHa/xpW+4jRoKpUsgZemOoIdporTSPMbLiiqgzK8PbtDJMmnOQx83eYhl4 ATSIl/St3a14v5WtXhn6d5l8VPVBDI6KCRokkwbDwVZ0ZT5U9jagCeZieXFWkE5L v6FbYWQicUK6bIL95J6stfzPzlS56JDdXznlOC8tmR2DvcPc1X9Z0feiIp2lw7+C 8s2G1EG7ugwRb2ykIvicSkS7uE013sQj7v8xFVdQFWP7wXzhHhgVzUscIOmNKkHd j3/p38O6Y/6OO1OQTUrIZcnrWD0ZvaYDxloVdIa1aC/yEnLLJj5eaLEm0ay/Fj71 Dne3pDmTgzqJdeLo3kMELdRvVYfakMjS5zWMU4yqJ7mE1mzLZOidJ2EgwKYrpQbR Pf50uirBLcD6eVptxD2QwsASW6rg7m9e8dlXOTk+eADYFs2vJIKfDr+oGrmvdwlX PB6TOXQ4t4Kh6fUqo4y8 =Ivh1 -----END PGP SIGNATURE-----