[tex-k] Reproducible builds using pdftex
Jonathan Kew
jfkthame at gmail.com
Wed May 4 14:21:50 CEST 2016
On 4/5/16 11:42, Norman Gray wrote:
>
> Greetings.
>
> A variety of hats have been donned in this conversation. May I put on a
> pedantic hat?
>
> On 3 May 2016, at 22:46, Karl Berry wrote:
>
>> But that is not the author's wish, in theory. If they use \today, by
>> definition they meant *today*, the day the document is being processed.
>
> Not really, or at least not by definition, or at least not by Knuth's
> definition. The TeXBook says that \today is 'the current date' (p406)
> and that \year is 'current year of our Lord' (p273); p349 mentions that
> '\time, \day, \month, and \year are established at the beginning of a
> job' (and says nothing more about what they are established as).
>
> Certainly, the straightforward meaning of 'currently' is 'the date-time
> in a correctly-adjusted Gregorian calendar when the job is started'. But
> 'current' can mean a larger variety of things in a computing context,
> such as 'current standard input' or 'current working directory'.
> 'Current' in that sense refers to a value of standard input, working
> directory, or indeed time, which is set by the environment.
>
> Thus I don't think that SOURCE_DATE_EPOCH_TEX_PRIMITIVES is strictly
> required by any text in the TeXBook.
>
> If I looked at one-line documentation for SOURCE_DATE_EPOCH I for one
> would expect it to change \day, \month and \year as well. I would find
> it confusingly, annoyingly and perversely inconsistent that it changed
> some date information (in the PDF) but not others (\today).
>
> If it is felt to be useful to distinguish the PDF information from the
> \today information (and at a bit of a stretch I can see why you might
> want to do that), then that would be reasonable functionality. But
> perhaps the ..._TEX_PRIMITIVES environment variable should default to
> 'yes'. That is 'change some date information but not others' should be
> regarded as the non-default behaviour.
I'm still not seeing a compelling reason to tinker with existing TeX
primitives here.
Given a document "mydoc.tex" that (mis)uses \today:
\documentclass{article}
\begin{document}
This document was written on \today.
\end{document}
a user (or distro build process) can simply replace the command
pdflatex mydoc
with one such as
pdflatex \\year=2016 \\month=4 \\day=1 \\input mydoc
and the document will contain the specified date.
In a context where SOURCE_DATE_EPOCH is used, "date" can easily generate
the numbers needed:
pdflatex `date -r ${SOURCE_DATE_EPOCH} "+\\year=%Y \\month=%m
\\day=%d"` \\input mydoc
This avoids the need for any changes to the behavior of TeX primitives,
and keeps the date hackery firmly where it belongs: in the
reproducible-build distro's build setup.
Overriding additional timestamps in metadata produced by pdftex, dvips,
dvipdfmx, etc is a different matter, but that's a distinct issue that
doesn't involve TeX primitives; it's about pdftex extensions or separate
driver programs.
JK
More information about the tex-k
mailing list