Bug#828683: mc: please make the build reproducible

Vagrant Cascadian vagrant at reproducible-builds.org
Thu Oct 6 20:53:52 BST 2022


On 2016-06-27, Yury V. Zaytsev wrote:
> On Mon, 27 Jun 2016, Reiner Herrmann wrote:

Going through some old outstanding reproducible builds related bugs...

>> You are right, the mtime of the file is used for the manpage timestamp. 
>> But there is still a patch modifying the manpage: 
>> mcedit_full_path.patch. When this patch is upstreamed, the 
>> SOURCE_DATE_EPOCH patch is not needed, though it would still help when 
>> the manpages are patched.
>
> Thank you for the confirmation that my guesses are correct!
>
> However, I'm hesitant to apply SOURCE_DATE_EPOCH to anything that looks 
> like a nail. I believe that patching of upstream sources by Debian is such 
> an oft occurring situation, that I would rather look for at solution at 
> the packaging level. After all, builds from *upstream* sources are 
> *already* reproducible, in this case, it's the Debian build procedure that 
> is injecting randomness here.

I am biased, but I do think using SOURCE_DATE_EPOCH could still be a
reasonable approach upstream. There are some examples of how to use this
in various languages:

  https://reproducible-builds.org/docs/source-date-epoch/

I did notice some things in the upstream code
doc/man/date-of-man-include.am:

MAN_DATE_CMD = \
        LC_ALL=$(DATE_LANG) @PERL@ -CS -MPOSIX -e '\
            @fi=lstat("'$${MAN_FILE}'"); \
            print POSIX::strftime("$(DATE_FORMAT)", localtime($$fi[9]));' 2>/dev/null

This uses localtime, which could be affected by timezone differences. To
my surprise, it doesn't appear to affect the results, as only the
patched manpage is affected:

  https://tests.reproducible-builds.org/debian/rb-pkg/bookworm/amd64/diffoscope-results/mc.html

Setting LC_ALL explicitly avoids variations due to the build
environment's locale(yay!), although the specified locales are not
guaranteed to be available (adding locales-all to build-depends could
fix that).

Again, surprisingly, this has not appeared to affect the results for the
locales tested on tests.reproducible-builds.org, though that may mean
the default locale is used even for the translated pages...


> For instance, it seems to me that it is only logical to set the mtime of 
> patched files to the mtime of the last patch that touched them, and this 
> will make the source mtime dependent builds fully reproducible.

The attached alternate implements this for mc by touching the potential
files before running configure with a consistent timestamp.

According to my local tests, applying this patch should make mc build
reproducibly once it lands in testing/bookworm! There are outstanding
build path issues tested in unstable and experimental.

It doesn't address the larger issue of files modified by debian/patches
having the current timestamp, which is a much more complicated
intersection of issues.


live well,
  vagrant
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-debian-rules-Ensure-consistent-timestamp-on-manpages.patch
Type: text/x-diff
Size: 1117 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/reproducible-builds/attachments/20221006/0f3a8ff5/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/reproducible-builds/attachments/20221006/0f3a8ff5/attachment.sig>


More information about the Reproducible-builds mailing list