From boxbackup-dev at boxbackup.org Mon Dec 1 00:59:50 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Mon, 1 Dec 2008 00:59:50 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2394 - box/trunk/bin/bbackupd Message-ID: <20081201005950.69AAC32502C@www.boxbackup.org> Author: chris Date: 2008-12-01 00:59:49 +0000 (Mon, 01 Dec 2008) New Revision: 2394 Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: Fix missing parentheses on stored file ID messages. Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2008-11-30 22:25:27 UTC (rev 2393) +++ box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2008-12-01 00:59:49 UTC (rev 2394) @@ -1086,7 +1086,7 @@ if(latestObjectID != 0) { // Use this one - BOX_TRACE("Storing uploaded file ID " << inodeNum << " (" << filename << " in ID map as object " << latestObjectID << " with parent " << mObjectID << " (" << rLocalPath << ")"); + BOX_TRACE("Storing uploaded file ID " << inodeNum << " (" << filename << ") in ID map as object " << latestObjectID << " with parent " << mObjectID << " (" << rLocalPath << ")"); idMap.AddToMap(inodeNum, latestObjectID, mObjectID /* containing directory */); } else @@ -1110,7 +1110,7 @@ // into it. However, in a long running process this may happen occasionally and // not indicate anything wrong. // Run the release version for real life use, where this check is not made. - BOX_TRACE("Storing found file ID " << inodeNum << " (" << filename << " in ID map as object " << latestObjectID << " with parent " << mObjectID << " (" << rLocalPath << ")"); + BOX_TRACE("Storing found file ID " << inodeNum << " (" << filename << ") in ID map as object " << latestObjectID << " with parent " << mObjectID << " (" << rLocalPath << ")"); idMap.AddToMap(inodeNum, objid, mObjectID /* containing directory */); } } From boxbackup-dev at boxbackup.org Mon Dec 1 01:31:52 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Mon, 1 Dec 2008 01:31:52 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2395 - in box/trunk/lib: common win32 Message-ID: <20081201013152.06C9432502C@www.boxbackup.org> Author: chris Date: 2008-12-01 01:31:51 +0000 (Mon, 01 Dec 2008) New Revision: 2395 Modified: box/trunk/lib/common/BoxPlatform.h box/trunk/lib/win32/emu.h Log: Fix the use of an unreasonably short type as the temporary storage for inode numbers on Windows, resulting in all inode numbers being coerced into 2^16 space and many duplicates on systems with large numbers of files being backed up, possibly resulting in store corruption due to unwanted file rename operations. Modified: box/trunk/lib/common/BoxPlatform.h =================================================================== --- box/trunk/lib/common/BoxPlatform.h 2008-12-01 00:59:49 UTC (rev 2394) +++ box/trunk/lib/common/BoxPlatform.h 2008-12-01 01:31:51 UTC (rev 2395) @@ -38,6 +38,10 @@ // must define this before importing #define __MSVCRT_VERSION__ 0x0601 #endif + + // stop sys/types.h from defining its own ino_t as short, + // because we want a bigger one :) + #define _INO_T_ #endif #ifdef HAVE_SYS_TYPES_H Modified: box/trunk/lib/win32/emu.h =================================================================== --- box/trunk/lib/win32/emu.h 2008-12-01 00:59:49 UTC (rev 2394) +++ box/trunk/lib/win32/emu.h 2008-12-01 01:31:51 UTC (rev 2395) @@ -25,6 +25,9 @@ #ifdef __MINGW32__ typedef uint32_t u_int32_t; + typedef uint64_t _ino_t; + typedef _ino_t ino_t; + #define _INO_T_ #else typedef unsigned int mode_t; typedef unsigned int pid_t; From boxbackup-dev at boxbackup.org Mon Dec 1 22:17:54 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Mon, 1 Dec 2008 22:17:54 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2396 - box/trunk/bin/bbackupd Message-ID: <20081201221754.539A4325FCB@www.boxbackup.org> Author: chris Date: 2008-12-01 22:17:52 +0000 (Mon, 01 Dec 2008) New Revision: 2396 Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp Log: Reduce severity of some log messages about notifying system administrator. It's not an error to have no NotifyScript. Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.cpp 2008-12-01 01:31:51 UTC (rev 2395) +++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2008-12-01 22:17:52 UTC (rev 2396) @@ -2158,10 +2158,21 @@ !GetConfiguration().GetKeyValueBool("NotifyAlways")) { // Don't send lots of repeated messages + // Note: backup-start and backup-finish will always be + // logged, because mLastNotifiedEvent is never set to + // these values and therefore they are never "duplicates". if(mLastNotifiedEvent == Event) { - BOX_WARNING("Suppressing duplicate notification about " << - sEventNames[Event]); + if(Event == SysadminNotifier::BackupOK) + { + BOX_INFO("Suppressing duplicate notification " + "about " << sEventNames[Event]); + } + else + { + BOX_WARNING("Suppressing duplicate notification " + "about " << sEventNames[Event]); + } return; } } @@ -2174,7 +2185,7 @@ if(Event != SysadminNotifier::BackupStart && Event != SysadminNotifier::BackupFinish) { - BOX_ERROR("Not notifying administrator about event " + BOX_INFO("Not notifying administrator about event " << sEventNames[Event] << " -- set NotifyScript " "to do this in future"); } @@ -2186,7 +2197,7 @@ sEventNames[Event]); // Log what we're about to do - BOX_NOTICE("About to notify administrator about event " + BOX_INFO("About to notify administrator about event " << sEventNames[Event] << ", running script '" << script << "'"); @@ -2194,7 +2205,7 @@ int returnCode = ::system(script.c_str()); if(returnCode != 0) { - BOX_ERROR("Notify script returned error code: " << + BOX_WARNING("Notify script returned error code: " << returnCode << " ('" << script << "')"); } else if(Event != SysadminNotifier::BackupStart && From boxbackup-dev at boxbackup.org Fri Dec 5 20:30:08 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Fri, 5 Dec 2008 20:30:08 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2397 - box/trunk/lib/server Message-ID: <20081205203008.A272B325FCB@www.boxbackup.org> Author: chris Date: 2008-12-05 20:30:07 +0000 (Fri, 05 Dec 2008) New Revision: 2397 Modified: box/trunk/lib/server/SSLLib.cpp Log: Grammar fix in SSL error message when SSL library initialisation fails. Modified: box/trunk/lib/server/SSLLib.cpp =================================================================== --- box/trunk/lib/server/SSLLib.cpp 2008-12-01 22:17:52 UTC (rev 2396) +++ box/trunk/lib/server/SSLLib.cpp 2008-12-05 20:30:07 UTC (rev 2397) @@ -39,7 +39,7 @@ { if(!::SSL_library_init()) { - LogError("Initialisation"); + LogError("initialising OpenSSL"); THROW_EXCEPTION(ServerException, SSLLibraryInitialisationError) } From boxbackup-dev at boxbackup.org Fri Dec 5 20:32:09 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Fri, 5 Dec 2008 20:32:09 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2398 - box/trunk/lib/common Message-ID: <20081205203209.9306E325FCB@www.boxbackup.org> Author: chris Date: 2008-12-05 20:32:09 +0000 (Fri, 05 Dec 2008) New Revision: 2398 Modified: box/trunk/lib/common/Box.h Log: Reformat ASSERT macro for readability. Reformat THROW_EXCEPTION macro to avoid overlong lines. Add THROW_EXCEPTION_MESSAGE macro to allow throwing an exception with a message, such as the file name that caused the exception. Modified: box/trunk/lib/common/Box.h =================================================================== --- box/trunk/lib/common/Box.h 2008-12-05 20:30:07 UTC (rev 2397) +++ box/trunk/lib/common/Box.h 2008-12-05 20:32:09 UTC (rev 2398) @@ -42,7 +42,15 @@ extern bool AssertFailuresToSyslog; #define ASSERT_FAILS_TO_SYSLOG_ON {AssertFailuresToSyslog = true;} void BoxDebugAssertFailed(const char *cond, const char *file, int line); - #define ASSERT(cond) {if(!(cond)) {BoxDebugAssertFailed(#cond, __FILE__, __LINE__); THROW_EXCEPTION(CommonException, AssertFailed)}} + #define ASSERT(cond) \ + { \ + if(!(cond)) \ + { \ + BoxDebugAssertFailed(#cond, __FILE__, __LINE__); \ + THROW_EXCEPTION_MESSAGE(CommonException, \ + AssertFailed, #cond); \ + } \ + } // Note that syslog tracing is independent of BoxDebugTraceOn, // but stdout tracing is not @@ -96,13 +104,21 @@ #define THROW_EXCEPTION(type, subtype) \ { \ OPTIONAL_DO_BACKTRACE \ - BOX_WARNING("Exception thrown: " #type "(" #subtype ") at " \ - __FILE__ "(" << __LINE__ << ")") \ + BOX_WARNING("Exception thrown: " #type "(" #subtype ") " \ + "at " __FILE__ "(" << __LINE__ << ")") \ throw type(type::subtype); \ } +#define THROW_EXCEPTION_MESSAGE(type, subtype, message) \ + { \ + OPTIONAL_DO_BACKTRACE \ + BOX_WARNING("Exception thrown: " #type "(" #subtype ") " \ + " (" message ") at " \ + __FILE__ "(" << __LINE__ << ")") \ + throw type(type::subtype, message); \ + } + // extra macros for converting to network byte order - #ifdef HAVE_NETINET_IN_H #include #endif From boxbackup-dev at boxbackup.org Fri Dec 5 20:32:50 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Fri, 5 Dec 2008 20:32:50 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2399 - box/trunk/lib/common Message-ID: <20081205203250.A883D325FCB@www.boxbackup.org> Author: chris Date: 2008-12-05 20:32:50 +0000 (Fri, 05 Dec 2008) New Revision: 2399 Modified: box/trunk/lib/common/makeexception.pl.in Log: Allow exceptions to contain a message string. Modified: box/trunk/lib/common/makeexception.pl.in =================================================================== --- box/trunk/lib/common/makeexception.pl.in 2008-12-05 20:32:09 UTC (rev 2398) +++ box/trunk/lib/common/makeexception.pl.in 2008-12-05 20:32:50 UTC (rev 2399) @@ -71,13 +71,14 @@ class ${class}Exception : public BoxException { public: - ${class}Exception(unsigned int SubType) - : mSubType(SubType) + ${class}Exception(unsigned int SubType, + const std::string& rMessage = "") + : mSubType(SubType), mMessage(rMessage) { } ${class}Exception(const ${class}Exception &rToCopy) - : mSubType(rToCopy.mSubType) + : mSubType(rToCopy.mSubType), mMessage(rToCopy.mMessage) { } @@ -108,9 +109,14 @@ virtual unsigned int GetType() const throw(); virtual unsigned int GetSubType() const throw(); virtual const char *what() const throw(); + virtual const std::string& GetMessage() const + { + return mMessage; + } private: unsigned int mSubType; + std::string mMessage; }; #endif // $guardname From boxbackup-dev at boxbackup.org Fri Dec 5 20:36:21 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Fri, 5 Dec 2008 20:36:21 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2400 - box/trunk/lib/common Message-ID: <20081205203622.00858325FCB@www.boxbackup.org> Author: chris Date: 2008-12-05 20:36:21 +0000 (Fri, 05 Dec 2008) New Revision: 2400 Modified: box/trunk/lib/common/Logging.h Log: Add BOX_LOG_NATIVE_ERROR and BOX_LOG_NATIVE_WARNING macros, which call BOX_LOG_SYS_* or BOX_LOG_WIN_* depending on platform, as this is a common reason for #ifdefs elsewhere in the code. Add BOX_LOG_SOCKET_ERROR macro to log socket errors with the type, name and port of the socket that suffered the error. Modified: box/trunk/lib/common/Logging.h =================================================================== --- box/trunk/lib/common/Logging.h 2008-12-05 20:32:50 UTC (rev 2399) +++ box/trunk/lib/common/Logging.h 2008-12-05 20:36:21 UTC (rev 2400) @@ -67,8 +67,17 @@ BOX_ERROR(stuff << ": " << GetErrorMessage(number)) #define BOX_LOG_WIN_WARNING_NUMBER(stuff, number) \ BOX_WARNING(stuff << ": " << GetErrorMessage(number)) + #define BOX_LOG_NATIVE_ERROR(stuff) BOX_LOG_WIN_ERROR(stuff) + #define BOX_LOG_NATIVE_WARNING(stuff) BOX_LOG_WIN_WARNING(stuff) +#else + #define BOX_LOG_NATIVE_ERROR(stuff) BOX_LOG_SYS_ERROR(stuff) + #define BOX_LOG_NATIVE_WARNING(stuff) BOX_LOG_SYS_WARNING(stuff) #endif +#define BOX_LOG_SOCKET_ERROR(_type, _name, _port, stuff) \ + BOX_LOG_NATIVE_ERROR(stuff << " (type " << _type << ", name " << \ + _name << ", port " << _port << ")") + #define BOX_FORMAT_HEX32(number) \ std::hex << \ std::showbase << \ From boxbackup-dev at boxbackup.org Fri Dec 5 20:56:01 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Fri, 5 Dec 2008 20:56:01 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2401 - box/trunk/bin/bbackupd Message-ID: <20081205205601.19187325FCB@www.boxbackup.org> Author: chris Date: 2008-12-05 20:56:00 +0000 (Fri, 05 Dec 2008) New Revision: 2401 Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: Catch exceptions from BackupClientFileAttributes::ReadAttributes during backup, and report which file caused them. If we cannot read the attributes of a directory to find its inode number, assume that it hasn't been renamed. Reformat "Storing uploaded file ID" log line to shorten source code lines. Change "Storing uploaded file ID" and "Found conflicting parent ID" messages not to print the path, which duplicates data earlier in the same message. Fix typo in comment. Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2008-12-05 20:36:21 UTC (rev 2400) +++ box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2008-12-05 20:56:00 UTC (rev 2401) @@ -1039,12 +1039,22 @@ // space available if(!rContext.StorageLimitExceeded()) { - // Update store - BackupClientFileAttributes attr; - attr.ReadAttributes(filename.c_str(), false /* put mod times in the attributes, please */); - MemBlockStream attrStream(attr); - connection.QuerySetReplacementFileAttributes(mObjectID, attributesHash, storeFilename, attrStream); - fileSynced = true; + try + { + // Update store + BackupClientFileAttributes attr; + attr.ReadAttributes(filename.c_str(), false /* put mod times in the attributes, please */); + MemBlockStream attrStream(attr); + connection.QuerySetReplacementFileAttributes(mObjectID, attributesHash, storeFilename, attrStream); + fileSynced = true; + } + catch (BoxException &e) + { + BOX_ERROR("Failed to read or store " + "file attributes for '" << + filename << "', will try " + "again later"); + } } } @@ -1086,7 +1096,11 @@ if(latestObjectID != 0) { // Use this one - BOX_TRACE("Storing uploaded file ID " << inodeNum << " (" << filename << ") in ID map as object " << latestObjectID << " with parent " << mObjectID << " (" << rLocalPath << ")"); + BOX_TRACE("Storing uploaded file ID " << + inodeNum << " (" << filename << ") " + "in ID map as object " << + latestObjectID << " with parent " << + mObjectID); idMap.AddToMap(inodeNum, latestObjectID, mObjectID /* containing directory */); } else @@ -1100,7 +1114,7 @@ // Found if (dirid != mObjectID) { - BOX_WARNING("Found conflicting parent ID for file ID " << inodeNum << " (" << filename << "): expected " << mObjectID << " (" << rLocalPath << ") but found " << dirid << " (same directory used in two different locations?)"); + BOX_WARNING("Found conflicting parent ID for file ID " << inodeNum << " (" << filename << "): expected " << mObjectID << " but found " << dirid << " (same directory used in two different locations?)"); } ASSERT(dirid == mObjectID); @@ -1110,8 +1124,13 @@ // into it. However, in a long running process this may happen occasionally and // not indicate anything wrong. // Run the release version for real life use, where this check is not made. - BOX_TRACE("Storing found file ID " << inodeNum << " (" << filename << ") in ID map as object " << latestObjectID << " with parent " << mObjectID << " (" << rLocalPath << ")"); - idMap.AddToMap(inodeNum, objid, mObjectID /* containing directory */); + BOX_TRACE("Storing found file ID " << + inodeNum << " (" << filename << + ") in ID map as object " << + objid << " with parent " << + mObjectID); + idMap.AddToMap(inodeNum, objid, + mObjectID /* containing directory */); } } } @@ -1172,13 +1191,15 @@ } // Flag for having created directory, so can optimise the - // recusive call not to read it again, because we know + // recursive call not to read it again, because we know // it's empty. bool haveJustCreatedDirOnServer = false; // Next, see if it's in the list of sub directories BackupClientDirectoryRecord *psubDirRecord = 0; - std::map::iterator e(mSubDirectories.find(*d)); + std::map::iterator + e(mSubDirectories.find(*d)); + if(e != mSubDirectories.end()) { // In the list, just use this pointer @@ -1218,17 +1239,34 @@ box_time_t attrModTime = 0; InodeRefType inodeNum = 0; BackupClientFileAttributes attr; - attr.ReadAttributes(dirname.c_str(), true /* directories have zero mod times */, - 0 /* not interested in mod time */, &attrModTime, 0 /* not file size */, - &inodeNum); + bool failedToReadAttributes = false; + try + { + attr.ReadAttributes(dirname.c_str(), + true /* directories have zero mod times */, + 0 /* not interested in mod time */, + &attrModTime, 0 /* not file size */, + &inodeNum); + } + catch (BoxException &e) + { + BOX_WARNING("Failed to read attributes " + "of directory, cannot check " + "for rename, assuming new: '" + << dirname << "'"); + failedToReadAttributes = true; + } + // Check to see if the directory been renamed // First, do we have a record in the ID map? int64_t renameObjectID = 0, renameInDirectory = 0; bool renameDir = false; const BackupClientInodeToIDMap &idMap( rContext.GetCurrentIDMap()); - if(idMap.Lookup(inodeNum, renameObjectID, renameInDirectory)) + + if(!failedToReadAttributes && idMap.Lookup(inodeNum, + renameObjectID, renameInDirectory)) { // Look up on the server to get the name, to build the local filename std::string localPotentialOldName; From boxbackup-dev at boxbackup.org Fri Dec 5 23:13:39 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Fri, 5 Dec 2008 23:13:39 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2402 - box/trunk/infrastructure Message-ID: <20081205231339.7EDF5325FCB@www.boxbackup.org> Author: chris Date: 2008-12-05 23:13:38 +0000 (Fri, 05 Dec 2008) New Revision: 2402 Modified: box/trunk/infrastructure/makebuildenv.pl.in Log: Simplify code for killing old fart processes on Windows/Cygwin and make it actually work at the end of the test. man kill for why we use /bin/kill instead of just kill on cygwin. Modified: box/trunk/infrastructure/makebuildenv.pl.in =================================================================== --- box/trunk/infrastructure/makebuildenv.pl.in 2008-12-05 20:56:00 UTC (rev 2401) +++ box/trunk/infrastructure/makebuildenv.pl.in 2008-12-05 23:13:38 UTC (rev 2402) @@ -400,22 +400,35 @@ "test script file for $module for writing\n"; print TESTFILE "#!/bin/sh\necho TEST: $module\n"; - if (-d "$module/testfiles") + if ($target_windows) { - if ($target_windows) - { print TESTFILE <<__E; -echo Killing any running daemons... -test -r testfiles/bbackupd.pid && /bin/kill -f `cat testfiles/bbackupd.pid` -test -r testfiles/bbstored.pid && /bin/kill -f `cat testfiles/bbstored.pid` +kill_process() +{ + test -r testfiles/$1.pid \ + && /bin/kill -0 -f `cat testfiles/$1.pid` \ + && /bin/kill -f `cat testfiles/$1.pid` +} __E } else { print TESTFILE <<__E; +kill_process() +{ + test -r testfiles/$1.pid \ + && kill -0 `cat testfiles/$1.pid` \ + && kill `cat testfiles/$1.pid` +} +__E + } + + if (-d "$module/testfiles") + { + print TESTFILE <<__E; echo Killing any running daemons... -test -r testfiles/bbackupd.pid && kill `cat testfiles/bbackupd.pid` -test -r testfiles/bbstored.pid && kill `cat testfiles/bbstored.pid` +kill_process bbackupd +kill_process bbstored __E } @@ -430,7 +443,7 @@ __E } - if(-e "$module/testextra") + if (-e "$module/testextra") { open FL,"$module/testextra" or die "Can't open $module/testextra"; @@ -440,18 +453,12 @@ print TESTFILE "$runcmd\n"; - if(-d "$module/testfiles") + if (-d "$module/testfiles") { print TESTFILE <<__E; - -# echo Killing any running daemons... -test -r testfiles/bbackupd.pid \\ -&& kill -0 `cat testfiles/bbackupd.pid` \\ -&& kill `cat testfiles/bbackupd.pid` - -test -r testfiles/bbstored.pid \\ -&& kill -0 `cat testfiles/bbstored.pid` \\ -&& kill `cat testfiles/bbstored.pid` +echo Killing any running daemons... +kill_process bbackupd +kill_process bbstored __E } From boxbackup-dev at boxbackup.org Fri Dec 5 23:37:01 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Fri, 5 Dec 2008 23:37:01 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2403 - box/trunk/infrastructure Message-ID: <20081205233701.559F3325FCB@www.boxbackup.org> Author: chris Date: 2008-12-05 23:37:00 +0000 (Fri, 05 Dec 2008) New Revision: 2403 Modified: box/trunk/infrastructure/makebuildenv.pl.in Log: Fix missing curly brace. Modified: box/trunk/infrastructure/makebuildenv.pl.in =================================================================== --- box/trunk/infrastructure/makebuildenv.pl.in 2008-12-05 23:13:38 UTC (rev 2402) +++ box/trunk/infrastructure/makebuildenv.pl.in 2008-12-05 23:37:00 UTC (rev 2403) @@ -441,7 +441,6 @@ cp -p -R ../../../$module/testfiles . __E - } if (-e "$module/testextra") { From boxbackup-dev at boxbackup.org Sat Dec 6 00:14:42 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Sat, 6 Dec 2008 00:14:42 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2404 - box/trunk/infrastructure Message-ID: <20081206001442.65681325FCB@www.boxbackup.org> Author: chris Date: 2008-12-06 00:14:41 +0000 (Sat, 06 Dec 2008) New Revision: 2404 Modified: box/trunk/infrastructure/makebuildenv.pl.in Log: More backslashes, I said, MORE BACKSLASHES! Modified: box/trunk/infrastructure/makebuildenv.pl.in =================================================================== --- box/trunk/infrastructure/makebuildenv.pl.in 2008-12-05 23:37:00 UTC (rev 2403) +++ box/trunk/infrastructure/makebuildenv.pl.in 2008-12-06 00:14:41 UTC (rev 2404) @@ -405,8 +405,8 @@ print TESTFILE <<__E; kill_process() { - test -r testfiles/$1.pid \ - && /bin/kill -0 -f `cat testfiles/$1.pid` \ + test -r testfiles/$1.pid \\ + && /bin/kill -0 -f `cat testfiles/$1.pid` \\ && /bin/kill -f `cat testfiles/$1.pid` } __E @@ -416,8 +416,8 @@ print TESTFILE <<__E; kill_process() { - test -r testfiles/$1.pid \ - && kill -0 `cat testfiles/$1.pid` \ + test -r testfiles/$1.pid \\ + && kill -0 `cat testfiles/$1.pid` \\ && kill `cat testfiles/$1.pid` } __E From boxbackup-dev at boxbackup.org Sat Dec 6 10:58:05 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Sat, 6 Dec 2008 10:58:05 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2405 - box/trunk/docs Message-ID: <20081206105805.D811D325026@www.boxbackup.org> Author: jamesog Date: 2008-12-06 10:58:04 +0000 (Sat, 06 Dec 2008) New Revision: 2405 Modified: box/trunk/docs/Makefile Log: * Look for DocBook stylesheet under /opt/local (Darwin/Macports) * Make each man page depend on bb-man.xsl so that it is regenerated if necessary Modified: box/trunk/docs/Makefile =================================================================== --- box/trunk/docs/Makefile 2008-12-06 00:14:41 UTC (rev 2404) +++ box/trunk/docs/Makefile 2008-12-06 10:58:04 UTC (rev 2405) @@ -36,6 +36,8 @@ $(MANXSL): $(MANXSL).tmpl @if [ -f /usr/local/share/xsl/docbook/manpages/docbook.xsl ]; then \ DOCBOOK=file:///usr/local/share/xsl/docbook/manpages/docbook.xsl; \ + elif [ -f /opt/local/share/xsl/docbook-xsl/manpages/docbook.xsl ]; then \ + DOCBOOK=file:///opt/local/share/xsl/docbook-xsl/manpages/docbook.xsl; \ else \ DOCBOOK=http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl; \ fi; \ @@ -63,7 +65,7 @@ @$(DBPROC) -o $@ $(NOCHUNKBOOKXSL) $< @cp $@ $(HTMLPREFIX)/man-html/. -.xml.8 .xml.5: +.xml.8 .xml.5: $(MANXSL) @$(DBPROC) -o $@ $(MANXSL) $< @cp $@ man/ @rm -f man/$@.gz From boxbackup-dev at boxbackup.org Mon Dec 8 22:11:22 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Mon, 8 Dec 2008 22:11:22 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2406 - box/trunk/lib/win32 Message-ID: <20081208221122.16E66325FD0@www.boxbackup.org> Author: chris Date: 2008-12-08 22:11:21 +0000 (Mon, 08 Dec 2008) New Revision: 2406 Modified: box/trunk/lib/win32/getopt_long.cpp Log: Only use replacement BSD getopt on Windows. Modified: box/trunk/lib/win32/getopt_long.cpp =================================================================== --- box/trunk/lib/win32/getopt_long.cpp 2008-12-06 10:58:04 UTC (rev 2405) +++ box/trunk/lib/win32/getopt_long.cpp 2008-12-08 22:11:21 UTC (rev 2406) @@ -69,7 +69,6 @@ #if defined _MSC_VER || defined __MINGW32__ #define REPLACE_GETOPT /* use this getopt as the system getopt(3) */ -#endif #ifdef REPLACE_GETOPT int opterr = 1; /* if error message should be printed */ @@ -548,3 +547,4 @@ FLAG_PERMUTE|FLAG_LONGONLY)); } +#endif // defined _MSC_VER || defined __MINGW32__ From boxbackup-dev at boxbackup.org Mon Dec 8 22:14:45 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Mon, 8 Dec 2008 22:14:45 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2407 - box/trunk/lib/common Message-ID: <20081208221445.6A291325FD0@www.boxbackup.org> Author: chris Date: 2008-12-08 22:14:44 +0000 (Mon, 08 Dec 2008) New Revision: 2407 Modified: box/trunk/lib/common/BoxException.h Log: Include header in all exception classes, as it's required by exceptions that can have a message assigned in their constructors. Modified: box/trunk/lib/common/BoxException.h =================================================================== --- box/trunk/lib/common/BoxException.h 2008-12-08 22:11:21 UTC (rev 2406) +++ box/trunk/lib/common/BoxException.h 2008-12-08 22:14:44 UTC (rev 2407) @@ -11,6 +11,7 @@ #define BOXEXCEPTION__H #include +#include // -------------------------------------------------------------------------- // From boxbackup-dev at boxbackup.org Wed Dec 10 01:02:17 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Wed, 10 Dec 2008 01:02:17 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2408 - box/trunk/docs Message-ID: <20081210010217.96C47325FD3@www.boxbackup.org> Author: jamesog Date: 2008-12-10 01:02:16 +0000 (Wed, 10 Dec 2008) New Revision: 2408 Modified: box/trunk/docs/Makefile Log: Check for DocBook stylesheet on CentOS/RHEL Modified: box/trunk/docs/Makefile =================================================================== --- box/trunk/docs/Makefile 2008-12-08 22:14:44 UTC (rev 2407) +++ box/trunk/docs/Makefile 2008-12-10 01:02:16 UTC (rev 2408) @@ -38,6 +38,8 @@ DOCBOOK=file:///usr/local/share/xsl/docbook/manpages/docbook.xsl; \ elif [ -f /opt/local/share/xsl/docbook-xsl/manpages/docbook.xsl ]; then \ DOCBOOK=file:///opt/local/share/xsl/docbook-xsl/manpages/docbook.xsl; \ + elif [ -f /usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl ]; then \ + DOCBOOK=file:///usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl; \ else \ DOCBOOK=http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl; \ fi; \ From boxbackup-dev at boxbackup.org Tue Dec 16 17:37:09 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Tue, 16 Dec 2008 17:37:09 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2409 - box/trunk/infrastructure Message-ID: <20081216173709.9B18C325FCB@www.boxbackup.org> Author: chris Date: 2008-12-16 17:37:08 +0000 (Tue, 16 Dec 2008) New Revision: 2409 Modified: box/trunk/infrastructure/makebuildenv.pl.in Log: Fix process kill function, fixes [2402] [2404]. Delete stale PID files after killing processes on Windows, as that fine OS doesn't give them a chance to clean up for themselves. Modified: box/trunk/infrastructure/makebuildenv.pl.in =================================================================== --- box/trunk/infrastructure/makebuildenv.pl.in 2008-12-10 01:02:16 UTC (rev 2408) +++ box/trunk/infrastructure/makebuildenv.pl.in 2008-12-16 17:37:08 UTC (rev 2409) @@ -405,9 +405,11 @@ print TESTFILE <<__E; kill_process() { - test -r testfiles/$1.pid \\ - && /bin/kill -0 -f `cat testfiles/$1.pid` \\ - && /bin/kill -f `cat testfiles/$1.pid` + if test -r testfiles/\$1.pid; then + /bin/kill -0 -f `cat testfiles/\$1.pid` \\ + && /bin/kill -f `cat testfiles/\$1.pid` + rm testfiles/\$1.pid + fi } __E } @@ -416,9 +418,9 @@ print TESTFILE <<__E; kill_process() { - test -r testfiles/$1.pid \\ - && kill -0 `cat testfiles/$1.pid` \\ - && kill `cat testfiles/$1.pid` + test -r testfiles/\$1.pid \\ + && kill -0 `cat testfiles/\$1.pid` \\ + && kill `cat testfiles/\$1.pid` } __E } From boxbackup-dev at boxbackup.org Fri Dec 26 20:36:20 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Fri, 26 Dec 2008 20:36:20 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2410 - box/trunk/docs Message-ID: <20081226203620.9CAF8325026@www.boxbackup.org> Author: chris Date: 2008-12-26 20:36:19 +0000 (Fri, 26 Dec 2008) New Revision: 2410 Modified: box/trunk/docs/Makefile Log: Make clean in docs directory should delete built docs. Modified: box/trunk/docs/Makefile =================================================================== --- box/trunk/docs/Makefile 2008-12-16 17:37:08 UTC (rev 2409) +++ box/trunk/docs/Makefile 2008-12-26 20:36:19 UTC (rev 2410) @@ -53,16 +53,20 @@ man/.there: if [ ! -d man ]; then mkdir man; touch man/.there; fi -man-nroff: bbackupd.8 bbackupd-config.8 bbackupctl.8 bbackupquery.8 \ +NROFF_PAGES = bbackupd.8 bbackupd-config.8 bbackupctl.8 bbackupquery.8 \ bbstored.8 bbstored-config.8 bbstoreaccounts.8 bbstored-certs.8 \ raidfile-config.8 \ bbackupd.conf.5 bbstored.conf.5 raidfile.conf.5 -man-html: bbackupd.html bbackupd-config.html bbackupctl.html bbackupquery.html \ - bbstored.html bbstored-config.html bbstoreaccounts.html bbstored-certs.html \ - raidfile-config.html \ +man-nroff: $(NROFF_PAGES) + +HTML_PAGES = bbackupd.html bbackupd-config.html bbackupctl.html \ + bbackupquery.html bbstored.html bbstored-config.html \ + bbstoreaccounts.html bbstored-certs.html raidfile-config.html \ bbackupd.conf.html bbstored.conf.html raidfile.conf.html +man-html: $(HTML_PAGES) + .xml.html: @$(DBPROC) -o $@ $(NOCHUNKBOOKXSL) $< @cp $@ $(HTMLPREFIX)/man-html/. @@ -80,6 +84,7 @@ if [ -d ./$(HTMLPREFIX) ]; then rm -rf $(HTMLPREFIX) ; fi if [ -d ./man ]; then rm -rf ./man/; fi if [ -f ExceptionCodes.xml ]; then rm ExceptionCodes.xml; fi + rm -f $(NROFF_PAGES) $(HTML_PAGES) if [ -f documentation-kit-0.10.tar.gz ]; then rm documentation-kit-0.10.tar.gz; fi From boxbackup-dev at boxbackup.org Fri Dec 26 23:58:00 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Fri, 26 Dec 2008 23:58:00 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2411 - box/trunk/lib/raidfile Message-ID: <20081226235800.6CE95325026@www.boxbackup.org> Author: chris Date: 2008-12-26 23:57:59 +0000 (Fri, 26 Dec 2008) New Revision: 2411 Modified: box/trunk/lib/raidfile/RaidFileController.cpp Log: Allow reinitialising the RaidFileController by removing any existing disc sets before adding new ones. Modified: box/trunk/lib/raidfile/RaidFileController.cpp =================================================================== --- box/trunk/lib/raidfile/RaidFileController.cpp 2008-12-26 20:36:19 UTC (rev 2410) +++ box/trunk/lib/raidfile/RaidFileController.cpp 2008-12-26 23:57:59 UTC (rev 2411) @@ -108,6 +108,10 @@ BOX_ERROR("RaidFile configuration file errors: " << err); THROW_EXCEPTION(RaidFileException, BadConfigFile) } + + // Allow reinitializing the controller by remove any existing + // disc sets. Used by Boxi unit tests. + mSetList.clear(); // Use the values int expectedSetNum = 0; From boxbackup-dev at boxbackup.org Sat Dec 27 00:27:27 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Sat, 27 Dec 2008 00:27:27 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2412 - box/trunk/bin/bbackupd Message-ID: <20081227002727.46F75325026@www.boxbackup.org> Author: chris Date: 2008-12-27 00:27:26 +0000 (Sat, 27 Dec 2008) New Revision: 2412 Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp Log: Reformat comment. Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.cpp 2008-12-26 23:57:59 UTC (rev 2411) +++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2008-12-27 00:27:26 UTC (rev 2412) @@ -777,10 +777,9 @@ if(syncPeriodStart >= syncPeriodEnd && syncPeriodStart - syncPeriodEnd < minimumFileAge) { - // This can happen if we receive a force-sync - // command less than minimumFileAge after - // the last sync. Deal with it by moving back - // syncPeriodStart, which should not do any + // This can happen if we receive a force-sync command less + // than minimumFileAge after the last sync. Deal with it by + // moving back syncPeriodStart, which should not do any // damage. syncPeriodStart = syncPeriodEnd - SecondsToBoxTime(1); From boxbackup-dev at boxbackup.org Sat Dec 27 00:27:54 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Sat, 27 Dec 2008 00:27:54 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2413 - box/trunk/bin/bbackupd Message-ID: <20081227002754.17CB0325026@www.boxbackup.org> Author: chris Date: 2008-12-27 00:27:53 +0000 (Sat, 27 Dec 2008) New Revision: 2413 Modified: box/trunk/bin/bbackupd/BackupDaemon.h Log: Make BackupDaemon::TouchFileInWorkingDir accessible for Boxi. Modified: box/trunk/bin/bbackupd/BackupDaemon.h =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.h 2008-12-27 00:27:26 UTC (rev 2412) +++ box/trunk/bin/bbackupd/BackupDaemon.h 2008-12-27 00:27:53 UTC (rev 2413) @@ -112,6 +112,9 @@ void RunSyncNow(); void OnBackupStart(); void OnBackupFinish(); + // TouchFileInWorkingDir is only here for use by Boxi. + // This does NOT constitute an API! + void TouchFileInWorkingDir(const char *Filename); private: void DeleteAllLocations(); @@ -137,8 +140,6 @@ void CloseCommandConnection(); void SendSyncStartOrFinish(bool SendStart); - void TouchFileInWorkingDir(const char *Filename); - void DeleteUnusedRootDirEntries(BackupClientContext &rContext); #ifdef PLATFORM_CANNOT_FIND_PEER_UID_OF_UNIX_SOCKET From boxbackup-dev at boxbackup.org Tue Dec 30 14:34:02 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Tue, 30 Dec 2008 14:34:02 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2414 - box/trunk/bin/bbackupd Message-ID: <20081230143402.2B8DF325FCB@www.boxbackup.org> Author: chris Date: 2008-12-30 14:34:00 +0000 (Tue, 30 Dec 2008) New Revision: 2414 Added: box/trunk/bin/bbackupd/BackupDaemonInterface.h Modified: box/trunk/bin/bbackupd/BackupClientContext.h box/trunk/bin/bbackupd/BackupClientDirectoryRecord.h Log: Separate out daemon control interfaces into BackupDaemonInterface, for use by Boxi without dragging the implementation details into lots of headers. Modified: box/trunk/bin/bbackupd/BackupClientContext.h =================================================================== --- box/trunk/bin/bbackupd/BackupClientContext.h 2008-12-27 00:27:53 UTC (rev 2413) +++ box/trunk/bin/bbackupd/BackupClientContext.h 2008-12-30 14:34:00 UTC (rev 2414) @@ -13,6 +13,7 @@ #include "BoxTime.h" #include "BackupClientDeleteList.h" #include "BackupClientDirectoryRecord.h" +#include "BackupDaemonInterface.h" #include "BackupStoreFile.h" #include "ExcludeList.h" #include "Timer.h" @@ -26,24 +27,7 @@ #include -// -------------------------------------------------------------------------- -// -// Class -// Name: LocationResolver -// Purpose: Interface for classes that can resolve locations to paths, -// like BackupDaemon -// Created: 2003/10/08 -// -// -------------------------------------------------------------------------- -class LocationResolver -{ -public: - virtual ~LocationResolver() { } - virtual bool FindLocationPathName(const std::string &rLocationName, - std::string &rPathOut) const = 0; -}; - // -------------------------------------------------------------------------- // // Class Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.h =================================================================== --- box/trunk/bin/bbackupd/BackupClientDirectoryRecord.h 2008-12-27 00:27:53 UTC (rev 2413) +++ box/trunk/bin/bbackupd/BackupClientDirectoryRecord.h 2008-12-30 14:34:00 UTC (rev 2414) @@ -14,6 +14,7 @@ #include #include "BackupClientFileAttributes.h" +#include "BackupDaemonInterface.h" #include "BackupStoreDirectory.h" #include "BoxTime.h" #include "MD5Digest.h" @@ -27,124 +28,6 @@ // -------------------------------------------------------------------------- // // Class -// Name: SysadminNotifier -// Purpose: Provides a NotifySysadmin() method to send mail to the sysadmin -// Created: 2005/11/15 -// -// -------------------------------------------------------------------------- -class SysadminNotifier -{ - public: - virtual ~SysadminNotifier() { } - - typedef enum - { - StoreFull = 0, - ReadError, - BackupError, - BackupStart, - BackupFinish, - BackupOK, - MAX - // When adding notifications, remember to add - // strings to NotifySysadmin() - } - EventCode; - - virtual void NotifySysadmin(EventCode Event) = 0; -}; - -// -------------------------------------------------------------------------- -// -// Class -// Name: ProgressNotifier -// Purpose: Provides methods for the backup library to inform the user -// interface about its progress with the backup -// Created: 2005/11/20 -// -// -------------------------------------------------------------------------- -class BackupClientDirectoryRecord; - -class ProgressNotifier -{ - public: - virtual ~ProgressNotifier() { } - virtual void NotifyIDMapsSetup(BackupClientContext& rContext) = 0; - virtual void NotifyScanDirectory( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) = 0; - virtual void NotifyDirStatFailed( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - const std::string& rErrorMsg) = 0; - virtual void NotifyFileStatFailed( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - const std::string& rErrorMsg) = 0; - virtual void NotifyDirListFailed( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - const std::string& rErrorMsg) = 0; - virtual void NotifyMountPointSkipped( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) = 0; - virtual void NotifyFileExcluded( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) = 0; - virtual void NotifyDirExcluded( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) = 0; - virtual void NotifyUnsupportedFileType( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) = 0; - virtual void NotifyFileReadFailed( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - const std::string& rErrorMsg) = 0; - virtual void NotifyFileModifiedInFuture( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) = 0; - virtual void NotifyFileSkippedServerFull( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) = 0; - virtual void NotifyFileUploadException( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - const BoxException& rException) = 0; - virtual void NotifyFileUploadServerError( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - int type, int subtype) = 0; - virtual void NotifyFileUploading( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) = 0; - virtual void NotifyFileUploadingPatch( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath) = 0; - virtual void NotifyFileUploaded( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - int64_t FileSize) = 0; - virtual void NotifyFileSynchronised( - const BackupClientDirectoryRecord* pDirRecord, - const std::string& rLocalPath, - int64_t FileSize) = 0; - virtual void NotifyDirectoryDeleted( - int64_t ObjectID, - const std::string& rRemotePath) = 0; - virtual void NotifyFileDeleted( - int64_t ObjectID, - const std::string& rRemotePath) = 0; - virtual void NotifyReadProgress(int64_t readSize, int64_t offset, - int64_t length, box_time_t elapsed, box_time_t finish) = 0; - virtual void NotifyReadProgress(int64_t readSize, int64_t offset, - int64_t length) = 0; - virtual void NotifyReadProgress(int64_t readSize, int64_t offset) = 0; -}; - -// -------------------------------------------------------------------------- -// -// Class // Name: BackupClientDirectoryRecord // Purpose: Implementation of record about directory for backup client // Created: 2003/10/08 Copied: box/trunk/bin/bbackupd/BackupDaemonInterface.h (from rev 2413, box/trunk/bin/bbackupd/BackupClientDirectoryRecord.h) =================================================================== --- box/trunk/bin/bbackupd/BackupDaemonInterface.h (rev 0) +++ box/trunk/bin/bbackupd/BackupDaemonInterface.h 2008-12-30 14:34:00 UTC (rev 2414) @@ -0,0 +1,164 @@ +// -------------------------------------------------------------------------- +// +// File +// Name: BackupDaemonInterface.h +// Purpose: Interfaces for managing a BackupDaemon +// Created: 2008/12/30 +// +// -------------------------------------------------------------------------- + +#ifndef BACKUPDAEMONINTERFACE__H +#define BACKUPDAEMONINTERFACE__H + +#include +// #include + +// #include "BackupClientFileAttributes.h" +// #include "BackupStoreDirectory.h" +#include "BoxTime.h" +// #include "MD5Digest.h" +// #include "ReadLoggingStream.h" +// #include "RunStatusProvider.h" + +class Archive; +class BackupClientContext; +class BackupDaemon; + +// -------------------------------------------------------------------------- +// +// Class +// Name: SysadminNotifier +// Purpose: Provides a NotifySysadmin() method to send mail to the sysadmin +// Created: 2005/11/15 +// +// -------------------------------------------------------------------------- +class SysadminNotifier +{ + public: + virtual ~SysadminNotifier() { } + + typedef enum + { + StoreFull = 0, + ReadError, + BackupError, + BackupStart, + BackupFinish, + BackupOK, + MAX + // When adding notifications, remember to add + // strings to NotifySysadmin() + } + EventCode; + + virtual void NotifySysadmin(EventCode Event) = 0; +}; + +// -------------------------------------------------------------------------- +// +// Class +// Name: ProgressNotifier +// Purpose: Provides methods for the backup library to inform the user +// interface about its progress with the backup +// Created: 2005/11/20 +// +// -------------------------------------------------------------------------- + +class BackupClientContext; +class BackupClientDirectoryRecord; + +class ProgressNotifier +{ + public: + virtual ~ProgressNotifier() { } + virtual void NotifyIDMapsSetup(BackupClientContext& rContext) = 0; + virtual void NotifyScanDirectory( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; + virtual void NotifyDirStatFailed( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + const std::string& rErrorMsg) = 0; + virtual void NotifyFileStatFailed( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + const std::string& rErrorMsg) = 0; + virtual void NotifyDirListFailed( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + const std::string& rErrorMsg) = 0; + virtual void NotifyMountPointSkipped( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; + virtual void NotifyFileExcluded( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; + virtual void NotifyDirExcluded( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; + virtual void NotifyUnsupportedFileType( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; + virtual void NotifyFileReadFailed( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + const std::string& rErrorMsg) = 0; + virtual void NotifyFileModifiedInFuture( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; + virtual void NotifyFileSkippedServerFull( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; + virtual void NotifyFileUploadException( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + const BoxException& rException) = 0; + virtual void NotifyFileUploadServerError( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + int type, int subtype) = 0; + virtual void NotifyFileUploading( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; + virtual void NotifyFileUploadingPatch( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; + virtual void NotifyFileUploaded( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + int64_t FileSize) = 0; + virtual void NotifyFileSynchronised( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + int64_t FileSize) = 0; + virtual void NotifyDirectoryDeleted( + int64_t ObjectID, + const std::string& rRemotePath) = 0; + virtual void NotifyFileDeleted( + int64_t ObjectID, + const std::string& rRemotePath) = 0; + virtual void NotifyReadProgress(int64_t readSize, int64_t offset, + int64_t length, box_time_t elapsed, box_time_t finish) = 0; + virtual void NotifyReadProgress(int64_t readSize, int64_t offset, + int64_t length) = 0; + virtual void NotifyReadProgress(int64_t readSize, int64_t offset) = 0; +}; + +// -------------------------------------------------------------------------- +// +// Class +// Name: LocationResolver +// Purpose: Interface for classes that can resolve locations to paths, +// like BackupDaemon +// Created: 2003/10/08 +// +// -------------------------------------------------------------------------- +class LocationResolver +{ +public: + virtual ~LocationResolver() { } + virtual bool FindLocationPathName(const std::string &rLocationName, + std::string &rPathOut) const = 0; +}; + +#endif // BACKUPDAEMONINTERFACE__H From boxbackup-dev at boxbackup.org Tue Dec 30 14:54:57 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Tue, 30 Dec 2008 14:54:57 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2415 - in box/trunk: bin/bbackupctl bin/bbackupd bin/bbackupquery bin/bbstored infrastructure infrastructure/msvc/2003 infrastructure/msvc/2005 lib/backupclient lib/backupstore lib/common lib/compress lib/raidfile lib/server test/backupdiff test/common Message-ID: <20081230145457.6537F325FCB@www.boxbackup.org> Author: chris Date: 2008-12-30 14:54:55 +0000 (Tue, 30 Dec 2008) New Revision: 2415 Modified: box/trunk/bin/bbackupctl/bbackupctl.cpp box/trunk/bin/bbackupd/BackupDaemon.cpp box/trunk/bin/bbackupquery/bbackupquery.cpp box/trunk/bin/bbstored/BackupStoreContext.cpp box/trunk/infrastructure/buildenv-testmain-template.cpp box/trunk/infrastructure/makebuildenv.pl.in box/trunk/infrastructure/msvc/2003/bbackupctl.vcproj box/trunk/infrastructure/msvc/2003/bbackupd.vcproj box/trunk/infrastructure/msvc/2003/boxquery.vcproj box/trunk/infrastructure/msvc/2003/common.vcproj box/trunk/infrastructure/msvc/2003/win32test.vcproj box/trunk/infrastructure/msvc/2005/bbackupctl.vcproj box/trunk/infrastructure/msvc/2005/bbackupd.vcproj box/trunk/infrastructure/msvc/2005/boxquery.vcproj box/trunk/infrastructure/msvc/2005/common.vcproj box/trunk/infrastructure/msvc/2005/win32test.vcproj box/trunk/lib/backupclient/BackupStoreFile.h box/trunk/lib/backupclient/BackupStoreFileDiff.cpp box/trunk/lib/backupclient/BackupStoreFileEncodeStream.cpp box/trunk/lib/backupstore/BackupStoreCheck.h box/trunk/lib/backupstore/BackupStoreCheckData.cpp box/trunk/lib/backupstore/BackupStoreInfo.cpp box/trunk/lib/backupstore/StoreStructure.h box/trunk/lib/common/Box.h box/trunk/lib/common/DebugAssertFailed.cpp box/trunk/lib/common/DebugMemLeakFinder.cpp box/trunk/lib/common/DebugPrintf.cpp box/trunk/lib/common/FdGetLine.h box/trunk/lib/common/IOStreamGetLine.h box/trunk/lib/common/Timer.cpp box/trunk/lib/common/Utils.cpp box/trunk/lib/compress/CompressStream.cpp box/trunk/lib/raidfile/RaidFileUtil.cpp box/trunk/lib/raidfile/RaidFileWrite.cpp box/trunk/lib/server/Daemon.cpp box/trunk/lib/server/Protocol.cpp box/trunk/lib/server/SSLLib.cpp box/trunk/lib/server/SSLLib.h box/trunk/lib/server/ServerStream.h box/trunk/lib/server/SocketStreamTLS.cpp box/trunk/test/backupdiff/testbackupdiff.cpp box/trunk/test/common/testcommon.cpp Log: Rename NDEBUG flag to BOX_RELEASE_BUILD, as other projects use NDEBUG as well (e.g. wxWidgets) and it causes conflicts which are difficult to resolve. Modified: box/trunk/bin/bbackupctl/bbackupctl.cpp =================================================================== --- box/trunk/bin/bbackupctl/bbackupctl.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/bin/bbackupctl/bbackupctl.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -356,7 +356,7 @@ MAINHELPER_END -#if defined WIN32 && ! defined NDEBUG +#if defined WIN32 && ! defined BOX_RELEASE_BUILD closelog(); #endif Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -1522,12 +1522,12 @@ #endif // HAVE_STRUCT_MNTENT_MNT_DIR // Check sorting and that things are as we expect ASSERT(mountPoints.size() > 0); -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD { std::set::reverse_iterator i(mountPoints.rbegin()); ASSERT(*i == "/"); } -#endif // n NDEBUG +#endif // n BOX_RELEASE_BUILD #endif // n HAVE_STRUCT_STATFS_F_MNTONNAME || n HAVE_STRUCT_STATVFS_F_MNTONNAME #endif // HAVE_MOUNTS Modified: box/trunk/bin/bbackupquery/bbackupquery.cpp =================================================================== --- box/trunk/bin/bbackupquery/bbackupquery.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/bin/bbackupquery/bbackupquery.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -94,7 +94,7 @@ #endif // Really don't want trace statements happening, even in debug mode - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD BoxDebugTraceOn = false; #endif @@ -114,7 +114,7 @@ Logging::SetProgramName("bbackupquery"); - #ifdef NDEBUG + #ifdef BOX_RELEASE_BUILD int masterLevel = Log::NOTICE; // need an int to do math with #else int masterLevel = Log::INFO; // need an int to do math with Modified: box/trunk/bin/bbstored/BackupStoreContext.cpp =================================================================== --- box/trunk/bin/bbstored/BackupStoreContext.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/bin/bbstored/BackupStoreContext.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -33,7 +33,7 @@ // Maximum number of directories to keep in the cache // When the cache is bigger than this, everything gets // deleted. -#ifdef NDEBUG +#ifdef BOX_RELEASE_BUILD #define MAX_CACHE_SIZE 32 #else #define MAX_CACHE_SIZE 2 Modified: box/trunk/infrastructure/buildenv-testmain-template.cpp =================================================================== --- box/trunk/infrastructure/buildenv-testmain-template.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/infrastructure/buildenv-testmain-template.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -43,7 +43,7 @@ int test(int argc, const char *argv[]); -#ifdef NDEBUG +#ifdef BOX_RELEASE_BUILD #define MODE_TEXT "release" #else #define MODE_TEXT "debug" @@ -167,7 +167,7 @@ Logging::SetProgramName(BOX_MODULE); #ifdef HAVE_GETOPT_H - #ifdef NDEBUG + #ifdef BOX_RELEASE_BUILD int logLevel = Log::NOTICE; // need an int to do math with #else int logLevel = Log::INFO; // need an int to do math with Modified: box/trunk/infrastructure/makebuildenv.pl.in =================================================================== --- box/trunk/infrastructure/makebuildenv.pl.in 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/infrastructure/makebuildenv.pl.in 2008-12-30 14:54:55 UTC (rev 2415) @@ -457,7 +457,6 @@ if (-d "$module/testfiles") { print TESTFILE <<__E; -echo Killing any running daemons... kill_process bbackupd kill_process bbstored __E @@ -560,7 +559,7 @@ LDFLAGS = @LDFLAGS@ @LDADD_RDYNAMIC@ .ifdef RELEASE -CXXFLAGS = -DNDEBUG $release_flags \$(DEFAULT_CXXFLAGS) +CXXFLAGS = -DBOX_RELEASE_BUILD $release_flags \$(DEFAULT_CXXFLAGS) OUTBASE = ../../release OUTDIR = ../../release/$mod DEPENDMAKEFLAGS = -D RELEASE Modified: box/trunk/infrastructure/msvc/2003/bbackupctl.vcproj =================================================================== --- box/trunk/infrastructure/msvc/2003/bbackupctl.vcproj 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/infrastructure/msvc/2003/bbackupctl.vcproj 2008-12-30 14:54:55 UTC (rev 2415) @@ -20,7 +20,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\..\db-4.2.52.NC\build_win32";"$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\"" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;NDEBUG " + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOX_RELEASE_BUILD " MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -72,7 +72,7 @@ EnableFiberSafeOptimizations="TRUE" OptimizeForProcessor="1" AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\"" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING" + PreprocessorDefinitions="WIN32;BOX_RELEASE_BUILD;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING" RuntimeLibrary="0" BufferSecurityCheck="FALSE" UsePrecompiledHeader="0" Modified: box/trunk/infrastructure/msvc/2003/bbackupd.vcproj =================================================================== --- box/trunk/infrastructure/msvc/2003/bbackupd.vcproj 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/infrastructure/msvc/2003/bbackupd.vcproj 2008-12-30 14:54:55 UTC (rev 2415) @@ -20,7 +20,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""$(SolutionDir)..\..\..\..\db-4.2.52.NC\build_win32";"$(SolutionDir)..\..\..\..\boost_1_31_0";"$(SolutionDir)..\..\..\..\openssl\include";"$(SolutionDir)..\..\..\..\zlib\include";"$(SolutionDir)..\..\..\lib\backupclient";"$(SolutionDir)..\..\..\lib\server";"$(SolutionDir)..\..\..\lib\crypto";"$(SolutionDir)..\..\..\lib\compress";"$(SolutionDir)..\..\..\lib\win32";"$(SolutionDir)..\..\..\lib\common\"" - PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;NDEBUG " + PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOX_RELEASE_BUILD " MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -73,7 +73,7 @@ EnableFiberSafeOptimizations="TRUE" OptimizeForProcessor="1" AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\";"$(SolutionDir)..\..\..\..\boost_1_31_0"" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOOST_REGEX_NO_LIB" + PreprocessorDefinitions="WIN32;BOX_RELEASE_BUILD;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOOST_REGEX_NO_LIB" RuntimeLibrary="0" BufferSecurityCheck="FALSE" UsePrecompiledHeader="0" Modified: box/trunk/infrastructure/msvc/2003/boxquery.vcproj =================================================================== --- box/trunk/infrastructure/msvc/2003/boxquery.vcproj 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/infrastructure/msvc/2003/boxquery.vcproj 2008-12-30 14:54:55 UTC (rev 2415) @@ -21,7 +21,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\";"$(SolutionDir)..\..\..\..\boost_1_31_0"" - PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;NDEBUG " + PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOX_RELEASE_BUILD " MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -73,7 +73,7 @@ EnableFiberSafeOptimizations="TRUE" OptimizeForProcessor="1" AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\";"$(SolutionDir)..\..\..\..\boost_1_31_0"" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOOST_REGEX_NO_LIB" + PreprocessorDefinitions="WIN32;BOX_RELEASE_BUILD;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOOST_REGEX_NO_LIB" RuntimeLibrary="0" BufferSecurityCheck="FALSE" UsePrecompiledHeader="0" Modified: box/trunk/infrastructure/msvc/2003/common.vcproj =================================================================== --- box/trunk/infrastructure/msvc/2003/common.vcproj 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/infrastructure/msvc/2003/common.vcproj 2008-12-30 14:54:55 UTC (rev 2415) @@ -20,7 +20,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\";"$(SolutionDir)..\..\..\..\boost_1_31_0\"" - PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;_DEBUG;_LIB;PLATFORM_DISABLE_MEM_LEAK_TESTING;NDEBUG " + PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;_DEBUG;_LIB;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOX_RELEASE_BUILD " MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -64,7 +64,7 @@ EnableFiberSafeOptimizations="TRUE" OptimizeForProcessor="1" AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\";"$(SolutionDir)..\..\..\..\boost_1_31_0\"" - PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;NDEBUG;_LIB;PLATFORM_DISABLE_MEM_LEAK_TESTING" + PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;BOX_RELEASE_BUILD;_LIB;PLATFORM_DISABLE_MEM_LEAK_TESTING" RuntimeLibrary="0" BufferSecurityCheck="FALSE" UsePrecompiledHeader="0" Modified: box/trunk/infrastructure/msvc/2003/win32test.vcproj =================================================================== --- box/trunk/infrastructure/msvc/2003/win32test.vcproj 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/infrastructure/msvc/2003/win32test.vcproj 2008-12-30 14:54:55 UTC (rev 2415) @@ -72,7 +72,7 @@ EnableFiberSafeOptimizations="TRUE" OptimizeForProcessor="1" AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\bin\bbackupd";"$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\"" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING" + PreprocessorDefinitions="WIN32;BOX_RELEASE_BUILD;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING" RuntimeLibrary="0" BufferSecurityCheck="FALSE" UsePrecompiledHeader="0" Modified: box/trunk/infrastructure/msvc/2005/bbackupctl.vcproj =================================================================== --- box/trunk/infrastructure/msvc/2005/bbackupctl.vcproj 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/infrastructure/msvc/2005/bbackupctl.vcproj 2008-12-30 14:54:55 UTC (rev 2415) @@ -123,7 +123,7 @@ Name="VCCLCompilerTool" EnableFiberSafeOptimizations="true" AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\inc32";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\"" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;_CRT_SECURE_NO_DEPRECATE;PCRE_STATIC" + PreprocessorDefinitions="WIN32;BOX_RELEASE_BUILD;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;_CRT_SECURE_NO_DEPRECATE;PCRE_STATIC" RuntimeLibrary="0" BufferSecurityCheck="false" UsePrecompiledHeader="0" Modified: box/trunk/infrastructure/msvc/2005/bbackupd.vcproj =================================================================== --- box/trunk/infrastructure/msvc/2005/bbackupd.vcproj 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/infrastructure/msvc/2005/bbackupd.vcproj 2008-12-30 14:54:55 UTC (rev 2415) @@ -124,7 +124,7 @@ Name="VCCLCompilerTool" EnableFiberSafeOptimizations="true" AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(SolutionDir)..\..\..\..\openssl\inc32";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\"" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;_CRT_SECURE_NO_DEPRECATE;PCRE_STATIC" + PreprocessorDefinitions="WIN32;BOX_RELEASE_BUILD;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;_CRT_SECURE_NO_DEPRECATE;PCRE_STATIC" RuntimeLibrary="0" BufferSecurityCheck="false" UsePrecompiledHeader="0" Modified: box/trunk/infrastructure/msvc/2005/boxquery.vcproj =================================================================== --- box/trunk/infrastructure/msvc/2005/boxquery.vcproj 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/infrastructure/msvc/2005/boxquery.vcproj 2008-12-30 14:54:55 UTC (rev 2415) @@ -123,7 +123,7 @@ Name="VCCLCompilerTool" EnableFiberSafeOptimizations="true" AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\"" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;PCRE_STATIC" + PreprocessorDefinitions="WIN32;BOX_RELEASE_BUILD;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;PCRE_STATIC" RuntimeLibrary="0" BufferSecurityCheck="false" UsePrecompiledHeader="0" Modified: box/trunk/infrastructure/msvc/2005/common.vcproj =================================================================== --- box/trunk/infrastructure/msvc/2005/common.vcproj 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/infrastructure/msvc/2005/common.vcproj 2008-12-30 14:54:55 UTC (rev 2415) @@ -111,7 +111,7 @@ Name="VCCLCompilerTool" EnableFiberSafeOptimizations="true" AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\common\";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\..\openssl\inc32";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\..\pcre\pcre-6.7\"" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;PLATFORM_DISABLE_MEM_LEAK_TESTING;_CRT_SECURE_NO_DEPRECATE;PCRE_STATIC" + PreprocessorDefinitions="WIN32;BOX_RELEASE_BUILD;_LIB;PLATFORM_DISABLE_MEM_LEAK_TESTING;_CRT_SECURE_NO_DEPRECATE;PCRE_STATIC" RuntimeLibrary="0" BufferSecurityCheck="false" UsePrecompiledHeader="0" Modified: box/trunk/infrastructure/msvc/2005/win32test.vcproj =================================================================== --- box/trunk/infrastructure/msvc/2005/win32test.vcproj 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/infrastructure/msvc/2005/win32test.vcproj 2008-12-30 14:54:55 UTC (rev 2415) @@ -123,7 +123,7 @@ Name="VCCLCompilerTool" EnableFiberSafeOptimizations="true" AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\bin\bbackupd";"$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\common\";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\..\openssl\inc32";"$(ProjectDir)..\..\..\..\zlib\include"" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;_CRT_SECURE_NO_DEPRECATE;PCRE_STATIC" + PreprocessorDefinitions="WIN32;BOX_RELEASE_BUILD;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;_CRT_SECURE_NO_DEPRECATE;PCRE_STATIC" RuntimeLibrary="0" BufferSecurityCheck="false" UsePrecompiledHeader="0" Modified: box/trunk/lib/backupclient/BackupStoreFile.h =================================================================== --- box/trunk/lib/backupclient/BackupStoreFile.h 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/backupclient/BackupStoreFile.h 2008-12-30 14:54:55 UTC (rev 2415) @@ -215,7 +215,7 @@ static BackupStoreFileStats msStats; // For debug -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD static bool TraceDetailsOfDiffProcess; #endif Modified: box/trunk/lib/backupclient/BackupStoreFileDiff.cpp =================================================================== --- box/trunk/lib/backupclient/BackupStoreFileDiff.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/backupclient/BackupStoreFileDiff.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -40,7 +40,7 @@ // By default, don't trace out details of the diff as we go along -- would fill up logs significantly. // But it's useful for the test. -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD bool BackupStoreFile::TraceDetailsOfDiffProcess = false; #endif @@ -436,7 +436,7 @@ } // trace the size table in debug builds -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD if(BackupStoreFile::TraceDetailsOfDiffProcess) { for(int t = 0; t < BACKUP_FILE_DIFF_MAX_BLOCK_SIZES; ++t) @@ -728,7 +728,7 @@ throw; } -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD if(BackupStoreFile::TraceDetailsOfDiffProcess) { // Trace out the found blocks in debug mode @@ -810,7 +810,7 @@ ASSERT(pFirstInHashList != 0); ASSERT(pIndex != 0); -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD uint16_t DEBUG_Hash = fastSum.GetComponentForHashing(); #endif uint32_t Checksum = fastSum.GetChecksum(); @@ -916,7 +916,7 @@ instruction.mSpaceBefore = SizeOfInputFile; rRecipe.push_back(instruction); - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD if(BackupStoreFile::TraceDetailsOfDiffProcess) { BOX_TRACE("Diff: Default recipe generated, " << @@ -936,7 +936,7 @@ ASSERT(i != rFoundBlocks.end()); // check logic // Counting for debug tracing -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD int64_t debug_NewBytesFound = 0; int64_t debug_OldBlocksUsed = 0; #endif @@ -963,7 +963,7 @@ instruction.mSpaceBefore = i->first - loc; // Move location forward to match loc += instruction.mSpaceBefore; -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD debug_NewBytesFound += instruction.mSpaceBefore; #endif } @@ -989,7 +989,7 @@ instruction.mBlocks += 1; } -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD debug_OldBlocksUsed++; #endif @@ -1005,14 +1005,14 @@ { RESET_INSTRUCTION instruction.mSpaceBefore = SizeOfInputFile - loc; -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD debug_NewBytesFound += instruction.mSpaceBefore; #endif rRecipe.push_back(instruction); } // dump out the recipe -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD BOX_TRACE("Diff: " << debug_NewBytesFound << " new bytes found, " << debug_OldBlocksUsed << " old blocks used"); Modified: box/trunk/lib/backupclient/BackupStoreFileEncodeStream.cpp =================================================================== --- box/trunk/lib/backupclient/BackupStoreFileEncodeStream.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/backupclient/BackupStoreFileEncodeStream.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -236,7 +236,7 @@ { throw std::bad_alloc(); } -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD // In debug builds, make sure that the reallocation code is exercised. mEncodedBuffer.Allocate(mAllocatedBufferSize / 4); #else Modified: box/trunk/lib/backupstore/BackupStoreCheck.h =================================================================== --- box/trunk/lib/backupstore/BackupStoreCheck.h 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/backupstore/BackupStoreCheck.h 2008-12-30 14:54:55 UTC (rev 2415) @@ -48,7 +48,7 @@ // Size of blocks in the list of IDs -#ifdef NDEBUG +#ifdef BOX_RELEASE_BUILD #define BACKUPSTORECHECK_BLOCK_SIZE (64*1024) #else #define BACKUPSTORECHECK_BLOCK_SIZE 8 @@ -150,7 +150,7 @@ return (pBlock->mFlags[Index / Flags__NumItemsPerEntry] >> ((Index % Flags__NumItemsPerEntry) * Flags__NumFlags)) & Flags__MASK; } -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD void DumpObjectInfo(); #define DUMP_OBJECT_INFO DumpObjectInfo(); #else Modified: box/trunk/lib/backupstore/BackupStoreCheckData.cpp =================================================================== --- box/trunk/lib/backupstore/BackupStoreCheckData.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/backupstore/BackupStoreCheckData.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -174,7 +174,7 @@ } -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD // -------------------------------------------------------------------------- // // Function Modified: box/trunk/lib/backupstore/BackupStoreInfo.cpp =================================================================== --- box/trunk/lib/backupstore/BackupStoreInfo.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/backupstore/BackupStoreInfo.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -55,7 +55,7 @@ END_STRUCTURE_PACKING_FOR_WIRE #endif -#ifdef NDEBUG +#ifdef BOX_RELEASE_BUILD #define NUM_DELETED_DIRS_BLOCK 256 #else #define NUM_DELETED_DIRS_BLOCK 2 Modified: box/trunk/lib/backupstore/StoreStructure.h =================================================================== --- box/trunk/lib/backupstore/StoreStructure.h 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/backupstore/StoreStructure.h 2008-12-30 14:54:55 UTC (rev 2415) @@ -12,7 +12,7 @@ #include -#ifdef NDEBUG +#ifdef BOX_RELEASE_BUILD #define STORE_ID_SEGMENT_LENGTH 8 #define STORE_ID_SEGMENT_MASK 0xff #else Modified: box/trunk/lib/common/Box.h =================================================================== --- box/trunk/lib/common/Box.h 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/common/Box.h 2008-12-30 14:54:55 UTC (rev 2415) @@ -37,7 +37,7 @@ #include "CommonException.h" #include "Logging.h" -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD extern bool AssertFailuresToSyslog; #define ASSERT_FAILS_TO_SYSLOG_ON {AssertFailuresToSyslog = true;} Modified: box/trunk/lib/common/DebugAssertFailed.cpp =================================================================== --- box/trunk/lib/common/DebugAssertFailed.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/common/DebugAssertFailed.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -7,7 +7,7 @@ // // -------------------------------------------------------------------------- -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD #include "Box.h" @@ -33,5 +33,5 @@ } -#endif // NDEBUG +#endif // BOX_RELEASE_BUILD Modified: box/trunk/lib/common/DebugMemLeakFinder.cpp =================================================================== --- box/trunk/lib/common/DebugMemLeakFinder.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/common/DebugMemLeakFinder.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -8,7 +8,7 @@ // -------------------------------------------------------------------------- -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD #include "Box.h" @@ -548,4 +548,4 @@ internal_delete(ptr); } -#endif // NDEBUG +#endif // BOX_RELEASE_BUILD Modified: box/trunk/lib/common/DebugPrintf.cpp =================================================================== --- box/trunk/lib/common/DebugPrintf.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/common/DebugPrintf.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -7,7 +7,7 @@ // // -------------------------------------------------------------------------- -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD #include "Box.h" @@ -80,4 +80,4 @@ } -#endif // NDEBUG +#endif // BOX_RELEASE_BUILD Modified: box/trunk/lib/common/FdGetLine.h =================================================================== --- box/trunk/lib/common/FdGetLine.h 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/common/FdGetLine.h 2008-12-30 14:54:55 UTC (rev 2415) @@ -12,7 +12,7 @@ #include -#ifdef NDEBUG +#ifdef BOX_RELEASE_BUILD #define FDGETLINE_BUFFER_SIZE 1024 #elif defined WIN32 // need enough space for at least one unicode character Modified: box/trunk/lib/common/IOStreamGetLine.h =================================================================== --- box/trunk/lib/common/IOStreamGetLine.h 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/common/IOStreamGetLine.h 2008-12-30 14:54:55 UTC (rev 2415) @@ -14,7 +14,7 @@ #include "IOStream.h" -#ifdef NDEBUG +#ifdef BOX_RELEASE_BUILD #define IOSTREAMGETLINE_BUFFER_SIZE 1024 #else #define IOSTREAMGETLINE_BUFFER_SIZE 4 Modified: box/trunk/lib/common/Timer.cpp =================================================================== --- box/trunk/lib/common/Timer.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/common/Timer.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -347,7 +347,7 @@ , mTimerHandle(INVALID_HANDLE_VALUE) #endif { - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD if (timeoutSecs == 0) { BOX_TRACE(TIMER_ID "initialised for " << timeoutSecs << @@ -476,7 +476,7 @@ Timer::~Timer() { - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD BOX_TRACE(TIMER_ID "destroyed"); #endif @@ -503,7 +503,7 @@ , mTimerHandle(INVALID_HANDLE_VALUE) #endif { - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD if (mExpired) { BOX_TRACE(TIMER_ID "initialised from timer " << &rToCopy << ", " @@ -544,7 +544,7 @@ Timer& Timer::operator=(const Timer& rToCopy) { - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD if (rToCopy.mExpired) { BOX_TRACE(TIMER_ID "initialised from timer " << &rToCopy << ", " @@ -595,7 +595,7 @@ void Timer::OnExpire() { - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD BOX_TRACE(TIMER_ID "fired"); #endif Modified: box/trunk/lib/common/Utils.cpp =================================================================== --- box/trunk/lib/common/Utils.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/common/Utils.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -58,7 +58,7 @@ { rOutput.push_back(String.substr(b)); } -/*#ifndef NDEBUG +/*#ifndef BOX_RELEASE_BUILD BOX_TRACE("Splitting string '" << String << " on " << (char)SplitOn); for(unsigned int l = 0; l < rOutput.size(); ++l) { Modified: box/trunk/lib/compress/CompressStream.cpp =================================================================== --- box/trunk/lib/compress/CompressStream.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/compress/CompressStream.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -19,7 +19,7 @@ #include "MemLeakFindOn.h" // How big a buffer to use -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD // debug! #define BUFFER_SIZE 256 #else Modified: box/trunk/lib/raidfile/RaidFileUtil.cpp =================================================================== --- box/trunk/lib/raidfile/RaidFileUtil.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/raidfile/RaidFileUtil.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -58,7 +58,7 @@ if(pRevisionID != 0) { (*pRevisionID) = FileModificationTime(st); -#ifdef NDEBUG +#ifdef BOX_RELEASE_BUILD // The resolution of timestamps may be very // low, e.g. 1 second. So add the size to it // to give a bit more chance of it changing. @@ -107,7 +107,7 @@ if(pRevisionID != 0) { (*pRevisionID) = revisionID; -#ifdef NDEBUG +#ifdef BOX_RELEASE_BUILD // The resolution of timestamps may be very low, e.g. // 1 second. So add the size to it to give a bit more // chance of it changing. Modified: box/trunk/lib/raidfile/RaidFileWrite.cpp =================================================================== --- box/trunk/lib/raidfile/RaidFileWrite.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/raidfile/RaidFileWrite.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -390,7 +390,7 @@ // // DEBUG MODE -- check file system size block size is same as block size for files // // doesn't really apply, as space benefits of using fragment size are worth efficiency, // // and anyway, it'll be buffered eventually so it won't matter. -// #ifndef NDEBUG +// #ifndef BOX_RELEASE_BUILD // { // if(writeFileStat.st_blksize != blockSize) // { Modified: box/trunk/lib/server/Daemon.cpp =================================================================== --- box/trunk/lib/server/Daemon.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/server/Daemon.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -296,7 +296,7 @@ mConfigFileName = DefaultConfigFile; mAppName = argv[0]; - #ifdef NDEBUG + #ifdef BOX_RELEASE_BUILD mLogLevel = Log::NOTICE; // need an int to do math with #else mLogLevel = Log::INFO; // need an int to do math with Modified: box/trunk/lib/server/Protocol.cpp =================================================================== --- box/trunk/lib/server/Protocol.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/server/Protocol.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -26,7 +26,7 @@ #include "MemLeakFindOn.h" -#ifdef NDEBUG +#ifdef BOX_RELEASE_BUILD #define PROTOCOL_ALLOCATE_SEND_BLOCK_CHUNK 1024 #else // #define PROTOCOL_ALLOCATE_SEND_BLOCK_CHUNK 1024 Modified: box/trunk/lib/server/SSLLib.cpp =================================================================== --- box/trunk/lib/server/SSLLib.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/server/SSLLib.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -23,7 +23,7 @@ #include "MemLeakFindOn.h" -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD bool SSLLib__TraceErrors = false; #endif Modified: box/trunk/lib/server/SSLLib.h =================================================================== --- box/trunk/lib/server/SSLLib.h 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/server/SSLLib.h 2008-12-30 14:54:55 UTC (rev 2415) @@ -10,7 +10,7 @@ #ifndef SSLLIB__H #define SSLLIB__H -#ifndef NDEBUG +#ifndef BOX_RELEASE_BUILD extern bool SSLLib__TraceErrors; #define SET_DEBUG_SSLLIB_TRACE_ERRORS {SSLLib__TraceErrors = true;} #else Modified: box/trunk/lib/server/ServerStream.h =================================================================== --- box/trunk/lib/server/ServerStream.h 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/server/ServerStream.h 2008-12-30 14:54:55 UTC (rev 2415) @@ -108,7 +108,7 @@ { // Child task, dump leaks to trace, which we make sure is on #ifdef BOX_MEMORY_LEAK_TESTING - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD TRACE_TO_SYSLOG(true); TRACE_TO_STDOUT(true); #endif Modified: box/trunk/lib/server/SocketStreamTLS.cpp =================================================================== --- box/trunk/lib/server/SocketStreamTLS.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/lib/server/SocketStreamTLS.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -391,7 +391,7 @@ case SSL_ERROR_WANT_WRITE: // wait for the requried data { - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD bool conditionmet = #endif WaitWhenRetryRequired(se, IOStream::TimeOutInfinite); Modified: box/trunk/test/backupdiff/testbackupdiff.cpp =================================================================== --- box/trunk/test/backupdiff/testbackupdiff.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/test/backupdiff/testbackupdiff.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -388,7 +388,7 @@ int test(int argc, const char *argv[]) { // Want to trace out all the details - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD #ifndef WIN32 BackupStoreFile::TraceDetailsOfDiffProcess = true; #endif Modified: box/trunk/test/common/testcommon.cpp =================================================================== --- box/trunk/test/common/testcommon.cpp 2008-12-30 14:34:00 UTC (rev 2414) +++ box/trunk/test/common/testcommon.cpp 2008-12-30 14:54:55 UTC (rev 2415) @@ -298,7 +298,7 @@ // Check that using timer methods without initialisation // throws an assertion failure. Can only do this in debug mode - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD TEST_CHECK_THROWS(Timers::Add(*(Timer*)NULL), CommonException, AssertFailed); TEST_CHECK_THROWS(Timers::Remove(*(Timer*)NULL), @@ -306,7 +306,7 @@ #endif // TEST_CHECK_THROWS(Timers::Signal(), CommonException, AssertFailed); - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD TEST_CHECK_THROWS(Timers::Cleanup(), CommonException, AssertFailed); #endif @@ -315,7 +315,7 @@ Timers::Init(); // Check that double initialisation throws an exception - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD TEST_CHECK_THROWS(Timers::Init(), CommonException, AssertFailed); #endif @@ -324,7 +324,7 @@ Timers::Cleanup(); // Check that double cleanup throws an exception - #ifndef NDEBUG + #ifndef BOX_RELEASE_BUILD TEST_CHECK_THROWS(Timers::Cleanup(), CommonException, AssertFailed); #endif From boxbackup-dev at boxbackup.org Tue Dec 30 18:30:13 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Tue, 30 Dec 2008 18:30:13 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2416 - box/trunk/lib/win32 Message-ID: <20081230183013.2134E325FCB@www.boxbackup.org> Author: chris Date: 2008-12-30 18:30:12 +0000 (Tue, 30 Dec 2008) New Revision: 2416 Modified: box/trunk/lib/win32/emu.cpp box/trunk/lib/win32/emu.h Log: Change ConvertTo/FromUtf8 to take a std::string instead of a const char *, for convenience and C++ style. Modified: box/trunk/lib/win32/emu.cpp =================================================================== --- box/trunk/lib/win32/emu.cpp 2008-12-30 14:54:55 UTC (rev 2415) +++ box/trunk/lib/win32/emu.cpp 2008-12-30 18:30:12 UTC (rev 2416) @@ -468,24 +468,26 @@ return true; } -bool ConvertToUtf8(const char* pString, std::string& rDest, int sourceCodePage) +bool ConvertToUtf8(const std::string& rSource, std::string& rDest, + int sourceCodePage) { - return ConvertEncoding(pString, sourceCodePage, rDest, CP_UTF8); + return ConvertEncoding(rSource, sourceCodePage, rDest, CP_UTF8); } -bool ConvertFromUtf8(const char* pString, std::string& rDest, int destCodePage) +bool ConvertFromUtf8(const std::string& rSource, std::string& rDest, + int destCodePage) { - return ConvertEncoding(pString, CP_UTF8, rDest, destCodePage); + return ConvertEncoding(rSource, CP_UTF8, rDest, destCodePage); } -bool ConvertConsoleToUtf8(const char* pString, std::string& rDest) +bool ConvertConsoleToUtf8(const std::string& rSource, std::string& rDest) { - return ConvertEncoding(pString, GetConsoleCP(), rDest, CP_UTF8); + return ConvertToUtf8(rSource, rDest, GetConsoleCP()); } -bool ConvertUtf8ToConsole(const char* pString, std::string& rDest) +bool ConvertUtf8ToConsole(const std::string& rSource, std::string& rDest) { - return ConvertEncoding(pString, CP_UTF8, rDest, GetConsoleOutputCP()); + return ConvertFromUtf8(rSource, rDest, GetConsoleOutputCP()); } // -------------------------------------------------------------------------- Modified: box/trunk/lib/win32/emu.h =================================================================== --- box/trunk/lib/win32/emu.h 2008-12-30 14:54:55 UTC (rev 2415) +++ box/trunk/lib/win32/emu.h 2008-12-30 18:30:12 UTC (rev 2416) @@ -384,8 +384,8 @@ int sourceCodePage); bool ConvertFromUtf8 (const std::string& rSource, std::string& rDest, int destCodePage); -bool ConvertUtf8ToConsole(const char* pString, std::string& rDest); -bool ConvertConsoleToUtf8(const char* pString, std::string& rDest); +bool ConvertUtf8ToConsole(const std::string& rSource, std::string& rDest); +bool ConvertConsoleToUtf8(const std::string& rSource, std::string& rDest); // Utility function which returns a default config file name, // based on the path of the current executable. From boxbackup-dev at boxbackup.org Tue Dec 30 18:30:41 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Tue, 30 Dec 2008 18:30:41 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2417 - box/trunk/lib/common Message-ID: <20081230183041.AE066325FCB@www.boxbackup.org> Author: chris Date: 2008-12-30 18:30:41 +0000 (Tue, 30 Dec 2008) New Revision: 2417 Modified: box/trunk/lib/common/Logging.h Log: Add a function to return a native error message as a string. Modified: box/trunk/lib/common/Logging.h =================================================================== --- box/trunk/lib/common/Logging.h 2008-12-30 18:30:12 UTC (rev 2416) +++ box/trunk/lib/common/Logging.h 2008-12-30 18:30:41 UTC (rev 2417) @@ -10,6 +10,7 @@ #ifndef LOGGING__H #define LOGGING__H +#include #include #include #include @@ -58,7 +59,18 @@ #define BOX_LOG_SYS_FATAL(stuff) \ BOX_FATAL(stuff << ": " << std::strerror(errno) << " (" << errno << ")") +inline std::string GetNativeErrorMessage() +{ #ifdef WIN32 + return GetErrorMessage(GetLastError()); +#else + std::ostringstream _box_log_line; + _box_log_line << std::strerror(errno) << " (" << errno << ")"; + return _box_log_line.str(); +#endif +} + +#ifdef WIN32 #define BOX_LOG_WIN_ERROR(stuff) \ BOX_ERROR(stuff << ": " << GetErrorMessage(GetLastError())) #define BOX_LOG_WIN_WARNING(stuff) \ From boxbackup-dev at boxbackup.org Tue Dec 30 18:31:53 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Tue, 30 Dec 2008 18:31:53 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2418 - box/trunk/bin/bbackupquery Message-ID: <20081230183153.0E8C2325FCB@www.boxbackup.org> Author: chris Date: 2008-12-30 18:31:52 +0000 (Tue, 30 Dec 2008) New Revision: 2418 Added: box/trunk/bin/bbackupquery/BoxBackupCompareParams.h Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp box/trunk/bin/bbackupquery/BackupQueries.h Log: Separate out compare parameters and notification from BackupQueries::CompareParams to allow Boxi to reuse this code. Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/trunk/bin/bbackupquery/BackupQueries.cpp 2008-12-30 18:30:41 UTC (rev 2417) +++ box/trunk/bin/bbackupquery/BackupQueries.cpp 2008-12-30 18:31:52 UTC (rev 2418) @@ -1190,7 +1190,6 @@ } } - // -------------------------------------------------------------------------- // // Function @@ -1199,62 +1198,21 @@ // Created: 29/1/04 // // -------------------------------------------------------------------------- -BackupQueries::CompareParams::CompareParams() - : mQuickCompare(false), - mIgnoreExcludes(false), - mIgnoreAttributes(false), - mDifferences(0), - mDifferencesExplainedByModTime(0), - mUncheckedFiles(0), - mExcludedDirs(0), - mExcludedFiles(0), - mpExcludeFiles(0), - mpExcludeDirs(0), - mLatestFileUploadTime(0) -{ -} +BackupQueries::CompareParams::CompareParams(bool QuickCompare, + bool IgnoreExcludes, bool IgnoreAttributes, + box_time_t LatestFileUploadTime) +: BoxBackupCompareParams(QuickCompare, IgnoreExcludes, IgnoreAttributes, + LatestFileUploadTime), + mDifferences(0), + mDifferencesExplainedByModTime(0), + mUncheckedFiles(0), + mExcludedDirs(0), + mExcludedFiles(0) +{ } - // -------------------------------------------------------------------------- // // Function -// Name: BackupQueries::CompareParams::~CompareParams() -// Purpose: Destructor -// Created: 29/1/04 -// -// -------------------------------------------------------------------------- -BackupQueries::CompareParams::~CompareParams() -{ - DeleteExcludeLists(); -} - - -// -------------------------------------------------------------------------- -// -// Function -// Name: BackupQueries::CompareParams::DeleteExcludeLists() -// Purpose: Delete the include lists contained -// Created: 29/1/04 -// -// -------------------------------------------------------------------------- -void BackupQueries::CompareParams::DeleteExcludeLists() -{ - if(mpExcludeFiles != 0) - { - delete mpExcludeFiles; - mpExcludeFiles = 0; - } - if(mpExcludeDirs != 0) - { - delete mpExcludeDirs; - mpExcludeDirs = 0; - } -} - - -// -------------------------------------------------------------------------- -// -// Function // Name: BackupQueries::CommandCompare(const std::vector &, const bool *) // Purpose: Command to compare data on the store with local data // Created: 2003/10/12 @@ -1262,12 +1220,7 @@ // -------------------------------------------------------------------------- void BackupQueries::CommandCompare(const std::vector &args, const bool *opts) { - // Parameters, including count of differences - BackupQueries::CompareParams params; - params.mQuickCompare = opts['q']; - params.mQuietCompare = opts['Q']; - params.mIgnoreExcludes = opts['E']; - params.mIgnoreAttributes = opts['A']; + box_time_t LatestFileUploadTime = GetCurrentBoxTime(); // Try and work out the time before which all files should be on the server { @@ -1278,8 +1231,8 @@ if(::stat(syncTimeFilename.c_str(), &st) == 0) { // Files modified after this time shouldn't be on the server, so report errors slightly differently - params.mLatestFileUploadTime = FileModificationTime(st) - - SecondsToBoxTime(mrConfiguration.GetKeyValueInt("MinimumFileAge")); + LatestFileUploadTime = FileModificationTime(st) - + SecondsToBoxTime(mrConfiguration.GetKeyValueInt("MinimumFileAge")); } else { @@ -1288,8 +1241,16 @@ } } + // Parameters, including count of differences + BackupQueries::CompareParams params(opts['q'], // quick compare? + opts['E'], // ignore excludes + opts['A'], // ignore attributes + LatestFileUploadTime); + + params.mQuietCompare = opts['Q']; + // Quick compare? - if(params.mQuickCompare) + if(params.QuickCompare()) { BOX_WARNING("Quick compare used -- file attributes are not " "checked."); @@ -1320,7 +1281,7 @@ // Compare directory to directory // Can't be bothered to do all the hard work to work out which location it's on, and hence which exclude list - if(!params.mIgnoreExcludes) + if(!params.IgnoreExcludes()) { BOX_ERROR("Cannot use excludes on directory to directory comparison -- use -E flag to specify ignored excludes."); return; @@ -1377,7 +1338,8 @@ // Created: 2003/10/13 // // -------------------------------------------------------------------------- -void BackupQueries::CompareLocation(const std::string &rLocation, BackupQueries::CompareParams &rParams) +void BackupQueries::CompareLocation(const std::string &rLocation, + BoxBackupCompareParams &rParams) { // Find the location's sub configuration const Configuration &locations(mrConfiguration.GetSubConfiguration("BackupLocations")); @@ -1401,45 +1363,36 @@ } #endif - try + // Generate the exclude lists + if(!rParams.IgnoreExcludes()) { - // Generate the exclude lists - if(!rParams.mIgnoreExcludes) - { - rParams.mpExcludeFiles = BackupClientMakeExcludeList_Files(loc); - rParams.mpExcludeDirs = BackupClientMakeExcludeList_Dirs(loc); - } - - // Then get it compared - Compare(std::string("/") + rLocation, - loc.GetKeyValue("Path"), rParams); + rParams.LoadExcludeLists(loc); } - catch(...) - { - // Clean up - rParams.DeleteExcludeLists(); - throw; - } - - // Delete exclude lists - rParams.DeleteExcludeLists(); + + // Then get it compared + Compare(std::string("/") + rLocation, loc.GetKeyValue("Path"), rParams); } // -------------------------------------------------------------------------- // // Function -// Name: BackupQueries::Compare(const std::string &, const std::string &, BackupQueries::CompareParams &) +// Name: BackupQueries::Compare(const std::string &, +// const std::string &, BackupQueries::CompareParams &) // Purpose: Compare a store directory against a local directory // Created: 2003/10/13 // // -------------------------------------------------------------------------- -void BackupQueries::Compare(const std::string &rStoreDir, const std::string &rLocalDir, BackupQueries::CompareParams &rParams) +void BackupQueries::Compare(const std::string &rStoreDir, + const std::string &rLocalDir, BoxBackupCompareParams &rParams) { #ifdef WIN32 + std::string localDirEncoded; std::string storeDirEncoded; + if(!ConvertConsoleToUtf8(rLocalDir.c_str(), localDirEncoded)) return; if(!ConvertConsoleToUtf8(rStoreDir.c_str(), storeDirEncoded)) return; #else + const std::string& localDirEncoded(rLocalDir); const std::string& storeDirEncoded(rStoreDir); #endif @@ -1449,19 +1402,22 @@ // Found? if(dirID == 0) { - BOX_WARNING("Local directory '" << rLocalDir << "' exists, " - "but server directory '" << rStoreDir << "' does not " - "exist."); - rParams.mDifferences ++; + bool modifiedAfterLastSync = false; + + struct stat st; + if(::stat(rLocalDir.c_str(), &st) == 0) + { + if(FileAttrModificationTime(st) > + rParams.LatestFileUploadTime()) + { + modifiedAfterLastSync = true; + } + } + + rParams.NotifyRemoteFileMissing(localDirEncoded, + storeDirEncoded, modifiedAfterLastSync); return; } - -#ifdef WIN32 - std::string localDirEncoded; - if(!ConvertConsoleToUtf8(rLocalDir.c_str(), localDirEncoded)) return; -#else - std::string localDirEncoded(rLocalDir); -#endif // Go! Compare(dirID, storeDirEncoded, localDirEncoded, rParams); @@ -1477,55 +1433,34 @@ // Created: 2003/10/13 // // -------------------------------------------------------------------------- -void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, const std::string &rLocalDir, BackupQueries::CompareParams &rParams) +void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, + const std::string &rLocalDir, BoxBackupCompareParams &rParams) { -#ifdef WIN32 - // By this point, rStoreDir and rLocalDir should be in UTF-8 encoding - - std::string localDirDisplay; - std::string storeDirDisplay; - - if(!ConvertUtf8ToConsole(rLocalDir.c_str(), localDirDisplay)) return; - if(!ConvertUtf8ToConsole(rStoreDir.c_str(), storeDirDisplay)) return; -#else - const std::string& localDirDisplay(rLocalDir); - const std::string& storeDirDisplay(rStoreDir); -#endif - // Get info on the local directory struct stat st; if(::lstat(rLocalDir.c_str(), &st) != 0) { // What kind of error? - if(errno == ENOTDIR) + if(errno == ENOTDIR || errno == ENOENT) { - BOX_WARNING("Local object '" << localDirDisplay << "' " - "is a file, server object '" << - storeDirDisplay << "' is a directory."); - rParams.mDifferences ++; + rParams.NotifyLocalDirMissing(rLocalDir, rStoreDir); } - else if(errno == ENOENT) - { - BOX_WARNING("Local directory '" << localDirDisplay << - "' does not exist (compared to server " - "directory '" << storeDirDisplay << "')."); - rParams.mDifferences ++; - } else { - BOX_LOG_SYS_WARNING("Failed to access local directory " - "'" << localDirDisplay << "'"); - rParams.mUncheckedFiles ++; + rParams.NotifyLocalDirAccessFailed(rLocalDir, rStoreDir); } return; } // Get the directory listing from the store mrConnection.QueryListDirectory( - DirID, - BackupProtocolClientListDirectory::Flags_INCLUDE_EVERYTHING, // get everything - BackupProtocolClientListDirectory::Flags_OldVersion | BackupProtocolClientListDirectory::Flags_Deleted, // except for old versions and deleted files - true /* want attributes */); + DirID, + BackupProtocolClientListDirectory::Flags_INCLUDE_EVERYTHING, + // get everything + BackupProtocolClientListDirectory::Flags_OldVersion | + BackupProtocolClientListDirectory::Flags_Deleted, + // except for old versions and deleted files + true /* want attributes */); // Retrieve the directory from the stream following BackupStoreDirectory dir; @@ -1535,8 +1470,7 @@ // Test out the attributes if(!dir.HasAttributes()) { - BOX_WARNING("Store directory '" << storeDirDisplay << "' " - "doesn't have attributes."); + rParams.NotifyStoreDirMissingAttributes(rLocalDir, rStoreDir); } else { @@ -1551,10 +1485,20 @@ if(!(attr.Compare(localAttr, true, true /* ignore modification times */))) { - BOX_WARNING("Local directory '" << localDirDisplay << - "' has different attributes to store " - "directory '" << storeDirDisplay << "'."); - rParams.mDifferences ++; + bool modifiedAfterLastSync = false; + + struct stat st; + if(::stat(rLocalDir.c_str(), &st) == 0) + { + if(FileAttrModificationTime(st) > + rParams.LatestFileUploadTime()) + { + modifiedAfterLastSync = true; + } + } + + rParams.NotifyDifferentAttributes(rLocalDir, rStoreDir, + modifiedAfterLastSync, false); } } @@ -1562,11 +1506,10 @@ DIR *dirhandle = ::opendir(rLocalDir.c_str()); if(dirhandle == 0) { - BOX_LOG_SYS_WARNING("Failed to open local directory '" << - localDirDisplay << "'"); - rParams.mUncheckedFiles ++; + rParams.NotifyLocalDirAccessFailed(rLocalDir, rStoreDir); return; } + try { // Read the files and directories into sets @@ -1632,7 +1575,7 @@ if(::closedir(dirhandle) != 0) { BOX_LOG_SYS_ERROR("Failed to close local directory " - "'" << localDirDisplay << "'"); + "'" << rLocalDir << "'"); } dirhandle = 0; @@ -1670,33 +1613,17 @@ for(std::set >::const_iterator i = storeFiles.begin(); i != storeFiles.end(); ++i) { const std::string& fileName(i->first); -#ifdef WIN32 - // File name is also in UTF-8 encoding, - // need to convert to console - std::string fileNameDisplay; - if(!ConvertUtf8ToConsole(i->first.c_str(), - fileNameDisplay)) return; -#else - const std::string& fileNameDisplay(i->first); -#endif - std::string localPath(MakeFullPath - (rLocalDir, fileName)); - std::string localPathDisplay(MakeFullPath - (localDirDisplay, fileNameDisplay)); - std::string storePathDisplay - (storeDirDisplay + "/" + fileNameDisplay); + std::string localPath(MakeFullPath(rLocalDir, fileName)); + std::string storePath(rStoreDir + "/" + fileName); // Does the file exist locally? string_set_iter_t local(localFiles.find(fileName)); if(local == localFiles.end()) { // Not found -- report - BOX_WARNING("Local file '" << - localPathDisplay << "' does not exist, " - "but store file '" << - storePathDisplay << "' does."); - rParams.mDifferences ++; + rParams.NotifyLocalFileMissing(localPath, + storePath); } else { @@ -1707,8 +1634,10 @@ // File modified after last sync flag bool modifiedAfterLastSync = false; + + bool hasDifferentAttribsOrContents = false; - if(rParams.mQuickCompare) + if(rParams.QuickCompare()) { // Compare file -- fetch it mrConnection.QueryGetBlockIndexByID(i->second->GetObjectID()); @@ -1753,7 +1682,7 @@ BackupClientFileAttributes localAttr; box_time_t fileModTime = 0; localAttr.ReadAttributes(localPath.c_str(), false /* don't zero mod times */, &fileModTime); - modifiedAfterLastSync = (fileModTime > rParams.mLatestFileUploadTime); + modifiedAfterLastSync = (fileModTime > rParams.LatestFileUploadTime()); bool ignoreAttrModTime = true; #ifdef WIN32 @@ -1762,7 +1691,7 @@ ignoreAttrModTime = false; #endif - if(!rParams.mIgnoreAttributes && + if(!rParams.IgnoreAttributes() && #ifdef PLATFORM_DISABLE_SYMLINK_ATTRIB_COMPARE !fileOnServerStream->IsSymLink() && #endif @@ -1770,22 +1699,12 @@ ignoreAttrModTime, fileOnServerStream->IsSymLink() /* ignore modification time if it's a symlink */)) { - BOX_WARNING("Local file '" << - localPathDisplay << - "' has different attributes " - "to store file '" << - storePathDisplay << - "'."); - rParams.mDifferences ++; - if(modifiedAfterLastSync) - { - rParams.mDifferencesExplainedByModTime ++; - BOX_INFO("(the file above was modified after the last sync time -- might be reason for difference)"); - } - else if(i->second->HasAttributes()) - { - BOX_INFO("(the file above has had new attributes applied)\n"); - } + rParams.NotifyDifferentAttributes( + localPath, + storePath, + modifiedAfterLastSync, + i->second->HasAttributes()); + hasDifferentAttribsOrContents = true; } // Compare contents, if it's a regular file not a link @@ -1831,48 +1750,32 @@ // Report if not equal. if(!equal) { - BOX_WARNING("Local file '" << - localPathDisplay << "' " - "has different contents " - "to store file '" << - storePathDisplay << - "'."); - rParams.mDifferences ++; - if(modifiedAfterLastSync) - { - rParams.mDifferencesExplainedByModTime ++; - BOX_INFO("(the file above was modified after the last sync time -- might be reason for difference)"); - } - else if(i->second->HasAttributes()) - { - BOX_INFO("(the file above has had new attributes applied)\n"); - } + rParams.NotifyDifferentContents( + localPath, storePath, + modifiedAfterLastSync); + hasDifferentAttribsOrContents = true; } + + if (!hasDifferentAttribsOrContents) + { + rParams.NotifyFileCompareOK( + localPath, storePath); + } } catch(BoxException &e) { - BOX_ERROR("Failed to fetch and compare " - "'" << - storePathDisplay.c_str() << - "': error " << e.what() << - " (" << e.GetType() << - "/" << e.GetSubType() << ")"); - rParams.mUncheckedFiles ++; + rParams.NotifyDownloadFailed(localPath, + storePath, e); } catch(std::exception &e) { - BOX_ERROR("Failed to fetch and compare " - "'" << - storePathDisplay.c_str() << - "': " << e.what()); + rParams.NotifyDownloadFailed(localPath, + storePath, e); } catch(...) { - BOX_ERROR("Failed to fetch and compare " - "'" << - storePathDisplay.c_str() << - "': unknown error"); - rParams.mUncheckedFiles ++; + rParams.NotifyDownloadFailed(localPath, + storePath); } // Remove from set so that we know it's been compared @@ -1880,53 +1783,34 @@ } } - // Report any files which exist on the locally, but not on the store + // Report any files which exist locally, but not on the store for(string_set_iter_t i = localFiles.begin(); i != localFiles.end(); ++i) { -#ifdef WIN32 - // File name is also in UTF-8 encoding, - // need to convert to console - std::string fileNameDisplay; - if(!ConvertUtf8ToConsole(i->c_str(), fileNameDisplay)) - return; -#else - const std::string& fileNameDisplay(*i); -#endif + std::string localPath(MakeFullPath(rLocalDir, *i)); + std::string storePath(rStoreDir + "/" + *i); - std::string localPath(MakeFullPath - (rLocalDir, *i)); - std::string localPathDisplay(MakeFullPath - (localDirDisplay, fileNameDisplay)); - std::string storePathDisplay - (storeDirDisplay + "/" + fileNameDisplay); - // Should this be ignored (ie is excluded)? - if(rParams.mpExcludeFiles == 0 || - !(rParams.mpExcludeFiles->IsExcluded(localPath))) + if(!rParams.IsExcludedFile(localPath)) { - BOX_WARNING("Local file '" << - localPathDisplay << - "' exists, but store file '" << - storePathDisplay << - "' does not."); - rParams.mDifferences ++; + bool modifiedAfterLastSync = false; - // Check the file modification time + struct stat st; + if(::stat(localPath.c_str(), &st) == 0) { - struct stat st; - if(::stat(localPath.c_str(), &st) == 0) + if(FileModificationTime(st) > + rParams.LatestFileUploadTime()) { - if(FileModificationTime(st) > rParams.mLatestFileUploadTime) - { - rParams.mDifferencesExplainedByModTime ++; - BOX_INFO("(the file above was modified after the last sync time -- might be reason for difference)"); - } + modifiedAfterLastSync = true; } } + + rParams.NotifyRemoteFileMissing(localPath, + storePath, modifiedAfterLastSync); } else { - rParams.mExcludedFiles ++; + rParams.NotifyExcludedFile(localPath, + storePath); } } @@ -1937,116 +1821,69 @@ // Now do the directories, recursively to check subdirectories for(std::set >::const_iterator i = storeDirs.begin(); i != storeDirs.end(); ++i) { -#ifdef WIN32 - // Directory name is also in UTF-8 encoding, - // need to convert to console - std::string subdirNameDisplay; - if(!ConvertUtf8ToConsole(i->first.c_str(), - subdirNameDisplay)) - return; -#else - const std::string& subdirNameDisplay(i->first); -#endif + std::string localPath(MakeFullPath(rLocalDir, i->first)); + std::string storePath(rLocalDir + "/" + i->first); - std::string localPath(MakeFullPath - (rLocalDir, i->first)); - std::string localPathDisplay(MakeFullPath - (localDirDisplay, subdirNameDisplay)); - std::string storePathDisplay - (storeDirDisplay + "/" + subdirNameDisplay); - // Does the directory exist locally? string_set_iter_t local(localDirs.find(i->first)); if(local == localDirs.end() && - rParams.mpExcludeDirs != NULL && - rParams.mpExcludeDirs->IsExcluded(localPath)) + rParams.IsExcludedDir(localPath)) { - // Not found -- report - BOX_WARNING("Local directory '" << - localPathDisplay << "' is excluded, " - "but store directory '" << - storePathDisplay << "' still exists."); - rParams.mDifferences ++; + rParams.NotifyExcludedFileNotDeleted(localPath, + storePath); } else if(local == localDirs.end()) { // Not found -- report - BOX_WARNING("Local directory '" << - localPathDisplay << "' does not exist, " - "but store directory '" << - storePathDisplay << "' does."); - rParams.mDifferences ++; + rParams.NotifyRemoteFileMissing(localPath, + storePath, false); } - else if(rParams.mpExcludeDirs != NULL && - rParams.mpExcludeDirs->IsExcluded(localPath)) + else if(rParams.IsExcludedDir(localPath)) { // don't recurse into excluded directories } else { // Compare directory - Compare(i->second->GetObjectID(), rStoreDir + "/" + i->first, localPath, rParams); + Compare(i->second->GetObjectID(), + rStoreDir + "/" + i->first, + localPath, rParams); // Remove from set so that we know it's been compared localDirs.erase(local); } } - // Report any files which exist locally, but not on the store + // Report any directories which exist locally, but not on the store for(std::set::const_iterator i = localDirs.begin(); i != localDirs.end(); ++i) { - #ifdef WIN32 - // File name is also in UTF-8 encoding, - // need to convert to console - std::string fileNameDisplay; - if(!ConvertUtf8ToConsole(i->c_str(), fileNameDisplay)) - return; - #else - const std::string& fileNameDisplay(*i); - #endif + std::string localPath(MakeFullPath(rLocalDir, *i)); + std::string storePath(rStoreDir + "/" + *i); - std::string localPath(MakeFullPath - (rLocalDir, *i)); - std::string localPathDisplay(MakeFullPath - (localDirDisplay, fileNameDisplay)); - - std::string storePath - (rStoreDir + "/" + *i); - std::string storePathDisplay - (storeDirDisplay + "/" + fileNameDisplay); - // Should this be ignored (ie is excluded)? - if(rParams.mpExcludeDirs == 0 || - !(rParams.mpExcludeDirs->IsExcluded(localPath))) + if(!rParams.IsExcludedDir(localPath)) { - BOX_WARNING("Local directory '" << - localPathDisplay << "' exists, but " - "store directory '" << - storePathDisplay << "' does not."); - rParams.mDifferences ++; - + bool modifiedAfterLastSync = false; + // Check the dir modification time struct stat st; if(::stat(localPath.c_str(), &st) == 0 && FileModificationTime(st) > - rParams.mLatestFileUploadTime) + rParams.LatestFileUploadTime()) { - rParams.mDifferencesExplainedByModTime ++; - BOX_INFO("Local directory '" << - localPathDisplay << "' was " - "modified since the last sync, " - "might be reason for " - "difference"); + modifiedAfterLastSync = true; } + + rParams.NotifyRemoteFileMissing(localPath, + storePath, modifiedAfterLastSync); } else { - rParams.mExcludedDirs ++; + rParams.NotifyExcludedDir(localPath, storePath); } } - } catch(...) { @@ -2054,6 +1891,7 @@ { ::closedir(dirhandle); } + throw; } } Modified: box/trunk/bin/bbackupquery/BackupQueries.h =================================================================== --- box/trunk/bin/bbackupquery/BackupQueries.h 2008-12-30 18:30:41 UTC (rev 2417) +++ box/trunk/bin/bbackupquery/BackupQueries.h 2008-12-30 18:31:52 UTC (rev 2418) @@ -14,6 +14,7 @@ #include #include "BoxTime.h" +#include "BoxBackupCompareParams.h" class BackupProtocolClient; class Configuration; @@ -68,31 +69,207 @@ bool FirstLevel); public: - class CompareParams + class CompareParams : public BoxBackupCompareParams { public: - CompareParams(); - ~CompareParams(); - void DeleteExcludeLists(); - bool mQuickCompare; + CompareParams(bool QuickCompare, bool IgnoreExcludes, + bool IgnoreAttributes, box_time_t LatestFileUploadTime); + bool mQuietCompare; - bool mIgnoreExcludes; - bool mIgnoreAttributes; int mDifferences; int mDifferencesExplainedByModTime; int mUncheckedFiles; int mExcludedDirs; int mExcludedFiles; - const ExcludeList *mpExcludeFiles; - const ExcludeList *mpExcludeDirs; - box_time_t mLatestFileUploadTime; + + std::string ConvertForConsole(const std::string& rUtf8String) + { + #ifdef WIN32 + std::string output; + + if(!ConvertUtf8ToConsole(rUtf8String.c_str(), output)) + { + BOX_WARNING("Character set conversion failed " + "on string: " << rUtf8String); + return rUtf8String; + } + + return output; + #else + return rUtf8String; + #endif + } + + virtual void NotifyLocalDirMissing(const std::string& rLocalPath, + const std::string& rRemotePath) + { + BOX_WARNING("Local directory '" << + ConvertForConsole(rLocalPath) << "' " + "does not exist, but remote directory does."); + mDifferences ++; + } + + virtual void NotifyLocalDirAccessFailed( + const std::string& rLocalPath, + const std::string& rRemotePath) + { + BOX_LOG_SYS_WARNING("Failed to access local directory " + "'" << ConvertForConsole(rLocalPath) << "'"); + mUncheckedFiles ++; + } + + virtual void NotifyStoreDirMissingAttributes( + const std::string& rLocalPath, + const std::string& rRemotePath) + { + BOX_WARNING("Store directory '" << + ConvertForConsole(rRemotePath) << "' " + "doesn't have attributes."); + } + + virtual void NotifyDifferentAttributes( + const std::string& rLocalPath, + const std::string& rRemotePath, + bool modifiedAfterLastSync, + bool newAttributesApplied) + { + BOX_WARNING("Local file '" << + ConvertForConsole(rLocalPath) << + "' has different attributes to store file '" << + ConvertForConsole(rRemotePath) << "'."); + mDifferences ++; + + if(modifiedAfterLastSync) + { + mDifferencesExplainedByModTime ++; + BOX_INFO("(the file above was modified after " + "the last sync time -- might be " + "reason for difference)"); + } + else if(newAttributesApplied) + { + BOX_INFO("(the file above has had new " + "attributes applied)\n"); + } + } + + virtual void NotifyRemoteFileMissing( + const std::string& rLocalPath, + const std::string& rRemotePath, + bool modifiedAfterLastSync) + { + BOX_WARNING("Local file '" << + ConvertForConsole(rLocalPath) << "' " + "exists, but remote file '" << + ConvertForConsole(rRemotePath) << "' " + "does not."); + mDifferences ++; + + if(modifiedAfterLastSync) + { + mDifferencesExplainedByModTime ++; + BOX_INFO("(the file above was modified after " + "the last sync time -- might be " + "reason for difference)"); + } + } + + virtual void NotifyLocalFileMissing( + const std::string& rLocalPath, + const std::string& rRemotePath) + { + BOX_WARNING("Remote file '" << + ConvertForConsole(rRemotePath) << "' " + "exists, but local file '" << + ConvertForConsole(rLocalPath) << "' does not."); + mDifferences ++; + } + + virtual void NotifyExcludedFileNotDeleted( + const std::string& rLocalPath, + const std::string& rRemotePath) + { + BOX_WARNING("Local file '" << + ConvertForConsole(rLocalPath) << "' " + "is excluded, but remote file '" << + ConvertForConsole(rRemotePath) << "' " + "still exists."); + mDifferences ++; + } + + virtual void NotifyDifferentContents( + const std::string& rLocalPath, + const std::string& rRemotePath, + bool modifiedAfterLastSync) + { + BOX_WARNING("Local file '" << + ConvertForConsole(rLocalPath) << + "' has different contents to store file '" << + ConvertForConsole(rRemotePath) << "'."); + mDifferences ++; + + if(modifiedAfterLastSync) + { + mDifferencesExplainedByModTime ++; + BOX_INFO("(the file above was modified after " + "the last sync time -- might be " + "reason for difference)"); + } + } + + virtual void NotifyDownloadFailed(const std::string& rLocalPath, + const std::string& rRemotePath, + BoxException& rException) + { + BOX_ERROR("Failed to download remote file '" << + ConvertForConsole(rRemotePath) << "': " << + rException.what() << " (" << + rException.GetType() << "/" << + rException.GetSubType() << ")"); + mUncheckedFiles ++; + } + + virtual void NotifyDownloadFailed(const std::string& rLocalPath, + const std::string& rRemotePath, + std::exception& rException) + { + BOX_ERROR("Failed to download remote file '" << + ConvertForConsole(rRemotePath) << "': " << + rException.what()); + mUncheckedFiles ++; + } + + virtual void NotifyDownloadFailed(const std::string& rLocalPath, + const std::string& rRemotePath) + { + BOX_ERROR("Failed to download remote file '" << + ConvertForConsole(rRemotePath)); + mUncheckedFiles ++; + } + + virtual void NotifyExcludedFile(const std::string& rLocalPath, + const std::string& rRemotePath) + { + mExcludedFiles ++; + } + + virtual void NotifyExcludedDir(const std::string& rLocalPath, + const std::string& rRemotePath) + { + mExcludedDirs ++; + } + + virtual void NotifyFileCompareOK(const std::string& rLocalPath, + const std::string& rRemotePath) + { + } }; void CompareLocation(const std::string &rLocation, - CompareParams &rParams); + BoxBackupCompareParams &rParams); void Compare(const std::string &rStoreDir, - const std::string &rLocalDir, CompareParams &rParams); + const std::string &rLocalDir, BoxBackupCompareParams &rParams); void Compare(int64_t DirID, const std::string &rStoreDir, - const std::string &rLocalDir, CompareParams &rParams); + const std::string &rLocalDir, BoxBackupCompareParams &rParams); public: Copied: box/trunk/bin/bbackupquery/BoxBackupCompareParams.h (from rev 2413, box/trunk/bin/bbackupquery/BackupQueries.h) =================================================================== --- box/trunk/bin/bbackupquery/BoxBackupCompareParams.h (rev 0) +++ box/trunk/bin/bbackupquery/BoxBackupCompareParams.h 2008-12-30 18:31:52 UTC (rev 2418) @@ -0,0 +1,104 @@ +// -------------------------------------------------------------------------- +// +// File +// Name: BoxBackupCompareParams.h +// Purpose: Parameters and notifiers for a compare operation +// Created: 2008/12/30 +// +// -------------------------------------------------------------------------- + +#ifndef BOXBACKUPCOMPAREPARAMS__H +#define BOXBACKUPCOMPAREPARAMS__H + +#include + +#include "BoxTime.h" +#include "ExcludeList.h" +#include "BackupClientMakeExcludeList.h" + +// -------------------------------------------------------------------------- +// +// Class +// Name: BoxBackupCompareParams +// Purpose: Parameters and notifiers for a compare operation +// Created: 2003/10/10 +// +// -------------------------------------------------------------------------- +class BoxBackupCompareParams +{ +private: + std::auto_ptr mapExcludeFiles, mapExcludeDirs; + bool mQuickCompare; + bool mIgnoreExcludes; + bool mIgnoreAttributes; + box_time_t mLatestFileUploadTime; + +public: + BoxBackupCompareParams(bool QuickCompare, bool IgnoreExcludes, + bool IgnoreAttributes, box_time_t LatestFileUploadTime) + : mQuickCompare(QuickCompare), + mIgnoreExcludes(IgnoreExcludes), + mIgnoreAttributes(IgnoreAttributes), + mLatestFileUploadTime(LatestFileUploadTime) + { } + + virtual ~BoxBackupCompareParams() { } + + bool QuickCompare() { return mQuickCompare; } + bool IgnoreExcludes() { return mIgnoreExcludes; } + bool IgnoreAttributes() { return mIgnoreAttributes; } + box_time_t LatestFileUploadTime() { return mLatestFileUploadTime; } + + void LoadExcludeLists(const Configuration& rLoc) + { + mapExcludeFiles.reset(BackupClientMakeExcludeList_Files(rLoc)); + mapExcludeDirs.reset(BackupClientMakeExcludeList_Dirs(rLoc)); + } + bool IsExcludedFile(const std::string& rLocalPath) + { + if (!mapExcludeFiles.get()) return false; + return mapExcludeFiles->IsExcluded(rLocalPath); + } + bool IsExcludedDir(const std::string& rLocalPath) + { + if (!mapExcludeDirs.get()) return false; + return mapExcludeDirs->IsExcluded(rLocalPath); + } + + virtual void NotifyLocalDirMissing(const std::string& rLocalPath, + const std::string& rRemotePath) = 0; + virtual void NotifyLocalDirAccessFailed(const std::string& rLocalPath, + const std::string& rRemotePath) = 0; + virtual void NotifyStoreDirMissingAttributes(const std::string& rLocalPath, + const std::string& rRemotePath) = 0; + virtual void NotifyDifferentAttributes(const std::string& rLocalPath, + const std::string& rRemotePath, + bool modifiedAfterLastSync, + bool newAttributesApplied) = 0; + virtual void NotifyRemoteFileMissing(const std::string& rLocalPath, + const std::string& rRemotePath, + bool modifiedAfterLastSync) = 0; + virtual void NotifyLocalFileMissing(const std::string& rLocalPath, + const std::string& rRemotePath) = 0; + virtual void NotifyExcludedFileNotDeleted(const std::string& rLocalPath, + const std::string& rRemotePath) = 0; + virtual void NotifyDifferentContents(const std::string& rLocalPath, + const std::string& rRemotePath, + bool modifiedAfterLastSync) = 0; + virtual void NotifyDownloadFailed(const std::string& rLocalPath, + const std::string& rRemotePath, + BoxException& rException) = 0; + virtual void NotifyDownloadFailed(const std::string& rLocalPath, + const std::string& rRemotePath, + std::exception& rException) = 0; + virtual void NotifyDownloadFailed(const std::string& rLocalPath, + const std::string& rRemotePath) = 0; + virtual void NotifyExcludedFile(const std::string& rLocalPath, + const std::string& rRemotePath) = 0; + virtual void NotifyExcludedDir(const std::string& rLocalPath, + const std::string& rRemotePath) = 0; + virtual void NotifyFileCompareOK(const std::string& rLocalPath, + const std::string& rRemotePath) = 0; +}; + +#endif // BOXBACKUPCOMPAREPARAMS__H From boxbackup-dev at boxbackup.org Wed Dec 31 14:37:41 2008 From: boxbackup-dev at boxbackup.org (boxbackup-dev at boxbackup.org) Date: Wed, 31 Dec 2008 14:37:41 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2419 - box/trunk/bin/bbackupquery Message-ID: <20081231143741.B3E35325FCB@www.boxbackup.org> Author: chris Date: 2008-12-31 14:37:40 +0000 (Wed, 31 Dec 2008) New Revision: 2419 Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp box/trunk/bin/bbackupquery/BackupQueries.h box/trunk/bin/bbackupquery/BoxBackupCompareParams.h Log: Compare interface tweaks to reduce the number of methods. Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/trunk/bin/bbackupquery/BackupQueries.cpp 2008-12-30 18:31:52 UTC (rev 2418) +++ box/trunk/bin/bbackupquery/BackupQueries.cpp 2008-12-31 14:37:40 UTC (rev 2419) @@ -1483,8 +1483,13 @@ localAttr.ReadAttributes(rLocalDir.c_str(), true /* directories have zero mod times */); - if(!(attr.Compare(localAttr, true, true /* ignore modification times */))) + if(attr.Compare(localAttr, true, true /* ignore modification times */)) { + rParams.NotifyDirCompared(rLocalDir, rStoreDir, + false, false /* actually we didn't check :) */); + } + else + { bool modifiedAfterLastSync = false; struct stat st; @@ -1497,8 +1502,8 @@ } } - rParams.NotifyDifferentAttributes(rLocalDir, rStoreDir, - modifiedAfterLastSync, false); + rParams.NotifyDirCompared(rLocalDir, rStoreDir, + true, modifiedAfterLastSync); } } @@ -1627,6 +1632,14 @@ } else { + int64_t fileSize = 0; + + struct stat st; + if(::stat(localPath.c_str(), &st) == 0) + { + fileSize = st.st_size; + } + try { // Files the same flag? @@ -1635,7 +1648,7 @@ // File modified after last sync flag bool modifiedAfterLastSync = false; - bool hasDifferentAttribsOrContents = false; + bool hasDifferentAttribs = false; if(rParams.QuickCompare()) { @@ -1699,12 +1712,7 @@ ignoreAttrModTime, fileOnServerStream->IsSymLink() /* ignore modification time if it's a symlink */)) { - rParams.NotifyDifferentAttributes( - localPath, - storePath, - modifiedAfterLastSync, - i->second->HasAttributes()); - hasDifferentAttribsOrContents = true; + hasDifferentAttribs = true; } // Compare contents, if it's a regular file not a link @@ -1747,35 +1755,26 @@ } } - // Report if not equal. - if(!equal) - { - rParams.NotifyDifferentContents( - localPath, storePath, - modifiedAfterLastSync); - hasDifferentAttribsOrContents = true; - } - - if (!hasDifferentAttribsOrContents) - { - rParams.NotifyFileCompareOK( - localPath, storePath); - } + rParams.NotifyFileCompared(localPath, + storePath, fileSize, + hasDifferentAttribs, !equal, + modifiedAfterLastSync, + i->second->HasAttributes()); } catch(BoxException &e) { rParams.NotifyDownloadFailed(localPath, - storePath, e); + storePath, fileSize, e); } catch(std::exception &e) { rParams.NotifyDownloadFailed(localPath, - storePath, e); + storePath, fileSize, e); } catch(...) { rParams.NotifyDownloadFailed(localPath, - storePath); + storePath, fileSize); } // Remove from set so that we know it's been compared Modified: box/trunk/bin/bbackupquery/BackupQueries.h =================================================================== --- box/trunk/bin/bbackupquery/BackupQueries.h 2008-12-30 18:31:52 UTC (rev 2418) +++ box/trunk/bin/bbackupquery/BackupQueries.h 2008-12-31 14:37:40 UTC (rev 2419) @@ -127,32 +127,6 @@ "doesn't have attributes."); } - virtual void NotifyDifferentAttributes( - const std::string& rLocalPath, - const std::string& rRemotePath, - bool modifiedAfterLastSync, - bool newAttributesApplied) - { - BOX_WARNING("Local file '" << - ConvertForConsole(rLocalPath) << - "' has different attributes to store file '" << - ConvertForConsole(rRemotePath) << "'."); - mDifferences ++; - - if(modifiedAfterLastSync) - { - mDifferencesExplainedByModTime ++; - BOX_INFO("(the file above was modified after " - "the last sync time -- might be " - "reason for difference)"); - } - else if(newAttributesApplied) - { - BOX_INFO("(the file above has had new " - "attributes applied)\n"); - } - } - virtual void NotifyRemoteFileMissing( const std::string& rLocalPath, const std::string& rRemotePath, @@ -197,28 +171,8 @@ mDifferences ++; } - virtual void NotifyDifferentContents( - const std::string& rLocalPath, - const std::string& rRemotePath, - bool modifiedAfterLastSync) - { - BOX_WARNING("Local file '" << - ConvertForConsole(rLocalPath) << - "' has different contents to store file '" << - ConvertForConsole(rRemotePath) << "'."); - mDifferences ++; - - if(modifiedAfterLastSync) - { - mDifferencesExplainedByModTime ++; - BOX_INFO("(the file above was modified after " - "the last sync time -- might be " - "reason for difference)"); - } - } - virtual void NotifyDownloadFailed(const std::string& rLocalPath, - const std::string& rRemotePath, + const std::string& rRemotePath, int64_t NumBytes, BoxException& rException) { BOX_ERROR("Failed to download remote file '" << @@ -230,7 +184,7 @@ } virtual void NotifyDownloadFailed(const std::string& rLocalPath, - const std::string& rRemotePath, + const std::string& rRemotePath, int64_t NumBytes, std::exception& rException) { BOX_ERROR("Failed to download remote file '" << @@ -240,7 +194,7 @@ } virtual void NotifyDownloadFailed(const std::string& rLocalPath, - const std::string& rRemotePath) + const std::string& rRemotePath, int64_t NumBytes) { BOX_ERROR("Failed to download remote file '" << ConvertForConsole(rRemotePath)); @@ -259,10 +213,78 @@ mExcludedDirs ++; } - virtual void NotifyFileCompareOK(const std::string& rLocalPath, - const std::string& rRemotePath) + virtual void NotifyDirCompared( + const std::string& rLocalPath, + const std::string& rRemotePath, + bool HasDifferentAttributes, + bool modifiedAfterLastSync) { + if(HasDifferentAttributes) + { + BOX_WARNING("Local directory '" << + ConvertForConsole(rLocalPath) << "' " + "has different attributes to " + "store directory '" << + ConvertForConsole(rRemotePath) << "'."); + mDifferences ++; + + if(modifiedAfterLastSync) + { + mDifferencesExplainedByModTime ++; + BOX_INFO("(the directory above was " + "modified after the last sync " + "time -- might be reason for " + "difference)"); + } + } } + + virtual void NotifyFileCompared(const std::string& rLocalPath, + const std::string& rRemotePath, int64_t NumBytes, + bool HasDifferentAttributes, bool HasDifferentContents, + bool ModifiedAfterLastSync, bool NewAttributesApplied) + { + int NewDifferences = 0; + + if(HasDifferentAttributes) + { + BOX_WARNING("Local file '" << + ConvertForConsole(rLocalPath) << "' " + "has different attributes to " + "store file '" << + ConvertForConsole(rRemotePath) << "'."); + NewDifferences ++; + } + + if(HasDifferentContents) + { + BOX_WARNING("Local file '" << + ConvertForConsole(rLocalPath) << "' " + "has different contents to " + "store file '" << + ConvertForConsole(rRemotePath) << "'."); + NewDifferences ++; + } + + if(HasDifferentAttributes || HasDifferentContents) + { + if(ModifiedAfterLastSync) + { + mDifferencesExplainedByModTime += + NewDifferences; + BOX_INFO("(the file above was modified " + "after the last sync time -- " + "might be reason for difference)"); + } + else if(NewAttributesApplied) + { + BOX_INFO("(the file above has had new " + "attributes applied)\n"); + } + } + + mDifferences += NewDifferences; + } }; void CompareLocation(const std::string &rLocation, BoxBackupCompareParams &rParams); Modified: box/trunk/bin/bbackupquery/BoxBackupCompareParams.h =================================================================== --- box/trunk/bin/bbackupquery/BoxBackupCompareParams.h 2008-12-30 18:31:52 UTC (rev 2418) +++ box/trunk/bin/bbackupquery/BoxBackupCompareParams.h 2008-12-31 14:37:40 UTC (rev 2419) @@ -71,10 +71,6 @@ const std::string& rRemotePath) = 0; virtual void NotifyStoreDirMissingAttributes(const std::string& rLocalPath, const std::string& rRemotePath) = 0; - virtual void NotifyDifferentAttributes(const std::string& rLocalPath, - const std::string& rRemotePath, - bool modifiedAfterLastSync, - bool newAttributesApplied) = 0; virtual void NotifyRemoteFileMissing(const std::string& rLocalPath, const std::string& rRemotePath, bool modifiedAfterLastSync) = 0; @@ -82,23 +78,25 @@ const std::string& rRemotePath) = 0; virtual void NotifyExcludedFileNotDeleted(const std::string& rLocalPath, const std::string& rRemotePath) = 0; - virtual void NotifyDifferentContents(const std::string& rLocalPath, - const std::string& rRemotePath, - bool modifiedAfterLastSync) = 0; virtual void NotifyDownloadFailed(const std::string& rLocalPath, - const std::string& rRemotePath, + const std::string& rRemotePath, int64_t NumBytes, BoxException& rException) = 0; virtual void NotifyDownloadFailed(const std::string& rLocalPath, - const std::string& rRemotePath, + const std::string& rRemotePath, int64_t NumBytes, std::exception& rException) = 0; virtual void NotifyDownloadFailed(const std::string& rLocalPath, - const std::string& rRemotePath) = 0; + const std::string& rRemotePath, int64_t NumBytes) = 0; virtual void NotifyExcludedFile(const std::string& rLocalPath, const std::string& rRemotePath) = 0; virtual void NotifyExcludedDir(const std::string& rLocalPath, const std::string& rRemotePath) = 0; - virtual void NotifyFileCompareOK(const std::string& rLocalPath, - const std::string& rRemotePath) = 0; + virtual void NotifyDirCompared(const std::string& rLocalPath, + const std::string& rRemotePath, bool HasDifferentAttributes, + bool modifiedAfterLastSync) = 0; + virtual void NotifyFileCompared(const std::string& rLocalPath, + const std::string& rRemotePath, int64_t NumBytes, + bool HasDifferentAttributes, bool HasDifferentContents, + bool modifiedAfterLastSync, bool newAttributesApplied) = 0; }; #endif // BOXBACKUPCOMPAREPARAMS__H