[CentOS-mirror] Yum 3.2.8-9 from msync-dvd.centos.org wrong?

Tue Jul 22 02:12:27 UTC 2008
Brandon Davidson <brandond at uoregon.edu>

H. Peter Anvin wrote:
> Brandon Davidson wrote:
>> AFAICT, hardlink.py checks a number of things to determine whether or 
>> not files are eligible for hardlinking:
>> * size is the same
>> * size is not zero
>> * file mode is the same
>> * owner user id is the same
>> * owner group id is the same
>> * modified time is the same (unless date hashing is disabled)
> Does it actually compare the contents?

Yes, it looks like it does :) If it passes the above eligibility check, it 
then continues on to a raw block comparison:

     buffer_size = 1024*1024
     while 1:
         buffer1 = file1.read(buffer_size)
         buffer2 = file2.read(buffer_size)
         if buffer1 != buffer2:
             result = False
         if not buffer1:
             result = True

I don't claim to be a Python expert, but I don't see any obvious problems with 
this. There is of course the obvious window between the initial stat and the 
following block comparison in which the files could be modified, but it seems 
unlikely to be the cause of our problems in this case.

FYI, I'm looking here:


Brandon Davidson
Systems Administrator
University of Oregon Neuroinformatics Center
(541) 346-2417 brandond at uoregon.edu
Key Fingerprint 1F08 A331 78DF 1EFE F645 8AE5 8FBE 4147 E351 E139