From: Greg Russell on
Does the gzip (-z) option to tar introduce some entropy into a file
between iterations with the same arguments? e.g.:

$ tar czf test_0.tgz *.txt; tar czf test_1.tgz *.txt
$ ls -l *.tgz
-rw-rw-r-- 1 me me 4262 Apr 14 08:22 test_0.tgz
-rw-rw-r-- 1 me me 4262 Apr 14 08:22 test_1.tgz
$ diff *.tgz
Binary files test_0.tgz and test_1.tgz differ

$ cmp -l *.tgz
5 277 310

$ tar cf test_0.tar *.txt; tar cf test_1.tar *.txt
$ ls -l *.tar
-rw-rw-r-- 1 me me 194560 Apr 14 08:25 test_0.tar
-rw-rw-r-- 1 me me 194560 Apr 14 08:25 test_1.tar
$ diff *.tar
$

$ tar --version
tar (GNU tar) 1.15.1

I'll run a memtest86 just to see what that reports though.
From: Greg Russell on
On Wed, 14 Apr 2010 15:41:12 +0000, I wrote:

> Does the gzip (-z) option to tar introduce some entropy into a file
> between iterations with the same arguments? e.g.:
>
> $ tar czf test_0.tgz *.txt; tar czf test_1.tgz *.txt $ ls -l *.tgz
> -rw-rw-r-- 1 me me 4262 Apr 14 08:22 test_0.tgz -rw-rw-r-- 1 me me 4262
> Apr 14 08:22 test_1.tgz $ diff *.tgz
> Binary files test_0.tgz and test_1.tgz differ
>
> $ cmp -l *.tgz
> 5 277 310
>
> $ tar cf test_0.tar *.txt; tar cf test_1.tar *.txt $ ls -l *.tar
> -rw-rw-r-- 1 me me 194560 Apr 14 08:25 test_0.tar -rw-rw-r-- 1 me me
> 194560 Apr 14 08:25 test_1.tar $ diff *.tar
> $
>
> $ tar --version
> tar (GNU tar) 1.15.1

Also, it's curious to find:

$ gzip -c *.txt > test_0.gz; $ gzip -c *.txt > test_1.gz
$ diff *.gz
$

From: Harald Meyer on
Greg Russell wrote:
> Does the gzip (-z) option to tar introduce some entropy into a file
> between iterations with the same arguments? e.g.:

gzip preserves the timestamp of the input file, in this case the .tar file.
From: Greg Russell on
On Wed, 14 Apr 2010 18:10:36 +0200, Harald Meyer wrote:

> Greg Russell wrote:
>> Does the gzip (-z) option to tar introduce some entropy into a file
>> between iterations with the same arguments? e.g.:
>
> gzip preserves the timestamp of the input file, in this case the .tar
> file.

What does that mean wrt:

$ tar czf test_0.tgz *.txt; tar czf test_1.tgz *.txt

Is a transient tar file created before the gzip process, and that's the
difference accounted by:

$ cmp -l *.tgz
5 277 310

Is there any option to disable the feature that causes the problem?
From: Harald Meyer on
Greg Russell wrote:

> Is a transient tar file created before the gzip process, and that's the
> difference accounted by:

The tar archive is streamed, I think its just the current system time.

> Is there any option to disable the feature that causes the problem?

I don't know any. As a workaround create an intermediate .tar file, use
touch -d (date) my.tar
to give it the given time stamp and gzip it. Or hack gzip.