bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] Re: creating identical .tar.gz files for use with version cont


From: Chris Pickett
Subject: [Bug-tar] Re: creating identical .tar.gz files for use with version control
Date: Tue, 31 Mar 2009 03:14:33 -0400
User-agent: Thunderbird 1.5.0.14 (Macintosh/20071210)

Nathan Stratton Treadway wrote:
For example, using an unchanged input file but compressing via a pipe, I get two different files, with different internal timestamps:

  $ cat t.lis | gzip -c > t1.gz
  $ cat t.lis | gzip -c > t2.gz
$ md5sum t?.gz cc5018e00c774f4757c603104362c63c t1.gz
  2723ebc8a59e28b38088a3f3ad6b988d  t2.gz
  $ file t?.gz
  t1.gz: gzip compressed data, from Unix, last modified: Fri Mar 20 13:59:18 
2009
  t2.gz: gzip compressed data, from Unix, last modified: Fri Mar 20 13:59:22 
2009

(Though if you do find a way to get an otherwise-stable .tar file, you
might be able to work around this somehow using "-n" option for "gzip".)

Indeed, this does actually work.  Thanks!

$ mkdir a
$ touch a/b
$ tar cvfz a1.tar.gz a/
a/
a/b
$ tar cvfz a2.tar.gz a/
a/
a/b
$ diff a1.tar.gz a2.tar.gz
Binary files a1.tar.gz and a2.tar.gz differ
$ rm a1.tar.gz a2.tar.gz
$ tar cvf a1.tar a/
a/
a/b
$ tar cvf a2.tar a/
a/
a/b
$ diff a1.tar a2.tar
$ cat a1.tar | gzip -n -c > a1.tar.gz
$ cat a2.tar | gzip -n -c > a2.tar.gz
$ diff a1.tar.gz a2.tar.gz

I guess this is the only way to do it portably, since even if you add an option to tell gzip -n, it still won't make it into the non-GNU tars.

Chris




reply via email to

[Prev in Thread] Current Thread [Next in Thread]