|
From: | Tim Kientzle |
Subject: | Re: [Bug-tar] creating identical .tar.gz files for use with version control |
Date: | Fri, 20 Mar 2009 10:26:54 -0700 |
User-agent: | Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060422 |
Sergey Poznyakoff wrote:
Chris Pickett <address@hidden> ha escrit: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.The tar archive keeps, apart from the files themselves, some metadata, e.g. their mtime, so the two archive may differ even though they contain exactly the same files.
Perhaps more importantly, the default GNU tar format stores atime, which could cause differences even if the files are unchanged. Try --format=ustar and see if that helps. ustar format does not store atime, and mtime should only change if you actually change the file. Another problem you may run into: I don't remember how GNU tar handles this, but bsdtar stores the files in the order that the OS returns them from readdir(). On some newer filesystems, this can vary essentially at random. You may be able to control this by using explicit filenames in the tar command line, e.g., tar czf output.tgz a/file1 a/file2 ... or by otherwise forcing the filenames into a fixed order: find a | sort | tar czf output.tgz -T - Good luck, Tim
[Prev in Thread] | Current Thread | [Next in Thread] |