On Wed, Jul 2, 2014 at 6:04 PM, Reindl Harald <h.reindl(a)thelounge.net> wrote:
but it's just dangerous to assume that will be forever true
Agreed with this, but:
and as you can see below with gzip you have *always*
different results for the same data
This is not true, see below.
[harry@srv-rhsoft:~/Desktop]$ tar -p -czf 1.tar.gz test.bin
[harry@srv-rhsoft:~/Desktop]$ tar -p -czf 2.tar.gz test.bin
[harry@srv-rhsoft:~/Desktop]$ tar -p -czf 3.tar.gz test.bin
[harry@srv-rhsoft:~/Desktop]$ tar -p -czf 4.tar.gz test.bin
[harry@srv-rhsoft:~/Desktop]$ tar -p -czf 5.tar.gz test.bin
[harry@srv-rhsoft:~/Desktop]$ md5sum *.gz
8f132cafffe6d7a613a480a5e593abc8 1.tar.gz
3cf402bbbde27db631a2896af9365275 2.tar.gz
5cb1fc9f6628a41d71572862ea4c19a1 3.tar.gz
bd51a4779ca4e2e9377488dc64ccaf1c 4.tar.gz
5506a0cfbf39cb28b05babba6755049a 5.tar.gz
These tests are faulty, they're not testing gzip with the same data.
You're (well tar is internally) gzipping five temporary tarballs that
have different timestamps and/or filenames, and gzip's default
behavior is to store original file's filename and timestamp so
naturally they differ.
To actually test gzip, do for example:
$ gzip -c test.bin > 1.gz
$ gzip -c test.bin > 2.gz
$ md5sum *gz
aca340cd42ffd3b2c6a25b646637cae5 1.gz
aca340cd42ffd3b2c6a25b646637cae5 2.gz
...or if you want to do it with tar, need to tell it to pass -n to
gzip, for example:
$ tar c test.bin -I "gzip -n" > 1.tar.gz
$ tar c test.bin -I "gzip -n" > 2.tar.gz
$ md5sum *gz
03d30b886f9a2f5219909662586e44b5 1.tar.gz
03d30b886f9a2f5219909662586e44b5 2.tar.gz