Den 01. feb. 2016 21:35, skrev Daniel Hokka Zakrisson: Tor Rune Skoglund
wrote:
>> One further question relating to hashify:
>>
>> How is the hash value created ? What is it based on? - Just the file
>> contents, or (some of - which?) file metadata also?
> File metadata including mode, uid, gid, rdev, size, and mtime is also
> included. The entirety of the file is used.
>
>> I have a strange test case here where two binary equal files in the same
>> file system, same name, same locations but in two guest did not get
>> hashified to the same hash value, and I an trying to understand why?
> Could you also post the result of stat on the two files?
Almost needless to say, your answer explains the cause perfectly. The
mtimes are different, creating a different hash for the files:
amd64 part4 # stat ./vservers/machine96/usr/bin/bc
File: «./vservers/machine96/usr/bin/bc»
Size: 84952 Blocks: 176 IO Block: 4096 vanlig fil
Device: 804h/2052d Inode: 2525495 Links: 2
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2016-01-26 18:36:24.000000000 +0100
Modify: 2016-01-26 18:36:24.000000000 +0100
Change: 2016-01-26 19:46:38.000000000 +0100
Birth: -
amd64 part4 # stat ./vservers/machine95/usr/bin/bc
File: «./vservers/machine95/usr/bin/bc»
Size: 84952 Blocks: 176 IO Block: 4096 vanlig fil
Device: 804h/2052d Inode: 2205290 Links: 2
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2016-01-26 18:36:21.000000000 +0100
Modify: 2016-01-26 18:36:21.000000000 +0100
Change: 2016-01-26 19:46:10.000000000 +0100
Birth: -
So in the case where one does not care about/use any of the times values
for a file, one could first "time-syncronize" any files that have equal
contents and are having similar (other) meta data before running
hashify, I presume.
Thanks! :-)
BR,
Tor Rune Skoglund
> Best regards,
> Daniel
>
>> amd64 part4 # ls -il vservers/machine95/usr/bin/bc
>> 2205290 -rwxr-xr-x 2 root root 84952 jan. 26 18:36
>> vservers/machine95/usr/bin/bc
>>
>> amd64 part4 # ls -il vservers/machine96/usr/bin/bc
>> 2525495 -rwxr-xr-x 2 root root 84952 jan. 26 18:36
>> vservers/machine96/usr/bin/bc
>>
>> amd64 part4 # find . -inum 2205290
>> ./vservers/machine95/usr/bin/bc
>> ./hashfilesstore/33/7b/6e544172a896550e582becb191d55df1713a-00000000
>>
>> amd64 part4 # find . -inum 2525495
>> ./vservers/machine96/usr/bin/bc
>> ./hashfilesstore/f2/ec/4d721c12734000a00253c0ce2708fda82203-00000000
>>
>> amd64 part4 # md5sum ./vservers/machine96/usr/bin/bc
>> 29ad08e28e17cb179328103c9835d495 ./vservers/machine96/usr/bin/bc
>>
>> amd64 part4 # md5sum ./vservers/machine95/usr/bin/bc
>> 29ad08e28e17cb179328103c9835d495 ./vservers/machine95/usr/bin/bc
>>
>> BR,
>> Tor Rune Skoglund, trs@swi.no
>>
>>
>>
Received on Mon Feb 1 22:40:08 2016