Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Dec 2015 18:40:07 +0100
From:      Fabian Keil <freebsd-listen@fabiankeil.de>
To:        Freebsd hackers list <freebsd-hackers@FreeBSD.org>
Subject:   Re: How to get the deterministic result for FreeBSD tar(1)?
Message-ID:  <20151208184007.3080da7b@fabiankeil.de>
In-Reply-To: <5666B828.5000306@rawbw.com>
References:  <5666B828.5000306@rawbw.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/_d.KNCs67RBAR5IAKg=XBE6
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Yuri <yuri@rawbw.com> wrote:

> I have two identical directories (no diffs, all identical mtime=20
> attributes) compressed by this command:
> find dir -print0 | LC_ALL=3DC sort -z | tar cf archive.tgz --format=3Dbsd=
tar=20
> --no-recursion --null -T -
>=20
> The results are different: 3 files out of 10,000 have pax attributes set=
=20
> that are different:
> - 27 ctime=3D1449566560.642715
> +27 ctime=3D1449566903.167521
[...]=20
> So I have two questions:
> 1. How do I actually achieve the output determinism for tar(1)?

You can use an mtree spec to set fake timestamps etc.

For an example see patch 12 in this set:
https://www.fabiankeil.de/sourcecode/electrobsd/reproducible-build-goo-r291=
706-29246dc.diff

Patch 5 contains a script to regenerate tar files with normalized
timestamps (and some other attributes) but of course generating the
files twice is a bit silly if it can be avoided.

> 2. Is there an agreement that this is a bug that too long or non-ASCII=20
> path name triggers the leakage of ctime into a tar file?

My general impression is that large parts of tar's behaviour are
undefined (due to lack of documentation) and it's not obvious to
me that this isn't one of them.

Fabian

--Sig_/_d.KNCs67RBAR5IAKg=XBE6
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlZnFfgACgkQBYqIVf93VJ1JKwCgjigFJo/uCBufdBtn1syd4RK2
3rkAniiF5gYg/sts1h8L1lvkQVEguXsh
=DN/n
-----END PGP SIGNATURE-----

--Sig_/_d.KNCs67RBAR5IAKg=XBE6--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20151208184007.3080da7b>