[Top][All Lists]
[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: |
Nathan Stratton Treadway |
Subject: |
[Bug-tar] Re: creating identical .tar.gz files for use with version control |
Date: |
Fri, 20 Mar 2009 14:10:19 -0400 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
On Thu, Mar 19, 2009 at 18:02:53 -0400, Chris Pickett wrote:
> For example:
>
> tar cvfz a.tar.gz a/
[...]
> However, if I repeat the process without changing the underlying files,
> a.tar.gz is different, and thus it needs to get checked in again.
>
> Is there an option set I can use to prevent this? I am using tar-1.19.
Note that, apart from anything the tar command is doing, the "gzip"
records the current date/time inside the .gz file. (Well, normally it's
the last modification time of the original file, but in this case tar
is compressing via a pipe, so the current time is used.) So even if
you could get "tar" to produce the same output on successive runs, the
.gz files would still differ...
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".)
Nathan
----------------------------------------------------------------------------
Nathan Stratton Treadway - address@hidden - Mid-Atlantic region
Ray Ontko & Co. - Software consulting services - http://www.ontko.com/
GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt ID: 1023D/ECFB6239
Key fingerprint = 6AD8 485E 20B9 5C71 231C 0C32 15F3 ADCD ECFB 6239