[Reproducible-builds] timestamps_in_directories

Niko Tyni ntyni at debian.org
Sun Oct 11 13:12:31 UTC 2015

On Sat, Oct 10, 2015 at 10:46:02AM +0000, Santiago Vila wrote:
> I've created a new issue for this:
> -drwxr-xr-x root/root         0 2012-04-14 07:35:49 ./usr/share/doc/llgal/examples/
> +drwxr-xr-x root/root         0 2011-08-02 10:42:19 ./usr/share/doc/llgal/examples/

> This suggests that the problem is maybe related to one or more of the
> dh_* tools and/or different filesystem ordering, as the source
> packages themselves do not seem to be doing anything "strange".

It's indeed an unfortunate interaction of dh_installdocs and disorderfs
when installing directory hierarchies.

dh_installdocs is doing
    cd 'doc/examples//..' && find 'examples' \( -type f -or -type l \) -and ! -empty -print0 | xargs -0 -I {} cp --reflink=auto --parents -dp {} /home/niko/tmp/mnt/debian/llgal/usr/share/doc/llgal

but 'cp --parents -p' creates subdirectories with different timestamps
depending on the order of its arguments. Consider:

  % ls -lR src
  total 4
  drwxr-xr-x 3 niko niko 4096 Nov  9  2006 d1
  total 8
  drwxr-xr-x 2 niko niko 4096 Oct 18  2006 d2
  -rw-r--r-- 1 niko niko  547 Nov  9  2006 f1.txt
  total 4
  -rw-r--r-- 1 niko niko 901 Oct 18  2006 f2
  % cp --parents -p src/d1/f1.txt src/d1/d2/f2 dst1 && ls -ld dst1/src/d1
  drwxr-xr-x 3 niko niko 4096 Nov  9  2006 dst1/src/d1
  % cp --parents -p src/d1/d2/f2 src/d1/f1.txt dst2 && ls -ld dst2/src/d1    
  drwxr-xr-x 3 niko niko 4096 Oct 11 15:56 dst2/src/d1
It looks like the directory is first created with the original timestamp,
but the stamp will be updated if a file is later generated immediately
below it. Which makes sense to me.

So I don't think cp is doing anything wrong here. The best fix I can
think of is adding a 'sort -z' in the pipeline between find and xargs.

Note that there's very similar code in dh_install and dh_installexamples
that may well be equally affected.
Niko Tyni   ntyni at debian.org

More information about the Reproducible-builds mailing list