Ignore:
Timestamp:
10/02/2010 19:01:12 (2 years ago)
Author:
chris
Message:

Log more detailed info about backup comparison failures, for debugging.

Enable -V option in bbackupquery, and document that -q, -v, -V and
-W<level> are allowed in the command-line help.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/backupclient/BackupClientFileAttributes.cpp

    r2493 r2604  
    235235        if(mpClearAttributes->GetSize() != rAttr.mpClearAttributes->GetSize()) 
    236236        { 
     237                BOX_TRACE("Attribute Compare: Attributes objects are " 
     238                        "different sizes, cannot compare them: local " << 
     239                        mpClearAttributes->GetSize() << " bytes, remote " << 
     240                        rAttr.mpClearAttributes->GetSize() << " bytes"); 
    237241                return false; 
    238242        } 
     
    242246        attr_StreamFormat *a1 = (attr_StreamFormat*)mpClearAttributes->GetBuffer(); 
    243247        attr_StreamFormat *a2 = (attr_StreamFormat*)rAttr.mpClearAttributes->GetBuffer(); 
    244          
    245         if(a1->AttributeType != a2->AttributeType 
    246                 || a1->UID != a2->UID 
    247                 || a1->GID != a2->GID 
    248                 || a1->UserDefinedFlags != a2->UserDefinedFlags 
    249                 || a1->Mode != a2->Mode) 
    250         { 
    251                 return false; 
    252         } 
     248 
     249        #define COMPARE(attribute, message) \ 
     250        if (a1->attribute != a2->attribute) \ 
     251        { \ 
     252                BOX_TRACE("Attribute Compare: " << message << " differ: " \ 
     253                        "local " << a1->attribute << ", " \ 
     254                        "remote " << a2->attribute); \ 
     255                return false; \ 
     256        } 
     257        COMPARE(AttributeType, "Attribute types"); 
     258        COMPARE(UID, "UIDs"); 
     259        COMPARE(GID, "GIDs"); 
     260        COMPARE(UserDefinedFlags, "User-defined flags"); 
     261        COMPARE(Mode, "Modes"); 
    253262         
    254263        if(!IgnoreModTime) 
     
    258267                if(t1 != t2) 
    259268                { 
     269                        BOX_TRACE("Attribute Compare: File modification " 
     270                                "times differ: local " << t1 << ", " 
     271                                "remote " << t2); 
    260272                        return false; 
    261273                } 
     
    268280                if(t1 != t2) 
    269281                { 
     282                        BOX_TRACE("Attribute Compare: Attribute modification " 
     283                                "times differ: local " << t1 << ", " 
     284                                "remote " << t2); 
    270285                        return false; 
    271286                } 
     
    277292        { 
    278293                // Symlink strings don't match. This also compares xattrs 
    279                 if(::memcmp(a1 + 1, a2 + 1, size - sizeof(attr_StreamFormat)) != 0) 
    280                 { 
     294                int datalen = size - sizeof(attr_StreamFormat); 
     295 
     296                if(::memcmp(a1 + 1, a2 + 1, datalen) != 0) 
     297                { 
     298                        std::string s1((char *)(a1 + 1), datalen); 
     299                        std::string s2((char *)(a2 + 1), datalen); 
     300                        BOX_TRACE("Attribute Compare: Symbolic link target " 
     301                                "or extended attributes differ: " 
     302                                "local " << PrintEscapedBinaryData(s1) << ", " 
     303                                "remote " << PrintEscapedBinaryData(s2)); 
    281304                        return false; 
    282305                } 
Note: See TracChangeset for help on using the changeset viewer.