0

Given are two directories a/ and b/ with apparently equal content,

$ diff -Naur a b
$

After packing the contents of contents of the directories in to tars,

cd a/ && tar cf ../a.tar * && cd ..
cd b/ && tar cf ../b.tar * && cd ..

I noticed that the checksum of those are not equal,

$ md5sum *.tar 
9cf2799bab8a0ac7cbeabee5f2305f17  a.tar
4104addd5c8c31b23179cf23fc15a578  b.tar

Note that this is even without using gzip which is known to have time-dependent meta data.

Doing the same thing a second time

cd a/ && tar cf ../a2.tar * && cd ..
cd b/ && tar cf ../b2.tar * && cd ..

yields the same checksums

$ md5sum *2.tar
9cf2799bab8a0ac7cbeabee5f2305f17  a2.tar
4104addd5c8c31b23179cf23fc15a578  b2.tar

so tar time stamps have nothing to do with it. Apparently, the contents of the folders are not entirely equal, although diff says so.

Can that be?

Nico Schlömer
  • 205
  • 1
  • 2
  • 7
  • 1
    Tar includes plenty of meta data about the files like ownership and permissions and the like, perhaps those differ even if the list of files and contents of the files are the same? – Eric Renouf May 19 '16 at 13:43
  • @EricRenouf Is there any way to tell? – Nico Schlömer May 19 '16 at 13:56
  • The first thing would be just to do `ls -l a/ b/` and look at the permissions and modification times, if they're different the tars will likely be different – Eric Renouf May 19 '16 at 14:07
  • They're not. I guess I'll have to try and find the issue manually... – Nico Schlömer May 19 '16 at 14:12
  • 1
    Examine the files with a binary viewer e.g. `hexdump -C` and compare the bytes. You can use `cmp -l` to compare the files and show differing bytes and their offsets (although you'll have to convert the decimal numbers to the hexadecimal numbers used in `hexdump`). – wurtel May 19 '16 at 14:45

0 Answers0