From boxbackup-dev at fluffy.co.uk Sat Sep 1 14:12:14 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 01 Sep 2007 14:12:14 +0100 Subject: [Box Backup-commit] COMMIT r1798 - box/chris/general/infrastructure Message-ID: Author: chris Date: 2007-09-01 14:12:14 +0100 (Sat, 01 Sep 2007) New Revision: 1798 Modified: box/chris/general/infrastructure/makebuildenv.pl.in Log: Fix quiet-build makefiles to work on BSDs (merges [1795]) Modified: box/chris/general/infrastructure/makebuildenv.pl.in =================================================================== --- box/chris/general/infrastructure/makebuildenv.pl.in 2007-08-31 18:43:59 UTC (rev 1797) +++ box/chris/general/infrastructure/makebuildenv.pl.in 2007-09-01 13:12:14 UTC (rev 1798) @@ -544,6 +544,32 @@ VARIENT = DEBUG .endif +__E + + if ($bsd_make) + { + print MAKE <<__E; +.ifdef V +HIDE = +_CXX = \$(CXX) +_LINK = \$(CXX) +_WINDRES = \$(WINDRES) +_AR = \$(AR) +_RANLIB = \$(RANLIB) +.else +HIDE = @ +_CXX = @ echo "[CXX] " \$(*F) && \$(CXX) +_LINK = @ echo "[LINK] " \$(*F) && \$(CXX) +_WINDRES = @ echo "[WINDRES]" \$(*F) && \$(WINDRES) +_AR = @ echo "[AR] " \$(*F) && \$(AR) +_RANLIB = @ echo "[RANLIB] " \$(*F) && \$(RANLIB) +.endif + +__E + } + else + { + print MAKE <<__E; HIDE = \$(if \$(V),,@) _CXX = \$(if \$(V),\$(CXX), @ echo "[CXX] \$<" && \$(CXX)) _LINK = \$(if \$(V),\$(CXX), @ echo "[LINK] \$@" && \$(CXX)) @@ -552,6 +578,7 @@ _RANLIB = \$(if \$(V),\$(RANLIB), @ echo "[RANLIB] \$@" && \$(RANLIB)) __E + } # read directory opendir DIR,$mod; From boxbackup-dev at fluffy.co.uk Sat Sep 1 14:12:55 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 01 Sep 2007 14:12:55 +0100 Subject: [Box Backup-commit] COMMIT r1799 - box/chris/general/infrastructure Message-ID: Author: chris Date: 2007-09-01 14:12:55 +0100 (Sat, 01 Sep 2007) New Revision: 1799 Modified: box/chris/general/infrastructure/BoxPlatform.pm.in Log: Fix $bsd_make to not be defined on GNU/kFreeBSD, which uses GNU Make. (merges [1796]) Modified: box/chris/general/infrastructure/BoxPlatform.pm.in =================================================================== --- box/chris/general/infrastructure/BoxPlatform.pm.in 2007-09-01 13:12:14 UTC (rev 1798) +++ box/chris/general/infrastructure/BoxPlatform.pm.in 2007-09-01 13:12:55 UTC (rev 1799) @@ -27,8 +27,10 @@ $build_os = 'CYGWIN' if $build_os =~ m/CYGWIN/; $make_command = ($build_os eq 'Darwin') ? 'bsdmake' : ($build_os eq 'SunOS') ? 'gmake' : 'make'; - $bsd_make = ($build_os ne 'Linux' && $build_os ne 'CYGWIN' && $build_os ne "SunOS"); + $bsd_make = ($build_os ne 'Linux' && $build_os ne 'CYGWIN' && + $build_os ne "SunOS" && $build_os ne 'GNU/kFreeBSD'); + # blank extra flags by default $platform_compile_line_extra = '@CPPFLAGS@ @CXXFLAGS@ @CXXFLAGS_STRICT@'; $platform_compile_line_extra =~ s/ -O2//; From boxbackup-dev at fluffy.co.uk Sat Sep 1 14:13:19 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 01 Sep 2007 14:13:19 +0100 Subject: [Box Backup-commit] COMMIT r1800 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2007-09-01 14:13:19 +0100 (Sat, 01 Sep 2007) New Revision: 1800 Modified: box/chris/general/bin/bbackupd/bbackupd-config.in Log: Update the comments in the generated configuration file to better describe the available options and their units. (merges [1797]) Modified: box/chris/general/bin/bbackupd/bbackupd-config.in =================================================================== --- box/chris/general/bin/bbackupd/bbackupd-config.in 2007-09-01 13:12:55 UTC (rev 1799) +++ box/chris/general/bin/bbackupd/bbackupd-config.in 2007-09-01 13:13:19 UTC (rev 1800) @@ -302,21 +302,24 @@ # lazy mode configuration print CONFIG <<__E; -# A scan of the local discs will be made once an hour (approximately). -# To avoid cycles of load on the server, this time is randomly adjusted by a small -# percentage as the daemon runs. +# The number of seconds between backup runs under normal conditions. A scan To +# avoid cycles of load on the server, this time is randomly adjusted by a +# small percentage as the daemon runs. UpdateStoreInterval = 3600 -# A file must have been modified at least 6 hours ago before it will be uploaded. +# The minimum age of a file, in seconds, that will be uploaded. Avoids +# repeated uploads of a file which is constantly being modified. MinimumFileAge = 21600 -# If a file is modified repeated, it won't be uploaded immediately in case it's modified again. -# However, it should be uploaded eventually. This is how long we should wait after first noticing -# a change. (1 day) +# If a file is modified repeated, it won't be uploaded immediately in case +# it's modified again, due to the MinimumFileAge specified above. However, it +# should be uploaded eventually even if it is being modified repeatedly. This +# is how long we should wait, in seconds, after first noticing a change. +# (86400 seconds = 1 day) MaxUploadWait = 86400 @@ -352,13 +355,17 @@ DiffingUploadSizeThreshold = 8192 -# The limit on how much time is spent diffing files. Most files shouldn't take very long, -# but if you have really big files you can use this to limit the time spent diffing them. +# The limit on how much time is spent diffing files, in seconds. Most files +# shouldn't take very long, but if you have really big files you can use this +# to limit the time spent diffing them. +# # * Reduce if you are having problems with processor usage. -# * Increase if you have large files, and think the upload of changes is too large and want -# to spend more time searching for unchanged blocks. +# +# * Increase if you have large files, and think the upload of changes is too +# large and you want bbackupd to spend more time searching for unchanged +# blocks. -MaximumDiffingTime = 20 +MaximumDiffingTime = 120 # Uncomment this line to see exactly what the daemon is going when it's connected to the server. @@ -366,14 +373,20 @@ # ExtendedLogging = yes -# Use this to temporarily stop bbackupd from syncronising or connecting to the store. -# This specifies a program or script script which is run just before each sync, and ideally -# the full path to the interpreter. It will be run as the same user bbackupd is running as, -# usually root. -# The script prints either "now" or a number to STDOUT (and a terminating newline, no quotes). -# If the result was "now", then the sync will happen. If it's a number, then the script will -# be asked again in that number of seconds. -# For example, you could use this on a laptop to only backup when on a specific network. +# This specifies a program or script script which is run just before each +# sync, and ideally the full path to the interpreter. It will be run as the +# same user bbackupd is running as, usually root. +# +# The script must output (print) either "now" or a number to STDOUT (and a +# terminating newline, no quotes). +# +# If the result was "now", then the sync will happen. If it's a number, then +# no backup will happen for that number of seconds (bbackupd will pause) and +# then the script will be run again. +# +# Use this to temporarily stop bbackupd from syncronising or connecting to the +# store. For example, you could use this on a laptop to only backup when on a +# specific network, or when it has a working Internet connection. # SyncAllowScript = /path/to/intepreter/or/exe script-name parameters etc @@ -396,7 +409,7 @@ PidFile = /var/run/bbackupd.pid } -# + # BackupLocations specifies which locations on disc should be backed up. Each # directory is in the format # @@ -444,13 +457,12 @@ # AlwaysIncludeDirsRegex = /home/user/bigfiles/path/important/files/.* # AlwaysIncludeFilesRegex = /home/user/bigfiles/path/important/files/.* # -# If a directive ends in Regex, then it is a regular expression rather than a +# If a directive ends in Regex, then it is a regular expression rather than a # explicit full pathname. See # # man 7 re_format # # for the regex syntax on your platform. -# BackupLocations { From boxbackup-dev at fluffy.co.uk Sat Sep 1 14:26:31 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 01 Sep 2007 14:26:31 +0100 Subject: [Box Backup-commit] COMMIT r1801 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2007-09-01 14:26:31 +0100 (Sat, 01 Sep 2007) New Revision: 1801 Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.h box/chris/merge/bin/bbackupd/BackupDaemon.h Log: Log more detailed errors when the server returns an error while uploading a file. (merges [1781]) Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-09-01 13:13:19 UTC (rev 1800) +++ box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-09-01 13:26:31 UTC (rev 1801) @@ -887,9 +887,7 @@ { // Connection errors should just be passed on to the main handler, retries // would probably just cause more problems. - rParams.GetProgressNotifier() - .NotifyFileUploadException( - this, filename, e); + // Already logged by UploadFile throw; } catch(BoxException &e) @@ -1386,12 +1384,17 @@ { // Check and see what error the protocol has -- as it might be an error... int type, subtype; - if(connection.GetLastError(type, subtype) - && type == BackupProtocolClientError::ErrorType + if(connection.GetLastError(type, subtype)) + { + if(type == BackupProtocolClientError::ErrorType && subtype == BackupProtocolClientError::Err_StorageLimitExceeded) - { - // The hard limit was exceeded on the server, notify! - rParams.mrDaemon.NotifySysadmin(BackupDaemon::NotifyEvent_StoreFull); + { + // The hard limit was exceeded on the server, notify! + rParams.mrDaemon.NotifySysadmin(BackupDaemon::NotifyEvent_StoreFull); + } + rParams.GetProgressNotifier() + .NotifyFileUploadServerError( + this, rFilename, type, subtype); } } Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.h =================================================================== --- box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.h 2007-09-01 13:13:19 UTC (rev 1800) +++ box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.h 2007-09-01 13:26:31 UTC (rev 1801) @@ -78,6 +78,10 @@ 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; Modified: box/chris/merge/bin/bbackupd/BackupDaemon.h =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.h 2007-09-01 13:13:19 UTC (rev 1800) +++ box/chris/merge/bin/bbackupd/BackupDaemon.h 2007-09-01 13:26:31 UTC (rev 1801) @@ -21,6 +21,7 @@ #include "SocketListen.h" #include "SocketStream.h" #include "Logging.h" +#include "autogen_BackupProtocolClient.h" #ifdef WIN32 #include "WinNamedPipeStream.h" @@ -304,6 +305,70 @@ << "/" << rException.GetSubType() << ")"); } } + virtual void NotifyFileUploadServerError( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath, + int type, int subtype) + { + std::ostringstream msgs; + if (type != BackupProtocolClientError::ErrorType) + { + msgs << "unknown error type " << type; + } + else + { + switch(subtype) + { + case BackupProtocolClientError::Err_WrongVersion: + msgs << "WrongVersion"; + break; + case BackupProtocolClientError::Err_NotInRightProtocolPhase: + msgs << "NotInRightProtocolPhase"; + break; + case BackupProtocolClientError::Err_BadLogin: + msgs << "BadLogin"; + break; + case BackupProtocolClientError::Err_CannotLockStoreForWriting: + msgs << "CannotLockStoreForWriting"; + break; + case BackupProtocolClientError::Err_SessionReadOnly: + msgs << "SessionReadOnly"; + break; + case BackupProtocolClientError::Err_FileDoesNotVerify: + msgs << "FileDoesNotVerify"; + break; + case BackupProtocolClientError::Err_DoesNotExist: + msgs << "DoesNotExist"; + break; + case BackupProtocolClientError::Err_DirectoryAlreadyExists: + msgs << "DirectoryAlreadyExists"; + break; + case BackupProtocolClientError::Err_CannotDeleteRoot: + msgs << "CannotDeleteRoot"; + break; + case BackupProtocolClientError::Err_TargetNameExists: + msgs << "TargetNameExists"; + break; + case BackupProtocolClientError::Err_StorageLimitExceeded: + msgs << "StorageLimitExceeded"; + break; + case BackupProtocolClientError::Err_DiffFromFileDoesNotExist: + msgs << "DiffFromFileDoesNotExist"; + break; + case BackupProtocolClientError::Err_DoesNotExistInDirectory: + msgs << "DoesNotExistInDirectory"; + break; + case BackupProtocolClientError::Err_PatchConsistencyError: + msgs << "PatchConsistencyError"; + break; + default: + msgs << "unknown error subtype " << subtype; + } + } + + BOX_ERROR("Failed to upload file: " << rLocalPath + << ": server error: " << msgs.str()); + } virtual void NotifyFileUploading( const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath) From boxbackup-dev at fluffy.co.uk Sat Sep 1 16:11:30 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 01 Sep 2007 16:11:30 +0100 Subject: [Box Backup-commit] COMMIT r1802 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2007-09-01 16:11:30 +0100 (Sat, 01 Sep 2007) New Revision: 1802 Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: Use ProgressNotifier to report upload exceptions (merges last part of [1342]) Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-09-01 13:26:31 UTC (rev 1801) +++ box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-09-01 15:11:30 UTC (rev 1802) @@ -887,7 +887,9 @@ { // Connection errors should just be passed on to the main handler, retries // would probably just cause more problems. - // Already logged by UploadFile + rParams.GetProgressNotifier() + .NotifyFileUploadException( + this, filename, e); throw; } catch(BoxException &e) From boxbackup-dev at fluffy.co.uk Sat Sep 1 17:58:15 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 01 Sep 2007 17:58:15 +0100 Subject: [Box Backup-commit] COMMIT r1803 - box/chris/merge/lib/common Message-ID: Author: chris Date: 2007-09-01 17:58:15 +0100 (Sat, 01 Sep 2007) New Revision: 1803 Modified: box/chris/merge/lib/common/Timer.cpp Log: Use sigset() instead of signal() to ensure that SysV systems (like Solaris) will not clear our signal handler after firing it. Modified: box/chris/merge/lib/common/Timer.cpp =================================================================== --- box/chris/merge/lib/common/Timer.cpp 2007-09-01 15:11:30 UTC (rev 1802) +++ box/chris/merge/lib/common/Timer.cpp 2007-09-01 16:58:15 UTC (rev 1803) @@ -39,7 +39,7 @@ InitTimer(); SetTimerHandler(Timers::SignalHandler); #else - sighandler_t oldHandler = ::signal(SIGALRM, + sighandler_t oldHandler = ::sigset(SIGALRM, Timers::SignalHandler); ASSERT(oldHandler == 0); #endif // WIN32 && !PLATFORM_CYGWIN @@ -70,7 +70,7 @@ int result = ::setitimer(ITIMER_REAL, &timeout, NULL); ASSERT(result == 0); - sighandler_t oldHandler = ::signal(SIGALRM, NULL); + sighandler_t oldHandler = ::sigset(SIGALRM, NULL); ASSERT(oldHandler == Timers::SignalHandler); #endif // WIN32 && !PLATFORM_CYGWIN @@ -146,8 +146,11 @@ } #ifndef WIN32 - if (::signal(SIGALRM, Timers::SignalHandler) != Timers::SignalHandler) + void (*oldhandler)(int) = ::sigset(SIGALRM, Timers::SignalHandler); + if (oldhandler != Timers::SignalHandler) { + printf("Signal handler was %p, expected %p\n", + oldhandler, Timers::SignalHandler); THROW_EXCEPTION(CommonException, Internal) } #endif From boxbackup-dev at fluffy.co.uk Sat Sep 1 19:39:43 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 01 Sep 2007 18:39:43 -0000 Subject: [Box Backup-commit] #35: Redundant locations not removed Message-ID: <051.37fdfc20617ba761a3c7b3dd10d16d22@fluffy.co.uk> #35: Redundant locations not removed ----------------------------------------------+----------------------------- Reporter: chris | Owner: chris Type: defect | Status: new Priority: normal | Milestone: 0.11 Component: bbackupd | Version: Keywords: redundant locations delete timer | ----------------------------------------------+----------------------------- Tobias Balle-Petersen reports that: I'm running chris-merge on my debian bb store and my OS X bb client. I have removed 2 "sections" from the bbackupd.conf on the OS X client. In the log I get the following: 2 redundant locations in root directory found, will delete from store after 172800 seconds. 172800 second = 48 hours have now gone and the deleted "sections" are still visible on the store, and new files are not beeing backup because the store is full? See full thread at: http://lists.warhead.org.uk/pipermail/boxbackup/2007-July/003644.html This may already be fixed by [1726] but this has not been confirmed (see http://lists.warhead.org.uk/pipermail/boxbackup/2007-July/003650.html and followups). -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Sat Sep 1 21:56:26 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 01 Sep 2007 21:56:26 +0100 Subject: [Box Backup-commit] COMMIT r1804 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2007-09-01 21:56:26 +0100 (Sat, 01 Sep 2007) New Revision: 1804 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp box/chris/merge/bin/bbackupd/BackupDaemon.h box/chris/merge/bin/bbackupd/bbackupd-config.in Log: Call the notify script whenever backup starts or finishes, but the default script does nothing in this case. Requested by scott . Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2007-09-01 16:58:15 UTC (rev 1803) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2007-09-01 20:56:26 UTC (rev 1804) @@ -903,6 +903,9 @@ // Delete any unused directories? DeleteUnusedRootDirEntries(clientContext); + // Notify administrator + NotifySysadmin(NotifyEvent_BackupStart); + // Go through the records, syncing them for(std::vector::const_iterator i(mLocations.begin()); @@ -986,6 +989,9 @@ // Log BOX_NOTICE("Finished scan of local files"); + // Notify administrator + NotifySysadmin(NotifyEvent_BackupFinish); + // -------------------------------------------------------------------------------------------- // We had a successful backup, save the store @@ -2231,7 +2237,8 @@ // // Function // Name: BackupDaemon::NotifySysadmin(int) -// Purpose: Run the script to tell the sysadmin about events which need attention. +// Purpose: Run the script to tell the sysadmin about events +// which need attention. // Created: 25/2/04 // // -------------------------------------------------------------------------- @@ -2242,26 +2249,40 @@ "store-full", "read-error", "backup-error", + "backup-start", + "backup-finish", 0 }; + BOX_TRACE("sizeof(sEventNames) == " << sizeof(sEventNames)); + BOX_TRACE("sizeof(*sEventNames) == " << sizeof(*sEventNames)); + BOX_TRACE("NotifyEvent__MAX == " << NotifyEvent__MAX); + ASSERT((sizeof(sEventNames)/sizeof(*sEventNames)) == NotifyEvent__MAX + 1); + BOX_TRACE("BackupDaemon::NotifySysadmin() called, event = " << sEventNames[Event]); if(Event < 0 || Event >= NotifyEvent__MAX) { - THROW_EXCEPTION(BackupStoreException, BadNotifySysadminEventCode); + THROW_EXCEPTION(BackupStoreException, + BadNotifySysadminEventCode); } // Don't send lots of repeated messages - if(mNotificationsSent[Event]) + if(mNotificationsSent[Event] && + Event != NotifyEvent_BackupStart && + Event != NotifyEvent_BackupFinish) { + BOX_WARNING("Suppressing duplicate notification about " << + sEventNames[Event]); return; } // Is there a notifation script? const Configuration &conf(GetConfiguration()); - if(!conf.KeyExists("NotifyScript")) + if(!conf.KeyExists("NotifyScript") && + Event != NotifyEvent_BackupStart && + Event != NotifyEvent_BackupFinish) { // Log, and then return BOX_ERROR("Not notifying administrator about event " @@ -2271,7 +2292,8 @@ } // Script to run - std::string script(conf.GetKeyValue("NotifyScript") + ' ' + sEventNames[Event]); + std::string script(conf.GetKeyValue("NotifyScript") + ' ' + + sEventNames[Event]); // Log what we're about to do BOX_NOTICE("About to notify administrator about event " @@ -2285,7 +2307,8 @@ << script << "')"); } - // Flag that this is done so the administrator isn't constantly bombarded with lots of errors + // Flag that this is done so the administrator isn't constantly + // bombarded with lots of errors mNotificationsSent[Event] = true; } Modified: box/chris/merge/bin/bbackupd/BackupDaemon.h =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.h 2007-09-01 16:58:15 UTC (rev 1803) +++ box/chris/merge/bin/bbackupd/BackupDaemon.h 2007-09-01 20:56:26 UTC (rev 1804) @@ -85,6 +85,8 @@ NotifyEvent_StoreFull = 0, NotifyEvent_ReadError, NotifyEvent_BackupError, + NotifyEvent_BackupStart, + NotifyEvent_BackupFinish, NotifyEvent__MAX // When adding notifications, remember to add strings to NotifySysadmin() }; Modified: box/chris/merge/bin/bbackupd/bbackupd-config.in =================================================================== --- box/chris/merge/bin/bbackupd/bbackupd-config.in 2007-09-01 16:58:15 UTC (rev 1803) +++ box/chris/merge/bin/bbackupd/bbackupd-config.in 2007-09-01 20:56:26 UTC (rev 1804) @@ -211,12 +211,24 @@ print NOTIFY <<__EOS; #!/bin/sh +# This script is run whenever bbackupd changes state or encounters a +# problem which requires the system administrator to assist: +# +# 1) The store is full, and no more data can be uploaded. +# 2) Some files or directories were not readable. +# 3) A backup run starts or finishes. +# +# The default script emails the system administrator, except for backups +# starting and stopping, where it does nothing. + SUBJECT="BACKUP PROBLEM on host $hostname" SENDTO="$current_username" -if [ \$1 = store-full ] -then -$sendmail \$SENDTO <" >&2 + exit 2 +elif [ "\$1" = store-full ]; then + $sendmail \$SENDTO < Author: chris Date: 2007-09-01 21:57:13 +0100 (Sat, 01 Sep 2007) New Revision: 1805 Modified: box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp box/chris/general/bin/bbackupd/BackupDaemon.cpp box/chris/general/bin/bbackupd/BackupDaemon.h box/chris/general/bin/bbackupd/bbackupd-config.in Log: Call the notify script whenever backup starts or finishes, but the default script does nothing in this case. Requested by scott . (merges [1804]) Modified: box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-09-01 20:56:26 UTC (rev 1804) +++ box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-09-01 20:57:13 UTC (rev 1805) @@ -887,7 +887,9 @@ { // Connection errors should just be passed on to the main handler, retries // would probably just cause more problems. - // Already logged by UploadFile + rParams.GetProgressNotifier() + .NotifyFileUploadException( + this, filename, e); throw; } catch(BoxException &e) Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-01 20:56:26 UTC (rev 1804) +++ box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-01 20:57:13 UTC (rev 1805) @@ -903,6 +903,9 @@ // Delete any unused directories? DeleteUnusedRootDirEntries(clientContext); + // Notify administrator + NotifySysadmin(NotifyEvent_BackupStart); + // Go through the records, syncing them for(std::vector::const_iterator i(mLocations.begin()); @@ -986,6 +989,9 @@ // Log BOX_NOTICE("Finished scan of local files"); + // Notify administrator + NotifySysadmin(NotifyEvent_BackupFinish); + // -------------------------------------------------------------------------------------------- // We had a successful backup, save the store @@ -2215,7 +2221,8 @@ // // Function // Name: BackupDaemon::NotifySysadmin(int) -// Purpose: Run the script to tell the sysadmin about events which need attention. +// Purpose: Run the script to tell the sysadmin about events +// which need attention. // Created: 25/2/04 // // -------------------------------------------------------------------------- @@ -2226,26 +2233,40 @@ "store-full", "read-error", "backup-error", + "backup-start", + "backup-finish", 0 }; + BOX_TRACE("sizeof(sEventNames) == " << sizeof(sEventNames)); + BOX_TRACE("sizeof(*sEventNames) == " << sizeof(*sEventNames)); + BOX_TRACE("NotifyEvent__MAX == " << NotifyEvent__MAX); + ASSERT((sizeof(sEventNames)/sizeof(*sEventNames)) == NotifyEvent__MAX + 1); + BOX_TRACE("BackupDaemon::NotifySysadmin() called, event = " << sEventNames[Event]); if(Event < 0 || Event >= NotifyEvent__MAX) { - THROW_EXCEPTION(BackupStoreException, BadNotifySysadminEventCode); + THROW_EXCEPTION(BackupStoreException, + BadNotifySysadminEventCode); } // Don't send lots of repeated messages - if(mNotificationsSent[Event]) + if(mNotificationsSent[Event] && + Event != NotifyEvent_BackupStart && + Event != NotifyEvent_BackupFinish) { + BOX_WARNING("Suppressing duplicate notification about " << + sEventNames[Event]); return; } // Is there a notifation script? const Configuration &conf(GetConfiguration()); - if(!conf.KeyExists("NotifyScript")) + if(!conf.KeyExists("NotifyScript") && + Event != NotifyEvent_BackupStart && + Event != NotifyEvent_BackupFinish) { // Log, and then return BOX_ERROR("Not notifying administrator about event " @@ -2255,7 +2276,8 @@ } // Script to run - std::string script(conf.GetKeyValue("NotifyScript") + ' ' + sEventNames[Event]); + std::string script(conf.GetKeyValue("NotifyScript") + ' ' + + sEventNames[Event]); // Log what we're about to do BOX_NOTICE("About to notify administrator about event " @@ -2269,7 +2291,8 @@ << script << "')"); } - // Flag that this is done so the administrator isn't constantly bombarded with lots of errors + // Flag that this is done so the administrator isn't constantly + // bombarded with lots of errors mNotificationsSent[Event] = true; } Modified: box/chris/general/bin/bbackupd/BackupDaemon.h =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.h 2007-09-01 20:56:26 UTC (rev 1804) +++ box/chris/general/bin/bbackupd/BackupDaemon.h 2007-09-01 20:57:13 UTC (rev 1805) @@ -85,6 +85,8 @@ NotifyEvent_StoreFull = 0, NotifyEvent_ReadError, NotifyEvent_BackupError, + NotifyEvent_BackupStart, + NotifyEvent_BackupFinish, NotifyEvent__MAX // When adding notifications, remember to add strings to NotifySysadmin() }; Modified: box/chris/general/bin/bbackupd/bbackupd-config.in =================================================================== --- box/chris/general/bin/bbackupd/bbackupd-config.in 2007-09-01 20:56:26 UTC (rev 1804) +++ box/chris/general/bin/bbackupd/bbackupd-config.in 2007-09-01 20:57:13 UTC (rev 1805) @@ -211,12 +211,24 @@ print NOTIFY <<__EOS; #!/bin/sh +# This script is run whenever bbackupd changes state or encounters a +# problem which requires the system administrator to assist: +# +# 1) The store is full, and no more data can be uploaded. +# 2) Some files or directories were not readable. +# 3) A backup run starts or finishes. +# +# The default script emails the system administrator, except for backups +# starting and stopping, where it does nothing. + SUBJECT="BACKUP PROBLEM on host $hostname" SENDTO="$current_username" -if [ \$1 = store-full ] -then -$sendmail \$SENDTO <" >&2 + exit 2 +elif [ "\$1" = store-full ]; then + $sendmail \$SENDTO < Author: chris Date: 2007-09-02 00:01:43 +0100 (Sun, 02 Sep 2007) New Revision: 1806 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp Log: Fix error message when failing to create remote directory for location. Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2007-09-01 20:57:13 UTC (rev 1805) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2007-09-01 23:01:43 UTC (rev 1806) @@ -1804,7 +1804,7 @@ catch (BoxException &e) { BOX_ERROR("Failed to create remote " - "directory '/" << dirname << + "directory '/" << ploc->mName << "', skipping location."); continue; } From boxbackup-dev at fluffy.co.uk Sun Sep 2 00:02:21 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 02 Sep 2007 00:02:21 +0100 Subject: [Box Backup-commit] COMMIT r1807 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2007-09-02 00:02:21 +0100 (Sun, 02 Sep 2007) New Revision: 1807 Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp Log: Fix error message when failing to create remote directory for location. (merges [1805]) Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-01 23:01:43 UTC (rev 1806) +++ box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-01 23:02:21 UTC (rev 1807) @@ -1804,7 +1804,7 @@ catch (BoxException &e) { BOX_ERROR("Failed to create remote " - "directory '/" << dirname << + "directory '/" << ploc->mName << "', skipping location."); continue; } From boxbackup-dev at fluffy.co.uk Sun Sep 2 00:03:58 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 02 Sep 2007 00:03:58 +0100 Subject: [Box Backup-commit] COMMIT r1808 - box/chris/merge/lib/common Message-ID: Author: chris Date: 2007-09-02 00:03:58 +0100 (Sun, 02 Sep 2007) New Revision: 1808 Modified: box/chris/merge/lib/common/Logging.h Log: Format account number properly (8 hex digits). Modified: box/chris/merge/lib/common/Logging.h =================================================================== --- box/chris/merge/lib/common/Logging.h 2007-09-01 23:02:21 UTC (rev 1807) +++ box/chris/merge/lib/common/Logging.h 2007-09-01 23:03:58 UTC (rev 1808) @@ -47,7 +47,7 @@ std::hex << \ std::showbase << \ std::internal << \ - std::setw(8) << \ + std::setw(10) << \ std::setfill('0') << \ (accno) From boxbackup-dev at fluffy.co.uk Sun Sep 2 00:04:32 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 02 Sep 2007 00:04:32 +0100 Subject: [Box Backup-commit] COMMIT r1809 - box/chris/general/lib/common Message-ID: Author: chris Date: 2007-09-02 00:04:32 +0100 (Sun, 02 Sep 2007) New Revision: 1809 Modified: box/chris/general/lib/common/Logging.h Log: Format account number properly (8 hex digits). (merges [1808]) Modified: box/chris/general/lib/common/Logging.h =================================================================== --- box/chris/general/lib/common/Logging.h 2007-09-01 23:03:58 UTC (rev 1808) +++ box/chris/general/lib/common/Logging.h 2007-09-01 23:04:32 UTC (rev 1809) @@ -47,7 +47,7 @@ std::hex << \ std::showbase << \ std::internal << \ - std::setw(8) << \ + std::setw(10) << \ std::setfill('0') << \ (accno) From boxbackup-dev at fluffy.co.uk Thu Sep 6 22:10:54 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 06 Sep 2007 22:10:54 +0100 Subject: [Box Backup-commit] COMMIT r1810 - box/chris/general/lib/server Message-ID: Author: chris Date: 2007-09-06 22:10:54 +0100 (Thu, 06 Sep 2007) New Revision: 1810 Modified: box/chris/general/lib/server/LocalProcessStream.cpp Log: Win32 compile fix (logging framework abuse). Modified: box/chris/general/lib/server/LocalProcessStream.cpp =================================================================== --- box/chris/general/lib/server/LocalProcessStream.cpp 2007-09-01 23:04:32 UTC (rev 1809) +++ box/chris/general/lib/server/LocalProcessStream.cpp 2007-09-06 21:10:54 UTC (rev 1810) @@ -120,7 +120,7 @@ HANDLE writeInChild, readFromChild; if(!CreatePipe(&readFromChild, &writeInChild, &secAttr, 0)) { - BOX_ERROR("Failed to CreatePipe for child process: " + BOX_ERROR("Failed to CreatePipe for child process: " << GetErrorMessage(GetLastError())); THROW_EXCEPTION(ServerException, SocketPairFailed) } From boxbackup-dev at fluffy.co.uk Thu Sep 6 22:16:08 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 06 Sep 2007 22:16:08 +0100 Subject: [Box Backup-commit] COMMIT r1811 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2007-09-06 22:16:08 +0100 (Thu, 06 Sep 2007) New Revision: 1811 Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp Log: Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end. Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-06 21:10:54 UTC (rev 1810) +++ box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-06 21:16:08 UTC (rev 1811) @@ -1821,12 +1821,12 @@ } catch (std::exception &e) { - delete ploc; - ploc = 0; BOX_ERROR("Failed to configure location '" << ploc->mName << "' path '" << ploc->mPath << "': " << e.what() << ": please check for previous errors"); + delete ploc; + ploc = 0; throw; } catch(...) From boxbackup-dev at fluffy.co.uk Thu Sep 6 23:37:38 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 06 Sep 2007 23:37:38 +0100 Subject: [Box Backup-commit] COMMIT r1812 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2007-09-06 23:37:38 +0100 (Thu, 06 Sep 2007) New Revision: 1812 Modified: box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: Fix comments. Modified: box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-09-06 21:16:08 UTC (rev 1811) +++ box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-09-06 22:37:38 UTC (rev 1812) @@ -1384,7 +1384,8 @@ if(e.GetType() == ConnectionException::ExceptionType && e.GetSubType() == ConnectionException::Protocol_UnexpectedReply) { - // Check and see what error the protocol has -- as it might be an error... + // Check and see what error the protocol has, + // this is more useful to users than the exception. int type, subtype; if(connection.GetLastError(type, subtype)) { From boxbackup-dev at fluffy.co.uk Thu Sep 6 23:39:18 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 06 Sep 2007 23:39:18 +0100 Subject: [Box Backup-commit] COMMIT r1813 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2007-09-06 23:39:18 +0100 (Thu, 06 Sep 2007) New Revision: 1813 Modified: box/chris/general/bin/bbackupd/Win32BackupService.cpp box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp box/chris/general/bin/bbackupd/Win32ServiceFunctions.h box/chris/general/bin/bbackupd/bbackupd.cpp Log: Don't initialise MemLeakFinder twice when running as a service. Return a non-zero exit code if running as a service fails. Modified: box/chris/general/bin/bbackupd/Win32BackupService.cpp =================================================================== --- box/chris/general/bin/bbackupd/Win32BackupService.cpp 2007-09-06 22:37:38 UTC (rev 1812) +++ box/chris/general/bin/bbackupd/Win32BackupService.cpp 2007-09-06 22:39:18 UTC (rev 1813) @@ -31,12 +31,6 @@ { DWORD ret; - // keep MAINHELPER_START happy - int argc = 0; - char* argv[] = {NULL}; - - MAINHELPER_START - if (pConfigFileName != NULL) { ret = this->Main(pConfigFileName); @@ -46,8 +40,6 @@ ret = this->Main(BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE); } - MAINHELPER_END - return ret; } Modified: box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp 2007-09-06 22:37:38 UTC (rev 1812) +++ box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp 2007-09-06 22:39:18 UTC (rev 1813) @@ -161,7 +161,7 @@ } } -void OurService(char* pConfigFileName) +int OurService(char* pConfigFileName) { spConfigFileName = pConfigFileName; @@ -180,7 +180,10 @@ ErrorHandler("Failed to start service. Did you start " "Box Backup from the Service Control Manager? " "(StartServiceCtrlDispatcher)", GetLastError()); + return 1; } + + return 0; } int InstallService(const char* pConfigFileName) Modified: box/chris/general/bin/bbackupd/Win32ServiceFunctions.h =================================================================== --- box/chris/general/bin/bbackupd/Win32ServiceFunctions.h 2007-09-06 22:37:38 UTC (rev 1812) +++ box/chris/general/bin/bbackupd/Win32ServiceFunctions.h 2007-09-06 22:39:18 UTC (rev 1813) @@ -12,8 +12,8 @@ #ifndef WIN32SERVICEFUNCTIONS_H #define WIN32SERVICEFUNCTIONS_H -int RemoveService (void); -int InstallService (const char* pConfigFilePath); -void OurService (char* pConfigFileName); +int RemoveService (void); +int InstallService (const char* pConfigFilePath); +int OurService (char* pConfigFileName); #endif Modified: box/chris/general/bin/bbackupd/bbackupd.cpp =================================================================== --- box/chris/general/bin/bbackupd/bbackupd.cpp 2007-09-06 22:37:38 UTC (rev 1812) +++ box/chris/general/bin/bbackupd/bbackupd.cpp 2007-09-06 22:39:18 UTC (rev 1813) @@ -25,6 +25,8 @@ int main(int argc, const char *argv[]) { + int ExitCode = 0; + MAINHELPER_START Logging::SetProgramName("Box Backup (bbackupd)"); @@ -65,8 +67,6 @@ EnableBackupRights(); - int ExitCode = 0; - if (runAsWin32Service) { BOX_INFO("Box Backup service starting"); @@ -77,7 +77,7 @@ config = strdup(argv[2]); } - OurService(config); + ExitCode = OurService(config); if (config) { @@ -94,14 +94,14 @@ delete gpDaemonService; - return ExitCode; - #else // !WIN32 BackupDaemon daemon; - return daemon.Main(BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv); + ExitCode = daemon.Main(BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv); #endif // WIN32 MAINHELPER_END + + return ExitCode; } From boxbackup-dev at fluffy.co.uk Thu Sep 6 23:39:48 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 06 Sep 2007 23:39:48 +0100 Subject: [Box Backup-commit] COMMIT r1814 - box/chris/general/lib/win32 Message-ID: Author: chris Date: 2007-09-06 23:39:48 +0100 (Thu, 06 Sep 2007) New Revision: 1814 Modified: box/chris/general/lib/win32/emu.cpp Log: No need to print syslog() messages any more, now that we have a logging framework. Modified: box/chris/general/lib/win32/emu.cpp =================================================================== --- box/chris/general/lib/win32/emu.cpp 2007-09-06 22:39:18 UTC (rev 1813) +++ box/chris/general/lib/win32/emu.cpp 2007-09-06 22:39:48 UTC (rev 1814) @@ -509,9 +509,17 @@ tmpStr = ""; return tmpStr; } - - if (filename.length() >= 1 && filename[0] == '\\') + + if (filename.length() > 2 && filename[0] == '\\' && + filename[1] == '\\') { + tmpStr += "UNC\\"; + filename.replace(0, 2, ""); + // \\?\UNC\\ + // see http://msdn2.microsoft.com/en-us/library/aa365247.aspx + } + else if (filename.length() >= 1 && filename[0] == '\\') + { // root directory of current drive. tmpStr = wd; tmpStr.resize(2); // drive letter and colon @@ -1520,8 +1528,8 @@ sHaveWarnedEventLogFull = false; } - printf("%s\r\n", buffer); - fflush(stdout); + // printf("%s\r\n", buffer); + // fflush(stdout); } int emu_chdir(const char* pDirName) From boxbackup-dev at fluffy.co.uk Fri Sep 7 00:10:10 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 07 Sep 2007 00:10:10 +0100 Subject: [Box Backup-commit] COMMIT r1815 - box/chris/win32/releases Message-ID: Author: chris Date: 2007-09-07 00:10:10 +0100 (Fri, 07 Sep 2007) New Revision: 1815 Added: box/chris/win32/releases/boxbackup-chris_general_1814-backup-client-mingw32.zip Log: New client release 1814 with the following new features: * Use new logging framework almost everywhere. [1784] [1790] [1806] [1809] [1810] [1811] * Don't print syslog messages to the console any more. [1814] * Call the notification script whenever backup starts or finishes. [1805] * Don't initialise DebugMemLeakFinder twice when running as a service. [1813] * Return a non-zero exit code when running as a service fails. [1813] * Fix backup of UNC shares, should allow Box Backup to backup UNC paths when running as a service. [1814] Added: box/chris/win32/releases/boxbackup-chris_general_1814-backup-client-mingw32.zip =================================================================== (Binary files differ) Property changes on: box/chris/win32/releases/boxbackup-chris_general_1814-backup-client-mingw32.zip ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From boxbackup-dev at fluffy.co.uk Fri Sep 7 21:07:43 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 07 Sep 2007 21:07:43 +0100 Subject: [Box Backup-commit] COMMIT r1816 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2007-09-07 21:07:42 +0100 (Fri, 07 Sep 2007) New Revision: 1816 Modified: box/chris/merge/bin/bbackupd/bbackupd-config.in Log: Document and enable KeepAliveTime option by default. Modified: box/chris/merge/bin/bbackupd/bbackupd-config.in =================================================================== --- box/chris/merge/bin/bbackupd/bbackupd-config.in 2007-09-06 23:10:10 UTC (rev 1815) +++ box/chris/merge/bin/bbackupd/bbackupd-config.in 2007-09-07 20:07:42 UTC (rev 1816) @@ -341,6 +341,25 @@ MaxUploadWait = 86400 +# If the connection is idle for some time (e.g. over 10 minutes or 600 +# seconds, not sure exactly how long) then the server will give up and +# disconnect the client, resulting in Connection Protocol_Timeout errors +# on the server and TLSReadFailed or TLSWriteFailed errors on the client. +# Also, some firewalls and NAT gateways will kill idle connections after +# similar lengths of time. +# +# This can happen for example when most files are backed up already and +# don't need to be sent to the store again, while scanning a large +# directory, or while calculating diffs of a large file. To avoid this, +# KeepAliveTime specifies that special keep-alive messages should be sent +# when the connection is otherwise idle for a certain length of time, +# specified here in seconds. +# +# The default is that these messages are never sent, equivalent to setting +# this option to zero, but we recommend that all users enable this. + +KeepAliveTime = 120 + __E } else From boxbackup-dev at fluffy.co.uk Fri Sep 7 21:38:19 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 07 Sep 2007 21:38:19 +0100 Subject: [Box Backup-commit] COMMIT r1817 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2007-09-07 21:38:19 +0100 (Fri, 07 Sep 2007) New Revision: 1817 Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp Log: Handle missing NotifyScript configuration key properly. Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-07 20:07:42 UTC (rev 1816) +++ box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-07 20:38:19 UTC (rev 1817) @@ -2264,14 +2264,15 @@ // Is there a notifation script? const Configuration &conf(GetConfiguration()); - if(!conf.KeyExists("NotifyScript") && - Event != NotifyEvent_BackupStart && - Event != NotifyEvent_BackupFinish) + if(!conf.KeyExists("NotifyScript")) { - // Log, and then return - BOX_ERROR("Not notifying administrator about event " - << sEventNames[Event] << " -- set NotifyScript " - "to do this in future"); + if(Event != NotifyEvent_BackupStart && + Event != NotifyEvent_BackupFinish)) + { + BOX_ERROR("Not notifying administrator about event " + << sEventNames[Event] << " -- set NotifyScript " + "to do this in future"); + } return; } From boxbackup-dev at fluffy.co.uk Fri Sep 7 21:39:06 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 07 Sep 2007 21:39:06 +0100 Subject: [Box Backup-commit] COMMIT r1818 - box/chris/general/lib/common Message-ID: Author: chris Date: 2007-09-07 21:39:06 +0100 (Fri, 07 Sep 2007) New Revision: 1818 Modified: box/chris/general/lib/common/Configuration.cpp Log: Report the name of missing configuration keys in an error message. Modified: box/chris/general/lib/common/Configuration.cpp =================================================================== --- box/chris/general/lib/common/Configuration.cpp 2007-09-07 20:38:19 UTC (rev 1817) +++ box/chris/general/lib/common/Configuration.cpp 2007-09-07 20:39:06 UTC (rev 1818) @@ -319,6 +319,7 @@ if(i == mKeys.end()) { + BOX_ERROR("Missing configuration key: " << pKeyName); THROW_EXCEPTION(CommonException, ConfigNoKey) } else From boxbackup-dev at fluffy.co.uk Fri Sep 7 21:49:00 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 07 Sep 2007 21:49:00 +0100 Subject: [Box Backup-commit] COMMIT r1819 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2007-09-07 21:49:00 +0100 (Fri, 07 Sep 2007) New Revision: 1819 Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp Log: Compile fix. Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-07 20:39:06 UTC (rev 1818) +++ box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-07 20:49:00 UTC (rev 1819) @@ -2267,7 +2267,7 @@ if(!conf.KeyExists("NotifyScript")) { if(Event != NotifyEvent_BackupStart && - Event != NotifyEvent_BackupFinish)) + Event != NotifyEvent_BackupFinish) { BOX_ERROR("Not notifying administrator about event " << sEventNames[Event] << " -- set NotifyScript " From boxbackup-dev at fluffy.co.uk Fri Sep 7 21:50:25 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 07 Sep 2007 21:50:25 +0100 Subject: [Box Backup-commit] COMMIT r1820 - box/chris/general/lib/common Message-ID: Author: chris Date: 2007-09-07 21:50:25 +0100 (Fri, 07 Sep 2007) New Revision: 1820 Modified: box/chris/general/lib/common/ConversionString.cpp Log: Fix warning. Modified: box/chris/general/lib/common/ConversionString.cpp =================================================================== --- box/chris/general/lib/common/ConversionString.cpp 2007-09-07 20:49:00 UTC (rev 1819) +++ box/chris/general/lib/common/ConversionString.cpp 2007-09-07 20:50:25 UTC (rev 1820) @@ -123,7 +123,7 @@ void BoxConvert::_ConvertIntToString(std::string &rTo, int32_t From) { char text[64]; // size more than enough - ::sprintf(text, "%d", From); + ::sprintf(text, "%d", (long)From); rTo = text; } From boxbackup-dev at fluffy.co.uk Fri Sep 7 21:53:16 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 07 Sep 2007 21:53:16 +0100 Subject: [Box Backup-commit] COMMIT r1821 - box/chris/general/lib/common Message-ID: Author: chris Date: 2007-09-07 21:53:16 +0100 (Fri, 07 Sep 2007) New Revision: 1821 Modified: box/chris/general/lib/common/ConversionString.cpp Log: Real fix for warning. Modified: box/chris/general/lib/common/ConversionString.cpp =================================================================== --- box/chris/general/lib/common/ConversionString.cpp 2007-09-07 20:50:25 UTC (rev 1820) +++ box/chris/general/lib/common/ConversionString.cpp 2007-09-07 20:53:16 UTC (rev 1821) @@ -123,7 +123,7 @@ void BoxConvert::_ConvertIntToString(std::string &rTo, int32_t From) { char text[64]; // size more than enough - ::sprintf(text, "%d", (long)From); + ::sprintf(text, "%d", (int)From); rTo = text; } From boxbackup-dev at fluffy.co.uk Fri Sep 7 22:08:30 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 07 Sep 2007 22:08:30 +0100 Subject: [Box Backup-commit] COMMIT r1822 - box/chris/merge/lib/server Message-ID: Author: chris Date: 2007-09-07 22:08:30 +0100 (Fri, 07 Sep 2007) New Revision: 1822 Modified: box/chris/merge/lib/server/LocalProcessStream.cpp Log: Win32 compile fix (logging framework abuse). (merges [1810]) Modified: box/chris/merge/lib/server/LocalProcessStream.cpp =================================================================== --- box/chris/merge/lib/server/LocalProcessStream.cpp 2007-09-07 20:53:16 UTC (rev 1821) +++ box/chris/merge/lib/server/LocalProcessStream.cpp 2007-09-07 21:08:30 UTC (rev 1822) @@ -120,7 +120,7 @@ HANDLE writeInChild, readFromChild; if(!CreatePipe(&readFromChild, &writeInChild, &secAttr, 0)) { - BOX_ERROR("Failed to CreatePipe for child process: " + BOX_ERROR("Failed to CreatePipe for child process: " << GetErrorMessage(GetLastError())); THROW_EXCEPTION(ServerException, SocketPairFailed) } From boxbackup-dev at fluffy.co.uk Fri Sep 7 22:54:33 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 07 Sep 2007 22:54:33 +0100 Subject: [Box Backup-commit] COMMIT r1823 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2007-09-07 22:54:33 +0100 (Fri, 07 Sep 2007) New Revision: 1823 Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: Fix comments. (merges [1812]) Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-09-07 21:08:30 UTC (rev 1822) +++ box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-09-07 21:54:33 UTC (rev 1823) @@ -1384,7 +1384,8 @@ if(e.GetType() == ConnectionException::ExceptionType && e.GetSubType() == ConnectionException::Protocol_UnexpectedReply) { - // Check and see what error the protocol has -- as it might be an error... + // Check and see what error the protocol has, + // this is more useful to users than the exception. int type, subtype; if(connection.GetLastError(type, subtype)) { From boxbackup-dev at fluffy.co.uk Fri Sep 7 22:55:08 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 07 Sep 2007 22:55:08 +0100 Subject: [Box Backup-commit] COMMIT r1824 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2007-09-07 22:55:07 +0100 (Fri, 07 Sep 2007) New Revision: 1824 Modified: box/chris/merge/bin/bbackupd/Win32BackupService.cpp box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h box/chris/merge/bin/bbackupd/bbackupd.cpp Log: Don't initialise MemLeakFinder twice when running as a service. Return a non-zero exit code if running as a service fails. (merges [1813]) Modified: box/chris/merge/bin/bbackupd/Win32BackupService.cpp =================================================================== --- box/chris/merge/bin/bbackupd/Win32BackupService.cpp 2007-09-07 21:54:33 UTC (rev 1823) +++ box/chris/merge/bin/bbackupd/Win32BackupService.cpp 2007-09-07 21:55:07 UTC (rev 1824) @@ -31,12 +31,6 @@ { DWORD ret; - // keep MAINHELPER_START happy - int argc = 0; - char* argv[] = {NULL}; - - MAINHELPER_START - if (pConfigFileName != NULL) { ret = this->Main(pConfigFileName); @@ -46,8 +40,6 @@ ret = this->Main(BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE); } - MAINHELPER_END - return ret; } Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2007-09-07 21:54:33 UTC (rev 1823) +++ box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2007-09-07 21:55:07 UTC (rev 1824) @@ -161,7 +161,7 @@ } } -void OurService(char* pConfigFileName) +int OurService(char* pConfigFileName) { spConfigFileName = pConfigFileName; @@ -180,7 +180,10 @@ ErrorHandler("Failed to start service. Did you start " "Box Backup from the Service Control Manager? " "(StartServiceCtrlDispatcher)", GetLastError()); + return 1; } + + return 0; } int InstallService(const char* pConfigFileName) Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h =================================================================== --- box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h 2007-09-07 21:54:33 UTC (rev 1823) +++ box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h 2007-09-07 21:55:07 UTC (rev 1824) @@ -12,8 +12,8 @@ #ifndef WIN32SERVICEFUNCTIONS_H #define WIN32SERVICEFUNCTIONS_H -int RemoveService (void); -int InstallService (const char* pConfigFilePath); -void OurService (char* pConfigFileName); +int RemoveService (void); +int InstallService (const char* pConfigFilePath); +int OurService (char* pConfigFileName); #endif Modified: box/chris/merge/bin/bbackupd/bbackupd.cpp =================================================================== --- box/chris/merge/bin/bbackupd/bbackupd.cpp 2007-09-07 21:54:33 UTC (rev 1823) +++ box/chris/merge/bin/bbackupd/bbackupd.cpp 2007-09-07 21:55:07 UTC (rev 1824) @@ -25,6 +25,8 @@ int main(int argc, const char *argv[]) { + int ExitCode = 0; + MAINHELPER_START Logging::SetProgramName("Box Backup (bbackupd)"); @@ -65,8 +67,6 @@ EnableBackupRights(); - int ExitCode = 0; - if (runAsWin32Service) { BOX_INFO("Box Backup service starting"); @@ -77,7 +77,7 @@ config = strdup(argv[2]); } - OurService(config); + ExitCode = OurService(config); if (config) { @@ -94,14 +94,14 @@ delete gpDaemonService; - return ExitCode; - #else // !WIN32 BackupDaemon daemon; - return daemon.Main(BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv); + ExitCode = daemon.Main(BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv); #endif // WIN32 MAINHELPER_END + + return ExitCode; } From boxbackup-dev at fluffy.co.uk Fri Sep 7 22:55:53 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 07 Sep 2007 22:55:53 +0100 Subject: [Box Backup-commit] COMMIT r1825 - box/chris/merge/lib/win32 Message-ID: Author: chris Date: 2007-09-07 22:55:53 +0100 (Fri, 07 Sep 2007) New Revision: 1825 Modified: box/chris/merge/lib/win32/emu.cpp Log: No need to print syslog() messages any more, now that we have a logging framework. (merges [1814]) Modified: box/chris/merge/lib/win32/emu.cpp =================================================================== --- box/chris/merge/lib/win32/emu.cpp 2007-09-07 21:55:07 UTC (rev 1824) +++ box/chris/merge/lib/win32/emu.cpp 2007-09-07 21:55:53 UTC (rev 1825) @@ -509,9 +509,17 @@ tmpStr = ""; return tmpStr; } - - if (filename.length() >= 1 && filename[0] == '\\') + + if (filename.length() > 2 && filename[0] == '\\' && + filename[1] == '\\') { + tmpStr += "UNC\\"; + filename.replace(0, 2, ""); + // \\?\UNC\\ + // see http://msdn2.microsoft.com/en-us/library/aa365247.aspx + } + else if (filename.length() >= 1 && filename[0] == '\\') + { // root directory of current drive. tmpStr = wd; tmpStr.resize(2); // drive letter and colon @@ -1520,8 +1528,8 @@ sHaveWarnedEventLogFull = false; } - printf("%s\r\n", buffer); - fflush(stdout); + // printf("%s\r\n", buffer); + // fflush(stdout); } int emu_chdir(const char* pDirName) From boxbackup-dev at fluffy.co.uk Fri Sep 7 22:57:38 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 07 Sep 2007 22:57:38 +0100 Subject: [Box Backup-commit] COMMIT r1826 - box/chris/merge/lib/common Message-ID: Author: chris Date: 2007-09-07 22:57:38 +0100 (Fri, 07 Sep 2007) New Revision: 1826 Modified: box/chris/merge/lib/common/ConversionString.cpp Log: Fix compiler warning. (merges [1820], [1821]) Modified: box/chris/merge/lib/common/ConversionString.cpp =================================================================== --- box/chris/merge/lib/common/ConversionString.cpp 2007-09-07 21:55:53 UTC (rev 1825) +++ box/chris/merge/lib/common/ConversionString.cpp 2007-09-07 21:57:38 UTC (rev 1826) @@ -123,7 +123,7 @@ void BoxConvert::_ConvertIntToString(std::string &rTo, int32_t From) { char text[64]; // size more than enough - ::sprintf(text, "%d", From); + ::sprintf(text, "%d", (int)From); rTo = text; } From boxbackup-dev at fluffy.co.uk Fri Sep 7 23:26:34 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 07 Sep 2007 23:26:34 +0100 Subject: [Box Backup-commit] COMMIT r1827 - box/chris/win32/releases Message-ID: Author: chris Date: 2007-09-07 23:26:34 +0100 (Fri, 07 Sep 2007) New Revision: 1827 Added: box/chris/win32/releases/boxbackup-chris_general_1822-backup-client-mingw32.zip Log: New client release ([1822]), with the following new features: * Handle missing NotifyScript configuration key properly. [1817] * Report the name of missing configuration keys in an error message. [1818] Added: box/chris/win32/releases/boxbackup-chris_general_1822-backup-client-mingw32.zip =================================================================== (Binary files differ) Property changes on: box/chris/win32/releases/boxbackup-chris_general_1822-backup-client-mingw32.zip ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From boxbackup-dev at fluffy.co.uk Sat Sep 8 14:03:50 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 08 Sep 2007 14:03:50 +0100 Subject: [Box Backup-commit] COMMIT r1828 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2007-09-08 14:03:50 +0100 (Sat, 08 Sep 2007) New Revision: 1828 Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp Log: Don't abort if one of the location paths doesn't exist, just print a warning and continue. Use an auto_ptr to avoid memory leaks when setting up a location fails. Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-07 22:26:34 UTC (rev 1827) +++ box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-08 13:03:50 UTC (rev 1828) @@ -1661,22 +1661,24 @@ { BOX_TRACE("new location"); // Create a record for it - Location *ploc = new Location; + std::auto_ptr apLoc(new Location); + try { // Setup names in the location record - ploc->mName = i->first; - ploc->mPath = i->second.GetKeyValue("Path"); + apLoc->mName = i->first; + apLoc->mPath = i->second.GetKeyValue("Path"); // Read the exclude lists from the Configuration - ploc->mpExcludeFiles = BackupClientMakeExcludeList_Files(i->second); - ploc->mpExcludeDirs = BackupClientMakeExcludeList_Dirs(i->second); + apLoc->mpExcludeFiles = BackupClientMakeExcludeList_Files(i->second); + apLoc->mpExcludeDirs = BackupClientMakeExcludeList_Dirs(i->second); + // Does this exist on the server? // Remove from dir object early, so that if we fail // to stat the local directory, we still don't // consider to remote one for deletion. BackupStoreDirectory::Iterator iter(dir); - BackupStoreFilenameClear dirname(ploc->mName); // generate the filename + BackupStoreFilenameClear dirname(apLoc->mName); // generate the filename BackupStoreDirectory::Entry *en = iter.FindMatchingClearName(dirname); int64_t oid = 0; if(en != 0) @@ -1696,17 +1698,18 @@ // BSD style statfs -- includes mount point, which is nice. #ifdef HAVE_STRUCT_STATVFS_F_MNTONNAME struct statvfs s; - if(::statvfs(ploc->mPath.c_str(), &s) != 0) + if(::statvfs(apLoc->mPath.c_str(), &s) != 0) #else // HAVE_STRUCT_STATVFS_F_MNTONNAME struct statfs s; - if(::statfs(ploc->mPath.c_str(), &s) != 0) + if(::statfs(apLoc->mPath.c_str(), &s) != 0) #endif // HAVE_STRUCT_STATVFS_F_MNTONNAME { - BOX_WARNING("Failed to stat location: " - << ploc->mPath - << ": " << strerror(errno)); - THROW_EXCEPTION(CommonException, - OSFileError) + BOX_WARNING("Failed to stat location " + "path '" << apLoc->mPath << + "' (" << strerror(errno) << + "), skipping location '" << + apLoc->mName << "'"); + continue; } // Where the filesystem is mounted @@ -1715,10 +1718,10 @@ #else // !HAVE_STRUCT_STATFS_F_MNTONNAME && !WIN32 // Warn in logs if the directory isn't absolute - if(ploc->mPath[0] != '/') + if(apLoc->mPath[0] != '/') { BOX_WARNING("Location path '" - << ploc->mPath + << apLoc->mPath << "' is not absolute"); } // Go through the mount points found, and find a suitable one @@ -1733,7 +1736,7 @@ // If it matches, the file belongs in that mount point // (sorting order ensures this) BOX_TRACE("checking against mount point " << *i); - if(::strncmp(i->c_str(), ploc->mPath.c_str(), i->size()) == 0) + if(::strncmp(i->c_str(), apLoc->mPath.c_str(), i->size()) == 0) { // Match mountName = *i; @@ -1741,7 +1744,7 @@ } } BOX_TRACE("mount point chosen for " - << ploc->mPath << " is " + << apLoc->mPath << " is " << mountName); } @@ -1752,12 +1755,12 @@ if(f != mounts.end()) { // Yes -- store the index - ploc->mIDMapIndex = f->second; + apLoc->mIDMapIndex = f->second; } else { // No -- new index - ploc->mIDMapIndex = numIDMaps; + apLoc->mIDMapIndex = numIDMaps; mounts[mountName] = numIDMaps; // Store the mount name @@ -1777,7 +1780,7 @@ BackupClientFileAttributes attr; try { - attr.ReadAttributes(ploc->mPath.c_str(), + attr.ReadAttributes(apLoc->mPath.c_str(), true /* directories have zero mod times */, 0 /* not interested in mod time */, &attrModTime /* get the attribute modification time */); @@ -1785,8 +1788,9 @@ catch (BoxException &e) { BOX_ERROR("Failed to get attributes " - "for path '" << ploc->mPath - << "', skipping."); + "for path '" << apLoc->mPath + << "', skipping location '" << + apLoc->mName << "'"); continue; } @@ -1794,7 +1798,8 @@ try { MemBlockStream attrStream(attr); - std::auto_ptr dirCreate(connection.QueryCreateDirectory( + std::auto_ptr + dirCreate(connection.QueryCreateDirectory( BackupProtocolClientListDirectory::RootDirectory, attrModTime, dirname, attrStream)); @@ -1804,8 +1809,9 @@ catch (BoxException &e) { BOX_ERROR("Failed to create remote " - "directory '/" << ploc->mName << - "', skipping location."); + "directory '/" << apLoc->mName << + "', skipping location '" << + apLoc->mName << "'"); continue; } @@ -1814,31 +1820,25 @@ // Create and store the directory object for the root of this location ASSERT(oid != 0); BackupClientDirectoryRecord *precord = new BackupClientDirectoryRecord(oid, i->first); - ploc->mpDirectoryRecord.reset(precord); + apLoc->mpDirectoryRecord.reset(precord); // Push it back on the vector of locations - mLocations.push_back(ploc); + mLocations.push_back(apLoc.release()); } catch (std::exception &e) { BOX_ERROR("Failed to configure location '" - << ploc->mName << "' path '" - << ploc->mPath << "': " << e.what() << + << apLoc->mName << "' path '" + << apLoc->mPath << "': " << e.what() << ": please check for previous errors"); - delete ploc; - ploc = 0; throw; } catch(...) { BOX_ERROR("Failed to configure location '" - << ploc->mName << "' path '" - << ploc->mPath << "': please check for " + << apLoc->mName << "' path '" + << apLoc->mPath << "': please check for " "previous errors"); - - delete ploc; - ploc = NULL; - throw; } } From boxbackup-dev at fluffy.co.uk Wed Sep 12 14:21:17 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 12 Sep 2007 13:21:17 -0000 Subject: [Box Backup-commit] #43: Cannot create BackupLocations with path in international characters Message-ID: <060.e46e71c05bea5db423ac59797919a27d@fluffy.co.uk> #43: Cannot create BackupLocations with path in international characters ----------------------------+----------------------------------------------- Reporter: vit at trs.sut.ru | Owner: ben Type: defect | Status: new Priority: critical | Milestone: Component: bbackupd | Version: 0.10 Keywords: | ----------------------------+----------------------------------------------- Applied to boxbackup-chris_general_1822-backup-client-mingw32 If Path in BackupLocations section contains international characters bbackupd raise error messages: WARNING: Failed to stat location: c:\: No such file or directory WARNING: Exception thrown: CommonException(OSFileError) at BackupDaemon.cpp(1709) ERROR: Failed to configure location 'IntnlTestDocuments' path 'e:\intnl_chars>': Common OSFileError (Error accessing a file. Check permissions.): please check for previous errors -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Thu Sep 13 20:36:02 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 13 Sep 2007 20:36:02 +0100 Subject: [Box Backup-commit] COMMIT r1829 - box/chris/general/bin/bbackupd/win32 Message-ID: Author: chris Date: 2007-09-13 20:36:01 +0100 (Thu, 13 Sep 2007) New Revision: 1829 Modified: box/chris/general/bin/bbackupd/win32/bbackupd.conf Log: Update to match improved comments generated by bbackupd-config in recent versions. Increase maximum diffing time to 120 seconds (from 20). Enable KeepAliveTime by default and set to 120 seconds. Link to James O'Gorman's NotifySysAdmin.vbs VBScript which works on Windows, replacing the default shell script. Modified: box/chris/general/bin/bbackupd/win32/bbackupd.conf =================================================================== --- box/chris/general/bin/bbackupd/win32/bbackupd.conf 2007-09-08 13:03:50 UTC (rev 1828) +++ box/chris/general/bin/bbackupd/win32/bbackupd.conf 2007-09-13 19:36:01 UTC (rev 1829) @@ -12,35 +12,64 @@ # If you do not install it in the default location - also do not forget to # change the pid file location (below) - -# This script is run whenever bbackupd encounters a problem which requires -# the system administrator to assist: +# This script is run whenever bbackupd changes state or encounters a +# problem which requires the system administrator to assist: +# # 1) The store is full, and no more data can be uploaded. # 2) Some files or directories were not readable. -# The default script emails the system administrator. +# 3) A backup run starts or finishes. +# +# The default script emails the system administrator, except for backups +# starting and stopping, where it does nothing. +# +# NOTE: If your client does not run a local SMTP server then you MUST +# edit this script and uncomment the lines near the end, which specify +# the remote SMTP server to use for sending mail. -# NotifyScript = NotifySysadmin.sh +NotifyScript = cscript "C:\Program Files\Box Backup\NotifySysAdmin.vbs" -# A scan of the local discs will be made once an hour (approximately). -# To avoid cycles of load on the server, this time is randomly adjusted by a small +# The number of seconds between backup runs under normal conditions. To avoid +# cycles of load on the server, this time is randomly adjusted by a small # percentage as the daemon runs. UpdateStoreInterval = 3600 -# A file must have been modified at least 6 hours ago before it will be uploaded. +# The minimum age of a file, in seconds, that will be uploaded. Avoids +# repeated uploads of a file which is constantly being modified. MinimumFileAge = 21600 -# If a file is modified repeated, it won't be uploaded immediately in case it's modified again. -# However, it should be uploaded eventually. This is how long we should wait after first noticing -# a change. (1 day) +# If a file is modified repeated, it won't be uploaded immediately in case +# it's modified again, due to the MinimumFileAge specified above. However, it +# should be uploaded eventually even if it is being modified repeatedly. This +# is how long we should wait, in seconds, after first noticing a change. +# (86400 seconds = 1 day) MaxUploadWait = 86400 +# If the connection is idle for some time (e.g. over 10 minutes or 600 +# seconds, not sure exactly how long) then the server will give up and +# disconnect the client, resulting in Connection Protocol_Timeout errors +# on the server and TLSReadFailed or TLSWriteFailed errors on the client. +# Also, some firewalls and NAT gateways will kill idle connections after +# similar lengths of time. +# +# This can happen for example when most files are backed up already and +# don't need to be sent to the store again, while scanning a large +# directory, or while calculating diffs of a large file. To avoid this, +# KeepAliveTime specifies that special keep-alive messages should be sent +# when the connection is otherwise idle for a certain length of time, +# specified here in seconds. +# +# The default is that these messages are never sent, equivalent to setting +# this option to zero, but we recommend that all users enable this. +KeepAliveTime = 120 + + # Files above this size (in bytes) are tracked, and if they are renamed they will simply be # renamed on the server, rather than being uploaded again. (64k - 1) @@ -53,30 +82,38 @@ DiffingUploadSizeThreshold = 8192 -# The limit on how much time is spent diffing files. Most files shouldn't take very long, -# but if you have really big files you can use this to limit the time spent diffing them. +# The limit on how much time is spent diffing files, in seconds. Most files +# shouldn't take very long, but if you have really big files you can use this +# to limit the time spent diffing them. +# # * Reduce if you are having problems with processor usage. -# * Increase if you have large files, and think the upload of changes is too large and want -# to spend more time searching for unchanged blocks. +# +# * Increase if you have large files, and think the upload of changes is too +# large and you want bbackupd to spend more time searching for unchanged +# blocks. -MaximumDiffingTime = 20 +MaximumDiffingTime = 120 -# KeepAliveTime requires Gary's SSL KeepAlive patches -# KeepAliveTime = 250 # Uncomment this line to see exactly what the daemon is going when it's connected to the server. # ExtendedLogging = yes -# Use this to temporarily stop bbackupd from syncronising or connecting to the store. -# This specifies a program or script script which is run just before each sync, and ideally -# the full path to the interpreter. It will be run as the same user bbackupd is running as, -# usually root. -# The script prints either "now" or a number to STDOUT (and a terminating newline, no quotes). -# If the result was "now", then the sync will happen. If it's a number, then the script will -# be asked again in that number of seconds. -# For example, you could use this on a laptop to only backup when on a specific network. +# This specifies a program or script script which is run just before each +# sync, and ideally the full path to the interpreter. It will be run as the +# same user bbackupd is running as, usually root. +# +# The script must output (print) either "now" or a number to STDOUT (and a +# terminating newline, no quotes). +# +# If the result was "now", then the sync will happen. If it's a number, then +# no backup will happen for that number of seconds (bbackupd will pause) and +# then the script will be run again. +# +# Use this to temporarily stop bbackupd from syncronising or connecting to the +# store. For example, you could use this on a laptop to only backup when on a +# specific network, or when it has a working Internet connection. # SyncAllowScript = /path/to/intepreter/or/exe script-name parameters etc @@ -85,16 +122,21 @@ CommandSocket = pipe +# Uncomment the StoreObjectInfoFile to enable the experimental archiving +# of the daemon's state (including client store marker and configuration) +# between backup runs. This saves time and increases efficiency when +# bbackupd is frequently stopped and started, since it removes the need +# to rescan all directories on the remote server. However, it is new and +# not yet heavily tested, so use with caution. +# StoreObjectInfoFile = C:\Program Files\Box Backup\bbackupd\bbackupd.state + Server { PidFile = C:\Program Files\Box Backup\bbackupd\bbackupd.pid } -# StoreObjectInfoFile requires Gary's client marker serialisation patch -# StoreObjectInfoFile = C:\Program Files\Box Backup\bbackupd\bbackupd.dat -# # BackupLocations specifies which locations on disc should be backed up. Each # directory is in the format # @@ -123,15 +165,31 @@ # files, except one MP3 file in particular. # # In general, Exclude excludes a file or directory, unless the directory is -# explicitly mentioned in a AlwaysInclude directive. +# explicitly mentioned in a AlwaysInclude directive. However, Box Backup +# does NOT scan inside excluded directories and will never back up an +# AlwaysIncluded file or directory inside an excluded directory or any +# subdirectory thereof. +# +# To back up a directory inside an excluded directory, use a configuration +# like this, to ensure that each directory in the path to the important +# files is included, but none of their contents will be backed up except +# the directories futher down that path to the important one. +# +# ExcludeDirsRegex = /home/user/bigfiles/.* +# ExcludeFilesRegex = /home/user/bigfiles/.* +# AlwaysIncludeDir = /home/user/bigfiles/path +# AlwaysIncludeDir = /home/user/bigfiles/path/to +# AlwaysIncludeDir = /home/user/bigfiles/path/important +# AlwaysIncludeDir = /home/user/bigfiles/path/important/files +# AlwaysIncludeDirsRegex = /home/user/bigfiles/path/important/files/.* +# AlwaysIncludeFilesRegex = /home/user/bigfiles/path/important/files/.* # -# If a directive ends in Regex, then it is a regular expression rather than a +# If a directive ends in Regex, then it is a regular expression rather than a # explicit full pathname. See # # man 7 re_format # # for the regex syntax on your platform. -# BackupLocations { From boxbackup-dev at fluffy.co.uk Fri Sep 14 19:43:06 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 14 Sep 2007 19:43:06 +0100 Subject: [Box Backup-commit] COMMIT r1830 - box/chris/general/bin/bbackupd/win32 Message-ID: Author: chris Date: 2007-09-14 19:43:06 +0100 (Fri, 14 Sep 2007) New Revision: 1830 Added: box/chris/general/bin/bbackupd/win32/NotifySysAdmin.vbs Log: Add script to notify sysadmin by email on backup failure on Win32, thanks to James O'Gorman. Added: box/chris/general/bin/bbackupd/win32/NotifySysAdmin.vbs =================================================================== --- box/chris/general/bin/bbackupd/win32/NotifySysAdmin.vbs (rev 0) +++ box/chris/general/bin/bbackupd/win32/NotifySysAdmin.vbs 2007-09-14 18:43:06 UTC (rev 1830) @@ -0,0 +1,83 @@ +Dim hostname +Dim account +Dim from +Dim sendto +Dim subjtmpl +Dim subject +Dim body +Dim smtpserver + +Set WshNet = CreateObject("WScript.Network") +hostname = WshNet.ComputerName + +account = "0a1" +from = "boxbackup@" & hostname +sendto = "admin at example.com" +subjtmpl = "BACKUP PROBLEM on host " & hostname +smtpserver = "smtp.example.com" + +Set args = WScript.Arguments + +If args(0) = "store-full" Then + subject = subjtmpl & " (store full)" + body = "The store account for "&hostname&" is full." & vbCrLf & vbCrLf & _ + "=============================" & vbCrLf & _ + "FILES ARE NOT BEING BACKED UP" & vbCrLf & _ + "=============================" & vbCrLf & vbCrLf & _ + "Please adjust the limits on account "&account&" on server "&hostname&"." _ + & vbCrLf + SendMail from,sendto,subject,body +ElseIf args(0) = "read-error" Then + subject = subjtmpl & " (read errors)" + body = "Errors occured reading some files or directories for backup on "&hostname&"." _ + & vbCrLf & vbCrLf & _ + "===================================" & vbCrLf & _ + "THESE FILES ARE NOT BEING BACKED UP" & vbCrLf & _ + "===================================" & vbCrLf & vbCrLf & _ + "Check the logs on "&hostname&" for the files and directories which caused" & _ + "these errors, and take appropraite action." & vbCrLf & vbCrLf & _ + "Other files are being backed up." & vbCrLf + SendMail from,sendto,subject,body +ElseIf args(0) = "backup-start" Or args(0) = "backup-finish" Then + ' do nothing for these messages by default +Else + subject = subjtmpl & " (unknown)" + body = "The backup daemon on "&hostname&" reported an unknown error." _ + & vbCrLf & vbCrLf & _ + "==========================" & vbCrLf & _ + "FILES MAY NOT BE BACKED UP" & vbCrLf & _ + "==========================" & vbCrLf & vbCrLf & _ + "Please check the logs on "&hostname&"." & vbCrLf + SendMail from,sendto,subject,body +End If + +Function CheckSMTPSvc() + Set objWMISvc = GetObject("winmgmts:" _ + & "{impersonationLevel=impersonate}!\\.\root\cimv2") + Set colSMTPSvc = objWMISvc.ExecQuery("Select * From Win32_Service " _ + & "Where Name='SMTPSVC'") + If colSMTPSvc.Count > 0 Then + CheckSMTPSvc = True + Else + CheckSMTPSvc = False + End If +End Function + +Sub SendMail(from,sendto,subject,body) + Set objEmail = CreateObject("CDO.Message") + Dim cdoschema + cdoschema = "http://schemas.microsoft.com/cdo/configuration/" + With objEmail + .From = from + .To = sendto + .Subject = subject + .TextBody = body + If CheckSMTPSvc = False Then + .Configuration.Fields.Item(cdoschema & "sendusing") = 2 + .Configuration.Fields.Item(cdoschema & "smtpserver") = smtpserver + .Configuration.Fields.Item(cdoschema & "smtpserverport") = 25 + .Configuration.Fields.Update + End If + End With + objEmail.Send +End Sub From boxbackup-dev at fluffy.co.uk Fri Sep 14 22:23:23 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 14 Sep 2007 22:23:23 +0100 Subject: [Box Backup-commit] COMMIT r1831 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2007-09-14 22:23:23 +0100 (Fri, 14 Sep 2007) New Revision: 1831 Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp Log: Don't initialise the command socket thread (on Win32) until the configuration is known. Create the command socket (on Win32) with the specified pipe name in the configuration file. Commonise some code between Windows and Unix daemon startup. Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-14 18:43:06 UTC (rev 1830) +++ box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-14 21:23:23 UTC (rev 1831) @@ -126,42 +126,33 @@ mNotificationsSent[l] = false; } -#ifdef WIN32 - // Create the event object to signal from main thread to worker - // when new messages are queued to be sent to the command socket. - mhMessageToSendEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - if(mhMessageToSendEvent == INVALID_HANDLE_VALUE) - { - BOX_ERROR("Failed to create event object: error " << - GetLastError()); - exit(1); - } + #ifdef WIN32 + // Create the event object to signal from main thread to + // worker when new messages are queued to be sent to the + // command socket. - // Create the event object to signal from worker to main thread - // when a command has been received on the command socket. - mhCommandReceivedEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - if(mhCommandReceivedEvent == INVALID_HANDLE_VALUE) - { - BOX_ERROR("Failed to create event object: error " << - GetLastError()); - exit(1); - } + mhMessageToSendEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + if(mhMessageToSendEvent == INVALID_HANDLE_VALUE) + { + BOX_ERROR("Failed to create event object: error " << + GetLastError()); + exit(1); + } - // Create the critical section to protect the message queue - InitializeCriticalSection(&mMessageQueueLock); + // Create the event object to signal from worker to main thread + // when a command has been received on the command socket. - // Create a thread to handle the named pipe - HANDLE hThread; - unsigned int dwThreadId; + mhCommandReceivedEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + if(mhCommandReceivedEvent == INVALID_HANDLE_VALUE) + { + BOX_ERROR("Failed to create event object: error " << + GetLastError()); + exit(1); + } - hThread = (HANDLE) _beginthreadex( - NULL, // default security attributes - 0, // use default stack size - HelperThread, // thread function - this, // argument to thread function - 0, // use default creation flags - &dwThreadId); // returns the thread identifier -#endif + // Create the critical section to protect the message queue + InitializeCriticalSection(&mMessageQueueLock); + #endif } // -------------------------------------------------------------------------- @@ -287,6 +278,7 @@ #ifdef WIN32 void BackupDaemon::RunHelperThread(void) { + const Configuration &conf(GetConfiguration()); mpCommandSocketInfo = new CommandSocketInfo; WinNamedPipeStream& rSocket(mpCommandSocketInfo->mListeningSocket); @@ -296,7 +288,8 @@ { try { - rSocket.Accept(BOX_NAMED_PIPE_NAME); + std::string socket = conf.GetKeyValue("CommandSocket"); + rSocket.Accept(socket); } catch (BoxException &e) { @@ -331,7 +324,6 @@ // Send a header line summarising the configuration // and current state - const Configuration &conf(GetConfiguration()); char summary[256]; size_t summarySize = sprintf(summary, "bbackupd: %d %d %d %d\nstate %d\n", @@ -512,31 +504,37 @@ // initialise global timer mechanism Timers::Init(); -#ifdef WIN32 - try - { - Run2(); - } - catch(...) - { - Timers::Cleanup(); - throw; - } -#else // ! WIN32 - // Ignore SIGPIPE (so that if a command connection is broken, the daemon doesn't terminate) - ::signal(SIGPIPE, SIG_IGN); + #ifdef WIN32 + // Create a thread to handle the named pipe + HANDLE hThread; + unsigned int dwThreadId; - // Create a command socket? - const Configuration &conf(GetConfiguration()); - if(conf.KeyExists("CommandSocket")) - { - // Yes, create a local UNIX socket - mpCommandSocketInfo = new CommandSocketInfo; - const char *socketName = conf.GetKeyValue("CommandSocket").c_str(); - ::unlink(socketName); - mpCommandSocketInfo->mListeningSocket.Listen(Socket::TypeUNIX, socketName); - } + hThread = (HANDLE) _beginthreadex( + NULL, // default security attributes + 0, // use default stack size + HelperThread, // thread function + this, // argument to thread function + 0, // use default creation flags + &dwThreadId); // returns the thread identifier + #else + // Ignore SIGPIPE so that if a command connection is broken, + // the daemon doesn't terminate. + ::signal(SIGPIPE, SIG_IGN); + // Create a command socket? + const Configuration &conf(GetConfiguration()); + if(conf.KeyExists("CommandSocket")) + { + // Yes, create a local UNIX socket + mpCommandSocketInfo = new CommandSocketInfo; + const char *socketName = + conf.GetKeyValue("CommandSocket").c_str(); + ::unlink(socketName); + mpCommandSocketInfo->mListeningSocket.Listen( + Socket::TypeUNIX, socketName); + } + #endif // !WIN32 + // Handle things nicely on exceptions try { @@ -544,6 +542,11 @@ } catch(...) { + #ifdef WIN32 + // Don't delete the socket, as the helper thread + // is probably still using it. Let Windows clean + // up after us. + #else if(mpCommandSocketInfo != 0) { try @@ -563,19 +566,21 @@ } mpCommandSocketInfo = 0; } + #endif // WIN32 Timers::Cleanup(); throw; } - // Clean up - if(mpCommandSocketInfo != 0) - { - delete mpCommandSocketInfo; - mpCommandSocketInfo = 0; - } -#endif + #ifndef WIN32 + // Clean up + if(mpCommandSocketInfo != 0) + { + delete mpCommandSocketInfo; + mpCommandSocketInfo = 0; + } + #endif Timers::Cleanup(); } From boxbackup-dev at fluffy.co.uk Fri Sep 14 22:24:23 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 14 Sep 2007 22:24:23 +0100 Subject: [Box Backup-commit] COMMIT r1832 - box/chris/general/bin/bbackupctl Message-ID: Author: chris Date: 2007-09-14 22:24:23 +0100 (Fri, 14 Sep 2007) New Revision: 1832 Modified: box/chris/general/bin/bbackupctl/bbackupctl.cpp Log: Pass the command socket name from the configuration to WinNamedPipeStream, to allow multiple command sockets per system. Remove unnecessary newlines from log messages. Modified: box/chris/general/bin/bbackupctl/bbackupctl.cpp =================================================================== --- box/chris/general/bin/bbackupctl/bbackupctl.cpp 2007-09-14 21:23:23 UTC (rev 1831) +++ box/chris/general/bin/bbackupctl/bbackupctl.cpp 2007-09-14 21:24:23 UTC (rev 1832) @@ -145,7 +145,8 @@ try { #ifdef WIN32 - connection.Connect(BOX_NAMED_PIPE_NAME); + std::string socket = conf.GetKeyValue("CommandSocket"); + connection.Connect(socket); #else connection.Open(Socket::TypeUNIX, conf.GetKeyValue("CommandSocket").c_str()); #endif @@ -200,7 +201,7 @@ " UpdateStoreInterval = " << updateStoreInterval << " seconds\n" " MinimumFileAge = " << minimumFileAge << " seconds\n" - " MaxUploadWait = " << maxUploadWait << " seconds\n"); + " MaxUploadWait = " << maxUploadWait << " seconds"); } std::string stateLine; @@ -312,7 +313,7 @@ { if (syncIsRunning) { - if (!quiet) BOX_INFO("Sync finished.\n"); + if (!quiet) BOX_INFO("Sync finished."); // Send a quit command to finish nicely connection.Write("quit\n", 5); @@ -335,7 +336,7 @@ { if(!quiet) { - BOX_INFO("Succeeded.\n"); + BOX_INFO("Succeeded."); } finished = true; } From boxbackup-dev at fluffy.co.uk Fri Sep 14 22:25:42 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 14 Sep 2007 22:25:42 +0100 Subject: [Box Backup-commit] COMMIT r1833 - box/chris/general/lib/server Message-ID: Author: chris Date: 2007-09-14 22:25:42 +0100 (Fri, 14 Sep 2007) New Revision: 1833 Modified: box/chris/general/lib/server/WinNamedPipeStream.cpp box/chris/general/lib/server/WinNamedPipeStream.h Log: Prepend the system-required prefix to the named pipe name from the configuration file. Modified: box/chris/general/lib/server/WinNamedPipeStream.cpp =================================================================== --- box/chris/general/lib/server/WinNamedPipeStream.cpp 2007-09-14 21:24:23 UTC (rev 1832) +++ box/chris/general/lib/server/WinNamedPipeStream.cpp 2007-09-14 21:25:42 UTC (rev 1833) @@ -26,6 +26,8 @@ #include "MemLeakFindOn.h" +std::string WinNamedPipeStream::sPipeNamePrefix = "\\\\.\\pipe\\"; + // -------------------------------------------------------------------------- // // Function @@ -72,21 +74,23 @@ // -------------------------------------------------------------------------- // // Function -// Name: WinNamedPipeStream::Accept(const char* Name) +// Name: WinNamedPipeStream::Accept(const std::string& rName) // Purpose: Creates a new named pipe with the given name, // and wait for a connection on it // Created: 2005/12/07 // // -------------------------------------------------------------------------- -void WinNamedPipeStream::Accept(const wchar_t* pName) +void WinNamedPipeStream::Accept(const std::string& rName) { if (mSocketHandle != INVALID_HANDLE_VALUE || mIsConnected) { THROW_EXCEPTION(ServerException, SocketAlreadyOpen) } - mSocketHandle = CreateNamedPipeW( - pName, // pipe name + std::string socket = sPipeNamePrefix + rName; + + mSocketHandle = CreateNamedPipeA( + socket.c_str(), // pipe name PIPE_ACCESS_DUPLEX | // read/write access FILE_FLAG_OVERLAPPED, // enabled overlapped I/O PIPE_TYPE_BYTE | // message type pipe @@ -100,7 +104,7 @@ if (mSocketHandle == INVALID_HANDLE_VALUE) { - BOX_ERROR("Failed to CreateNamedPipeW(" << pName << "): " << + BOX_ERROR("Failed to CreateNamedPipeA(" << socket << "): " << GetErrorMessage(GetLastError())); THROW_EXCEPTION(ServerException, SocketOpenError) } @@ -109,7 +113,7 @@ if (!connected) { - BOX_ERROR("Failed to ConnectNamedPipe(" << pName << "): " << + BOX_ERROR("Failed to ConnectNamedPipe(" << socket << "): " << GetErrorMessage(GetLastError())); Close(); THROW_EXCEPTION(ServerException, SocketOpenError) @@ -156,20 +160,22 @@ // -------------------------------------------------------------------------- // // Function -// Name: WinNamedPipeStream::Connect(const char* Name) +// Name: WinNamedPipeStream::Connect(const std::string& rName) // Purpose: Opens a connection to a listening named pipe // Created: 2005/12/07 // // -------------------------------------------------------------------------- -void WinNamedPipeStream::Connect(const wchar_t* pName) +void WinNamedPipeStream::Connect(const std::string& rName) { if (mSocketHandle != INVALID_HANDLE_VALUE || mIsConnected) { THROW_EXCEPTION(ServerException, SocketAlreadyOpen) } + + std::string socket = sPipeNamePrefix + rName; - mSocketHandle = CreateFileW( - pName, // pipe name + mSocketHandle = CreateFileA( + socket.c_str(), // pipe name GENERIC_READ | // read and write access GENERIC_WRITE, 0, // no sharing Modified: box/chris/general/lib/server/WinNamedPipeStream.h =================================================================== --- box/chris/general/lib/server/WinNamedPipeStream.h 2007-09-14 21:24:23 UTC (rev 1832) +++ box/chris/general/lib/server/WinNamedPipeStream.h 2007-09-14 21:25:42 UTC (rev 1833) @@ -27,10 +27,10 @@ ~WinNamedPipeStream(); // server side - create the named pipe and listen for connections - void Accept(const wchar_t* Name); + void Accept(const std::string& rName); // client side - connect to a waiting server - void Connect(const wchar_t* Name); + void Connect(const std::string& rName); // both sides virtual int Read(void *pBuffer, int NBytes, @@ -61,6 +61,8 @@ bool mWriteClosed; bool mIsServer; bool mIsConnected; + + static std::string sPipeNamePrefix; }; #endif // WINNAMEDPIPESTREAM__H From boxbackup-dev at fluffy.co.uk Fri Sep 14 22:25:58 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 14 Sep 2007 22:25:58 +0100 Subject: [Box Backup-commit] COMMIT r1834 - box/chris/general/lib/server Message-ID: Author: chris Date: 2007-09-14 22:25:58 +0100 (Fri, 14 Sep 2007) New Revision: 1834 Modified: box/chris/general/lib/server/Daemon.cpp Log: Don't disable logging on Win32 console. Modified: box/chris/general/lib/server/Daemon.cpp =================================================================== --- box/chris/general/lib/server/Daemon.cpp 2007-09-14 21:25:42 UTC (rev 1833) +++ box/chris/general/lib/server/Daemon.cpp 2007-09-14 21:25:58 UTC (rev 1834) @@ -439,12 +439,12 @@ { ::close(devnull); } -#endif // ! WIN32 // And definitely don't try and send anything to those file descriptors // -- this has in the past sent text to something which isn't expecting it. TRACE_TO_STDOUT(false); Logging::ToConsole(false); +#endif // ! WIN32 } } catch(BoxException &e) From boxbackup-dev at fluffy.co.uk Fri Sep 14 23:11:30 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 14 Sep 2007 23:11:30 +0100 Subject: [Box Backup-commit] COMMIT r1835 - box/chris/general/lib/common Message-ID: Author: chris Date: 2007-09-14 23:11:30 +0100 (Fri, 14 Sep 2007) New Revision: 1835 Modified: box/chris/general/lib/common/BoxPortsAndFiles.h Log: Remove default pipe name to prevent applications from using it. Modified: box/chris/general/lib/common/BoxPortsAndFiles.h =================================================================== --- box/chris/general/lib/common/BoxPortsAndFiles.h 2007-09-14 21:25:58 UTC (rev 1834) +++ box/chris/general/lib/common/BoxPortsAndFiles.h 2007-09-14 22:11:30 UTC (rev 1835) @@ -36,8 +36,5 @@ #define BOX_FILE_BBSTORED_DEFAULT_CONFIG "/etc/box/bbstored.conf" #endif -// Default name of the named pipe -#define BOX_NAMED_PIPE_NAME L"\\\\.\\pipe\\boxbackup" - #endif // BOXPORTSANDFILES__H From boxbackup-dev at fluffy.co.uk Fri Sep 14 23:12:28 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 14 Sep 2007 23:12:28 +0100 Subject: [Box Backup-commit] COMMIT r1836 - box/chris/general/lib/server Message-ID: Author: chris Date: 2007-09-14 23:12:28 +0100 (Fri, 14 Sep 2007) New Revision: 1836 Modified: box/chris/general/lib/server/ServerControl.h Log: Added function to set the named pipe name, for use by any test which calls HUPServer() or SendCommands(). Modified: box/chris/general/lib/server/ServerControl.h =================================================================== --- box/chris/general/lib/server/ServerControl.h 2007-09-14 22:11:30 UTC (rev 1835) +++ box/chris/general/lib/server/ServerControl.h 2007-09-14 22:12:28 UTC (rev 1836) @@ -9,17 +9,24 @@ #include "IOStreamGetLine.h" #include "BoxPortsAndFiles.h" +static std::string sPipeName; + +static void SetNamedPipeName(const std::string& rPipeName) +{ + sPipeName = rPipeName; +} + static bool SendCommands(const std::string& rCmd) { WinNamedPipeStream connection; try { - connection.Connect(BOX_NAMED_PIPE_NAME); + connection.Connect(sPipeName); } catch(...) { - printf("Failed to connect to daemon control socket.\n"); + BOX_ERROR("Failed to connect to daemon control socket"); return false; } @@ -30,14 +37,14 @@ std::string configSummary; if(!getLine.GetLine(configSummary)) { - printf("Failed to receive configuration summary from daemon\n"); + BOX_ERROR("Failed to receive configuration summary from daemon"); return false; } // Was the connection rejected by the server? if(getLine.IsEOF()) { - printf("Server rejected the connection.\n"); + BOX_ERROR("Server rejected the connection"); return false; } @@ -47,7 +54,7 @@ &autoBackup, &updateStoreInterval, &minimumFileAge, &maxUploadWait) != 4) { - printf("Config summary didn't decode\n"); + BOX_ERROR("Config summary didn't decode"); return false; } @@ -81,13 +88,13 @@ } else if (line == "error") { - printf("ERROR (%s)\n", rCmd.c_str()); + BOX_ERROR(rCmd); break; } else { - printf("WARNING: Unexpected response to command '%s': " - "%s", rCmd.c_str(), line.c_str()); + BOX_WARNING("Unexpected response to command '" << + rCmd << "': " << line) } } @@ -104,15 +111,15 @@ HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, false, pid); if (hProcess == NULL) { - printf("Failed to open process %d: error %d\n", - pid, (int)GetLastError()); + BOX_ERROR("Failed to open process " << pid << ": " << + GetErrorMessage(GetLastError())); return false; } if (!TerminateProcess(hProcess, 1)) { - printf("Failed to terminate process %d: error %d\n", - pid, (int)GetLastError()); + BOX_ERROR("Failed to terminate process " << pid << ": " << + GetErrorMessage(GetLastError())); CloseHandle(hProcess); return false; } From boxbackup-dev at fluffy.co.uk Fri Sep 14 23:15:18 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 14 Sep 2007 23:15:18 +0100 Subject: [Box Backup-commit] COMMIT r1837 - box/chris/general/bin/bbackupd/win32 Message-ID: Author: chris Date: 2007-09-14 23:15:18 +0100 (Fri, 14 Sep 2007) New Revision: 1837 Modified: box/chris/general/bin/bbackupd/win32/NotifySysAdmin.vbs Log: Log an error in the System Event Log if sending email fails. Modified: box/chris/general/bin/bbackupd/win32/NotifySysAdmin.vbs =================================================================== --- box/chris/general/bin/bbackupd/win32/NotifySysAdmin.vbs 2007-09-14 22:12:28 UTC (rev 1836) +++ box/chris/general/bin/bbackupd/win32/NotifySysAdmin.vbs 2007-09-14 22:15:18 UTC (rev 1837) @@ -65,8 +65,10 @@ Sub SendMail(from,sendto,subject,body) Set objEmail = CreateObject("CDO.Message") + Set WshShell = CreateObject("WScript.Shell") Dim cdoschema cdoschema = "http://schemas.microsoft.com/cdo/configuration/" + With objEmail .From = from .To = sendto @@ -79,5 +81,15 @@ .Configuration.Fields.Update End If End With - objEmail.Send + On Error Resume Next + rc = objEmail.Send + If rc Then + WshShell.Exec "eventcreate /L Application /ID 201 /T WARNING " _ + & "/SO ""Box Backup"" /D """ & args(0) _ + & " notification sent to " & sendto & ".""" + Else + WshShell.Exec "eventcreate /L Application /ID 202 /T ERROR " _ + & "/SO ""Box Backup"" /D ""Failed to send " & args(0) _ + & " notification to " & sendto & ".""" + End If End Sub From boxbackup-dev at fluffy.co.uk Fri Sep 14 23:27:24 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 14 Sep 2007 23:27:24 +0100 Subject: [Box Backup-commit] COMMIT r1838 - box/chris/general Message-ID: Author: chris Date: 2007-09-14 23:27:24 +0100 (Fri, 14 Sep 2007) New Revision: 1838 Modified: box/chris/general/parcels.txt Log: Add James O'Gorman's NotifySysAdmin.vbs script to client parcel on Win32. Modified: box/chris/general/parcels.txt =================================================================== --- box/chris/general/parcels.txt 2007-09-14 22:15:18 UTC (rev 1837) +++ box/chris/general/parcels.txt 2007-09-14 22:27:24 UTC (rev 1838) @@ -13,6 +13,7 @@ ONLY:mingw32,mingw32msvc script bin/bbackupd/win32/installer.iss script bin/bbackupd/win32/bbackupd.conf + script bin/bbackupd/win32/NotifySysAdmin.vbs END-ONLY ONLY:mingw32 From boxbackup-dev at fluffy.co.uk Fri Sep 14 23:37:33 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 14 Sep 2007 23:37:33 +0100 Subject: [Box Backup-commit] COMMIT r1839 - box/chris/win32/releases Message-ID: Author: chris Date: 2007-09-14 23:37:32 +0100 (Fri, 14 Sep 2007) New Revision: 1839 Added: box/chris/win32/releases/boxbackup-chris_general_1837-backup-client-mingw32.zip Log: New client release [1837], with the following new features: * Support multiple named pipes on Win32. * Don't disable logging on Win32 console. * Don't initialise the command socket thread (on Win32) until the configuration is known. * Commonise some code between Windows and Unix daemon startup. * Update bbackupd.conf to match improved comments and default settings in the Unix version generated by bbackupd-config. * Don't abort if one of the location paths doesn't exist, just print a warning and continue. * Use an auto_ptr to avoid memory leaks when setting up a location fails. Added: box/chris/win32/releases/boxbackup-chris_general_1837-backup-client-mingw32.zip =================================================================== (Binary files differ) Property changes on: box/chris/win32/releases/boxbackup-chris_general_1837-backup-client-mingw32.zip ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From boxbackup-dev at fluffy.co.uk Wed Sep 19 21:41:59 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 20:41:59 -0000 Subject: [Box Backup-commit] Re: #32: Windows client 1692 emits double version info In-Reply-To: <051.e8fa25b890179290c7cf97977b178f13@fluffy.co.uk> References: <051.e8fa25b890179290c7cf97977b178f13@fluffy.co.uk> Message-ID: <060.516f55612fd172c543ff5a0ada3953d6@fluffy.co.uk> #32: Windows client 1692 emits double version info ---------------------------+------------------------------------------------ Reporter: petej | Owner: Type: defect | Status: closed Priority: trivial | Milestone: 0.11 Component: bbackupquery | Version: 0.10 Resolution: fixed | Keywords: ---------------------------+------------------------------------------------ Changes (by chris): * status: new => closed * resolution: => fixed * milestone: => 0.11 Comment: Should be resolved in [1814] by [1784] [1790] [1806] [1809] [1810] [1811] [1814]. Please let me know if it's not. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 21:48:42 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 20:48:42 -0000 Subject: [Box Backup-commit] Re: #22: Windows client has old ReadMe.txt In-Reply-To: <051.72df631d519bd94fc141db16db3f47fb@fluffy.co.uk> References: <051.72df631d519bd94fc141db16db3f47fb@fluffy.co.uk> Message-ID: <060.5ffab7393247a4c2094aa99da9311c53@fluffy.co.uk> #22: Windows client has old ReadMe.txt ----------------------------+----------------------------------------------- Reporter: petej | Owner: pthomsen Type: defect | Status: closed Priority: minor | Milestone: Component: documentation | Version: 0.10 Resolution: fixed | Keywords: ----------------------------+----------------------------------------------- Changes (by chris): * status: new => closed * resolution: => fixed Comment: Should be fixed by [1655], thanks! -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 21:49:55 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 20:49:55 -0000 Subject: [Box Backup-commit] Re: #17: List files using wildcards In-Reply-To: <051.7063f5df64cfe771a605efaa49ea6c8f@fluffy.co.uk> References: <051.7063f5df64cfe771a605efaa49ea6c8f@fluffy.co.uk> Message-ID: <060.cd1fdd52653607e865c5c6c412ef3882@fluffy.co.uk> #17: List files using wildcards ---------------------------+------------------------------------------------ Reporter: chris | Owner: chris Type: task | Status: assigned Priority: normal | Milestone: 0.12 Component: bbackupquery | Version: 0.10 Resolution: | Keywords: windows list files matching wildcard ---------------------------+------------------------------------------------ Changes (by chris): * status: new => assigned * milestone: 0.11 => 0.12 Comment: Yes, but not for 0.11, sorry. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 21:52:00 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 21:52:00 +0100 Subject: [Box Backup-commit] COMMIT r1840 - box/chris/merge/infrastructure Message-ID: Author: chris Date: 2007-09-19 21:52:00 +0100 (Wed, 19 Sep 2007) New Revision: 1840 Modified: box/chris/merge/infrastructure/makeparcels.pl.in Log: Don't include the install-backup-client script in Windows builds, as it's pretty useless without Cygwin, and of marginal use with it (refs #24). Modified: box/chris/merge/infrastructure/makeparcels.pl.in =================================================================== --- box/chris/merge/infrastructure/makeparcels.pl.in 2007-09-14 22:37:32 UTC (rev 1839) +++ box/chris/merge/infrastructure/makeparcels.pl.in 2007-09-19 20:52:00 UTC (rev 1840) @@ -101,8 +101,12 @@ my $dir = parcel_dir($parcel); print MAKE "\ttest -d $dir || mkdir $dir\n"; - open SCRIPT,">parcels/scripts/install-$parcel" or die "Can't open installer script for $parcel for writing"; - print SCRIPT "#!/bin/sh\n\n"; + unless ($target_windows) + { + open SCRIPT,">parcels/scripts/install-$parcel" or die + "Can't open installer script for $parcel for writing"; + print SCRIPT "#!/bin/sh\n\n"; + } for(@{$parcel_contents{$parcel}}) { @@ -136,21 +140,34 @@ $name = $1; } - print SCRIPT "install $name $install_into_dir\n"; + unless ($target_windows) + { + print SCRIPT "install $name $install_into_dir\n"; + } } + + unless ($target_windows) + { + close SCRIPT; + chmod 0755,"parcels/scripts/install-$parcel"; + } - close SCRIPT; - - chmod 0755,"parcels/scripts/install-$parcel"; - my $root = parcel_root($parcel); - print MAKE "\tcp parcels/scripts/install-$parcel $dir\n"; + + unless ($target_windows) + { + print MAKE "\tcp parcels/scripts/install-$parcel $dir\n"; + } + print MAKE "\t(cd parcels; tar cf - $root | gzip -9 - > $root.tgz )\n"; print MAKE "\n"; - - print MAKE "install-$parcel:\n"; - print MAKE "\t(cd $dir; ./install-$parcel)\n\n"; + + unless ($target_windows) + { + print MAKE "install-$parcel:\n"; + print MAKE "\t(cd $dir; ./install-$parcel)\n\n"; + } } print MAKE <<__E; From boxbackup-dev at fluffy.co.uk Wed Sep 19 21:52:32 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 21:52:32 +0100 Subject: [Box Backup-commit] COMMIT r1841 - box/chris/general/infrastructure Message-ID: Author: chris Date: 2007-09-19 21:52:32 +0100 (Wed, 19 Sep 2007) New Revision: 1841 Modified: box/chris/general/infrastructure/makeparcels.pl.in Log: Don't include the install-backup-client script in Windows builds, as it's pretty useless without Cygwin, and of marginal use with it (refs #24). Modified: box/chris/general/infrastructure/makeparcels.pl.in =================================================================== --- box/chris/general/infrastructure/makeparcels.pl.in 2007-09-19 20:52:00 UTC (rev 1840) +++ box/chris/general/infrastructure/makeparcels.pl.in 2007-09-19 20:52:32 UTC (rev 1841) @@ -101,8 +101,12 @@ my $dir = parcel_dir($parcel); print MAKE "\ttest -d $dir || mkdir $dir\n"; - open SCRIPT,">parcels/scripts/install-$parcel" or die "Can't open installer script for $parcel for writing"; - print SCRIPT "#!/bin/sh\n\n"; + unless ($target_windows) + { + open SCRIPT,">parcels/scripts/install-$parcel" or die + "Can't open installer script for $parcel for writing"; + print SCRIPT "#!/bin/sh\n\n"; + } for(@{$parcel_contents{$parcel}}) { @@ -136,21 +140,34 @@ $name = $1; } - print SCRIPT "install $name $install_into_dir\n"; + unless ($target_windows) + { + print SCRIPT "install $name $install_into_dir\n"; + } } + + unless ($target_windows) + { + close SCRIPT; + chmod 0755,"parcels/scripts/install-$parcel"; + } - close SCRIPT; - - chmod 0755,"parcels/scripts/install-$parcel"; - my $root = parcel_root($parcel); - print MAKE "\tcp parcels/scripts/install-$parcel $dir\n"; + + unless ($target_windows) + { + print MAKE "\tcp parcels/scripts/install-$parcel $dir\n"; + } + print MAKE "\t(cd parcels; tar cf - $root | gzip -9 - > $root.tgz )\n"; print MAKE "\n"; - - print MAKE "install-$parcel:\n"; - print MAKE "\t(cd $dir; ./install-$parcel)\n\n"; + + unless ($target_windows) + { + print MAKE "install-$parcel:\n"; + print MAKE "\t(cd $dir; ./install-$parcel)\n\n"; + } } print MAKE <<__E; From boxbackup-dev at fluffy.co.uk Wed Sep 19 22:57:13 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 21:57:13 -0000 Subject: [Box Backup-commit] Re: #24: Extraneous files in Windows clients? In-Reply-To: <051.5e4c21ba25db2b0ee4bba2dac48ad3ba@fluffy.co.uk> References: <051.5e4c21ba25db2b0ee4bba2dac48ad3ba@fluffy.co.uk> Message-ID: <060.48a7a04df8d2f124b0d8b987fc9e39f2@fluffy.co.uk> #24: Extraneous files in Windows clients? ----------------------+----------------------------------------------------- Reporter: petej | Owner: Type: defect | Status: closed Priority: trivial | Milestone: 0.11 Component: scripts | Version: 0.10 Resolution: fixed | Keywords: ----------------------+----------------------------------------------------- Changes (by chris): * status: new => closed * resolution: => fixed * milestone: => 0.11 Comment: install-backup-client is useless, removed in [1840], thanks! bbackupd-config is of marginal utility, as there is no other way to generate certificates on Windows than using this script under Cygwin. The default configuration file has been improved in [1829]. I say we keep this script until we have something better for Windows. installer.iss is of marginal utility, as it may help anyone who wants to build an ISS installer for Box Backup. pcreposix.dll should no longer be required as of [1007] [1008]. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 22:58:03 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 22:58:03 +0100 Subject: [Box Backup-commit] COMMIT r1842 - box Message-ID: Author: chris Date: 2007-09-19 22:58:03 +0100 (Wed, 19 Sep 2007) New Revision: 1842 Removed: box/trunk/ Log: Remove trunk, to be replaced with chris/merge as agreed. From boxbackup-dev at fluffy.co.uk Wed Sep 19 22:58:24 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 22:58:24 +0100 Subject: [Box Backup-commit] COMMIT r1843 - in box: . chris Message-ID: Author: chris Date: 2007-09-19 22:58:24 +0100 (Wed, 19 Sep 2007) New Revision: 1843 Added: box/trunk/ Removed: box/chris/merge/ Log: Replace trunk with chris/merge. Copied: box/trunk (from rev 1842, box/chris/merge) From boxbackup-dev at fluffy.co.uk Wed Sep 19 22:59:41 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 21:59:41 -0000 Subject: [Box Backup-commit] Re: #3: Merge Win32 branch In-Reply-To: <051.40b7ac89331367bc827cfdd2095c441d@fluffy.co.uk> References: <051.40b7ac89331367bc827cfdd2095c441d@fluffy.co.uk> Message-ID: <060.8cb103741b2b2f07fc15502a78715277@fluffy.co.uk> #3: Merge Win32 branch -----------------------+---------------------------------------------------- Reporter: chris | Owner: chris Type: task | Status: closed Priority: normal | Milestone: 0.11 Component: bbackupd | Version: trunk Resolution: fixed | Keywords: windows win32 merge branch -----------------------+---------------------------------------------------- Changes (by chris): * status: new => closed * resolution: => fixed Comment: Trunk replaced with chris/merge in [1843]. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 23:01:03 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 22:01:03 -0000 Subject: [Box Backup-commit] Re: #25: No license.txt in boxbackup-chris_general_1569-backup-client-mingw32 In-Reply-To: <051.3f806d08d3af92fbb982cd6f77a0ba0f@fluffy.co.uk> References: <051.3f806d08d3af92fbb982cd6f77a0ba0f@fluffy.co.uk> Message-ID: <060.533db51645581d766395e37ff7c2ef9c@fluffy.co.uk> #25: No license.txt in boxbackup-chris_general_1569-backup-client-mingw32 ----------------------------+----------------------------------------------- Reporter: petej | Owner: chris Type: defect | Status: closed Priority: normal | Milestone: 0.11 Component: documentation | Version: 0.10 Resolution: fixed | Keywords: win32 documentation docs license ----------------------------+----------------------------------------------- Changes (by chris): * status: assigned => closed * resolution: => fixed Comment: Fixed by [1655], thanks! -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 23:02:00 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 22:02:00 -0000 Subject: [Box Backup-commit] Re: #19: bbackupd artificial block check prevents setting low or zero soft-limit In-Reply-To: <054.849ced234f734fd0a321affa989f724e@fluffy.co.uk> References: <054.849ced234f734fd0a321affa989f724e@fluffy.co.uk> Message-ID: <063.3192daba6e60eeb5d519ac9460fdfbd3@fluffy.co.uk> #19: bbackupd artificial block check prevents setting low or zero soft-limit -----------------------+---------------------------------------------------- Reporter: gniemcew | Owner: chris Type: defect | Status: closed Priority: normal | Milestone: 0.11 Component: bbackupd | Version: 0.10 Resolution: fixed | Keywords: soft-limit hard-limit threshold exceeded storage soft hard limit -----------------------+---------------------------------------------------- Changes (by chris): * status: assigned => closed * resolution: => fixed Comment: Fixed by Gary's patch, thanks! -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 23:03:25 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 22:03:25 -0000 Subject: [Box Backup-commit] Re: #33: "Failed to setup location" problem In-Reply-To: <051.fcdcfcd7fdc8011da5e79c0924f9c6dd@fluffy.co.uk> References: <051.fcdcfcd7fdc8011da5e79c0924f9c6dd@fluffy.co.uk> Message-ID: <060.75b9061be8da6c93e8fa4cf4164e2848@fluffy.co.uk> #33: "Failed to setup location" problem -----------------------+---------------------------------------------------- Reporter: petej | Owner: ben Type: defect | Status: closed Priority: major | Milestone: 0.11 Component: bbackupd | Version: 0.10 Resolution: fixed | Keywords: -----------------------+---------------------------------------------------- Changes (by chris): * status: new => closed * resolution: => fixed * milestone: => 0.11 Comment: Fixed with new logging framework and new LogAllFileAccess option. If you still have problems, let me know. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 23:04:27 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 22:04:27 -0000 Subject: [Box Backup-commit] Re: #43: Cannot create BackupLocations with path in international characters In-Reply-To: <060.e46e71c05bea5db423ac59797919a27d@fluffy.co.uk> References: <060.e46e71c05bea5db423ac59797919a27d@fluffy.co.uk> Message-ID: <069.c71069e1e0b5595f903bcadb7921b2a7@fluffy.co.uk> #43: Cannot create BackupLocations with path in international characters -----------------------------+---------------------------------------------- Reporter: vit at trs.sut.ru | Owner: chris Type: defect | Status: assigned Priority: critical | Milestone: 0.11 Component: bbackupd | Version: 0.10 Resolution: | Keywords: windows win32 backup locations i18n l10n -----------------------------+---------------------------------------------- Changes (by chris): * keywords: => windows win32 backup locations i18n l10n * owner: ben => chris * status: new => assigned * milestone: => 0.11 -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 23:07:07 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 22:07:07 -0000 Subject: [Box Backup-commit] Re: #9: SSL connection may time out when backing up large data sets In-Reply-To: <051.7f9a8c157bc8a6989d6ff9dd4f9204e4@fluffy.co.uk> References: <051.7f9a8c157bc8a6989d6ff9dd4f9204e4@fluffy.co.uk> Message-ID: <060.854bb3207b9f9c899852e086238c30fd@fluffy.co.uk> #9: SSL connection may time out when backing up large data sets -----------------------+---------------------------------------------------- Reporter: chris | Owner: chris Type: defect | Status: closed Priority: normal | Milestone: 0.11 Component: bbackupd | Version: 0.10 Resolution: fixed | Keywords: ssl timeout client reload scanning directories -----------------------+---------------------------------------------------- Changes (by chris): * status: assigned => closed * resolution: => fixed Comment: I believe these issues are resolved with the new timer code. Please let me know if not. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 23:09:19 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 22:09:19 -0000 Subject: [Box Backup-commit] Re: #29: Windows client 1662 has 3 extra files? In-Reply-To: <051.65a3697b1618a74bb648ef17d8b855b6@fluffy.co.uk> References: <051.65a3697b1618a74bb648ef17d8b855b6@fluffy.co.uk> Message-ID: <060.5dc9def7bf7f13e89aa84d62f8f081b6@fluffy.co.uk> #29: Windows client 1662 has 3 extra files? ------------------------+--------------------------------------------------- Reporter: petej | Owner: ben Type: defect | Status: closed Priority: trivial | Milestone: Component: bbackupd | Version: 0.10 Resolution: duplicate | Keywords: ------------------------+--------------------------------------------------- Changes (by chris): * status: new => closed * resolution: => duplicate Comment: Duplicate of #25. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 23:11:07 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 22:11:07 -0000 Subject: [Box Backup-commit] Re: #29: Windows client 1662 has 3 extra files? In-Reply-To: <051.65a3697b1618a74bb648ef17d8b855b6@fluffy.co.uk> References: <051.65a3697b1618a74bb648ef17d8b855b6@fluffy.co.uk> Message-ID: <060.a4ba163177acb96aafaa65ba9eb2bae2@fluffy.co.uk> #29: Windows client 1662 has 3 extra files? ------------------------+--------------------------------------------------- Reporter: petej | Owner: ben Type: defect | Status: closed Priority: trivial | Milestone: Component: bbackupd | Version: 0.10 Resolution: duplicate | Keywords: ------------------------+--------------------------------------------------- Comment (by chris): And #24. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 23:17:25 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 22:17:25 -0000 Subject: [Box Backup-commit] Re: #34: Cipher EVPFinalFailure 5/6 with OpenSSL 0.9.7 In-Reply-To: <051.51b446c325a3b5523069b470fa286e33@fluffy.co.uk> References: <051.51b446c325a3b5523069b470fa286e33@fluffy.co.uk> Message-ID: <060.7a1f7433103b23427471c37db41e51bf@fluffy.co.uk> #34: Cipher EVPFinalFailure 5/6 with OpenSSL 0.9.7 -----------------------+---------------------------------------------------- Reporter: chris | Owner: chris Type: defect | Status: assigned Priority: normal | Milestone: 0.11 Component: bbackupd | Version: Resolution: | Keywords: openssl Cipher EVPFinalFailure 5/6 -----------------------+---------------------------------------------------- Changes (by chris): * owner: ben => chris * status: new => assigned Comment: Probably the same bug as #21. Awaiting feedback. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 23:29:35 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 22:29:35 -0000 Subject: [Box Backup-commit] Re: #13: Fix file locking on Windows In-Reply-To: <051.3f0a33f27093a7012177d04fd3ab46d2@fluffy.co.uk> References: <051.3f0a33f27093a7012177d04fd3ab46d2@fluffy.co.uk> Message-ID: <060.e7a73619d4a3aa222e5160550b65ac5a@fluffy.co.uk> #13: Fix file locking on Windows -----------------------+---------------------------------------------------- Reporter: chris | Owner: chris Type: defect | Status: new Priority: normal | Milestone: 0.12 Component: bbackupd | Version: 0.10 Resolution: | Keywords: windows file locking locked volume shadow copy service vss -----------------------+---------------------------------------------------- Changes (by chris): * milestone: 0.11 => 0.12 Comment: Not in 0.11, sorry. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Wed Sep 19 23:32:50 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 23:32:50 +0100 Subject: [Box Backup-commit] COMMIT r1844 - in box/trunk/distribution/boxbackup/contrib: . debian Message-ID: Author: chris Date: 2007-09-19 23:32:50 +0100 (Wed, 19 Sep 2007) New Revision: 1844 Added: box/trunk/distribution/boxbackup/contrib/debian/ box/trunk/distribution/boxbackup/contrib/debian/README.txt box/trunk/distribution/boxbackup/contrib/debian/bbackupd box/trunk/distribution/boxbackup/contrib/debian/bbstored Log: Added Debian initscripts, thanks to James Stark. Added: box/trunk/distribution/boxbackup/contrib/debian/README.txt =================================================================== --- box/trunk/distribution/boxbackup/contrib/debian/README.txt (rev 0) +++ box/trunk/distribution/boxbackup/contrib/debian/README.txt 2007-09-19 22:32:50 UTC (rev 1844) @@ -0,0 +1,9 @@ +These start scripts are for Debian GNU/Linux. If installed manually they should +be placed in /etc/init.d. To create the symbolic links for the appropriate run +levels execute the following commands: + +update-rc.d bbackupd defaults 90 +update-rc.d bbstored defaults 80 + +James Stark + Added: box/trunk/distribution/boxbackup/contrib/debian/bbackupd =================================================================== --- box/trunk/distribution/boxbackup/contrib/debian/bbackupd (rev 0) +++ box/trunk/distribution/boxbackup/contrib/debian/bbackupd 2007-09-19 22:32:50 UTC (rev 1844) @@ -0,0 +1,38 @@ +#! /bin/sh + +# Start and stop the Box Backup client daemon. + +test -x /usr/local/bin/bbackupd || exit 0 +test -f /etc/box/bbackupd.conf || exit 0 + +case $1 in + start) + echo -n "Starting Box Backup Client daemon: bbackupd" + start-stop-daemon --start --quiet --exec /usr/local/bin/bbackupd > /dev/null + echo "." + ;; + + stop) + echo -n "Stopping Box Backup Client daemon: bbackupd" + start-stop-daemon --stop --quiet --pidfile /var/run/bbackupd.pid --exec /usr/local/bin/bbackupd + echo "." + ;; + + reload|force-reload) + echo -n "Reloading the Box Backup Client daemon's configuration" + start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/bbackupd.pid --exec /usr/local/bin/bbackupd + echo "." + ;; + + restart) + echo -n "Restarting the Box Backup Client daemon: bbackupd" + start-stop-daemon --stop --quiet --pidfile /var/run/bbackupd.pid --exec /usr/local/bin/bbackupd + start-stop-daemon --start --quiet --exec /usr/local/bin/bbackupd > dev/null + echo "." + ;; + *) + echo "Usage: /etc/init.d/bbackupd {start|stop|reload|force-reload|restart}" + exit 1 +esac + +exit 0 Added: box/trunk/distribution/boxbackup/contrib/debian/bbstored =================================================================== --- box/trunk/distribution/boxbackup/contrib/debian/bbstored (rev 0) +++ box/trunk/distribution/boxbackup/contrib/debian/bbstored 2007-09-19 22:32:50 UTC (rev 1844) @@ -0,0 +1,38 @@ +#! /bin/sh + +# Start and stop the Box Backup Server. + +test -x /usr/local/bin/bbstored || exit 0 +test -f /etc/box/bbstored.conf || exit 0 + +case $1 in + start) + echo -n "Starting the Box Backup Server daemon: bbstored" + start-stop-daemon --start --quiet --exec /usr/local/bin/bbstored > /dev/null + echo "." + ;; + + stop) + echo -n "Stopping the Box Backup Server daemon: bbstored" + start-stop-daemon --stop --quiet --pidfile /var/run/bbstored.pid --exec /usr/local/bin/bbstored + echo "." + ;; + + reload|force-reload) + echo -n "Reloading the Box Backup Server's configuration" + start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/bbstored.pid --exec /usr/local/bin/bbstored + echo "." + ;; + + restart) + echo -n "Restarting the Box Backup Server daemon: bbstored" + start-stop-daemon --stop --quiet --pidfile /var/run/bbstored.pid --exec /usr/local/bin/bbstored + start-stop-daemon --start --quiet --exec /usr/local/bin/bbstored > /dev/null + echo "." + ;; + + *) + echo "Usage /etc/init.d/bbstored {start|stop|reload|force-reload|restart}" +esac + +exit 0 From boxbackup-dev at fluffy.co.uk Wed Sep 19 23:56:24 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 19 Sep 2007 22:56:24 -0000 Subject: [Box Backup-commit] Re: #10: debian etch trouble In-Reply-To: <054.3d4f44e0f32daf06fd4d7ff91f681535@fluffy.co.uk> References: <054.3d4f44e0f32daf06fd4d7ff91f681535@fluffy.co.uk> Message-ID: <063.9bfa54ab84c4306168e5e911c3f5777a@fluffy.co.uk> #10: debian etch trouble -------------------------+-------------------------------------------------- Reporter: mvanbaak | Owner: chris Type: defect | Status: closed Priority: major | Milestone: 0.11 Component: bbackupctl | Version: 0.10 Resolution: fixed | Keywords: debian etch compile -------------------------+-------------------------------------------------- Changes (by chris): * status: assigned => closed * resolution: => fixed Comment: I think this has been fixed for a while now in trunk and chris/merge. Closing. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Fri Sep 21 19:01:05 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 21 Sep 2007 19:01:05 +0100 Subject: [Box Backup-commit] COMMIT r1845 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2007-09-21 19:01:05 +0100 (Fri, 21 Sep 2007) New Revision: 1845 Modified: box/trunk/bin/bbackupd/bbackupd-config.in Log: Fix regular expression syntax in examples, thanks Roy! Modified: box/trunk/bin/bbackupd/bbackupd-config.in =================================================================== --- box/trunk/bin/bbackupd/bbackupd-config.in 2007-09-19 22:32:50 UTC (rev 1844) +++ box/trunk/bin/bbackupd/bbackupd-config.in 2007-09-21 18:01:05 UTC (rev 1845) @@ -467,9 +467,9 @@ # # For example: # -# ExcludeDir = /home/guest-user -# ExcludeFilesRegex = *.(mp3|MP3)\$ -# AlwaysIncludeFile = /home/username/veryimportant.mp3 +# ExcludeDir = ^/home/guest-user$ +# ExcludeFilesRegex = \.(mp3|MP3)\$ +# AlwaysIncludeFile = ^/home/username/veryimportant\.mp3$ # # This excludes the directory /home/guest-user from the backup along with all mp3 # files, except one MP3 file in particular. @@ -483,16 +483,16 @@ # To back up a directory inside an excluded directory, use a configuration # like this, to ensure that each directory in the path to the important # files is included, but none of their contents will be backed up except -# the directories futher down that path to the important one. +# the directories further down that path to the important one. # -# ExcludeDirsRegex = /home/user/bigfiles/.* -# ExcludeFilesRegex = /home/user/bigfiles/.* -# AlwaysIncludeDir = /home/user/bigfiles/path -# AlwaysIncludeDir = /home/user/bigfiles/path/to -# AlwaysIncludeDir = /home/user/bigfiles/path/important -# AlwaysIncludeDir = /home/user/bigfiles/path/important/files -# AlwaysIncludeDirsRegex = /home/user/bigfiles/path/important/files/.* -# AlwaysIncludeFilesRegex = /home/user/bigfiles/path/important/files/.* +# ExcludeDirsRegex = ^/home/user/bigfiles/ +# ExcludeFilesRegex = ^/home/user/bigfiles/ +# AlwaysIncludeDir = ^/home/user/bigfiles/path +# AlwaysIncludeDir = ^/home/user/bigfiles/path/to +# AlwaysIncludeDir = ^/home/user/bigfiles/path/important +# AlwaysIncludeDir = ^/home/user/bigfiles/path/important/files +# AlwaysIncludeDirsRegex = ^/home/user/bigfiles/path/important/files/ +# AlwaysIncludeFilesRegex = ^/home/user/bigfiles/path/important/files/ # # If a directive ends in Regex, then it is a regular expression rather than a # explicit full pathname. See From boxbackup-dev at fluffy.co.uk Fri Sep 21 19:59:06 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 21 Sep 2007 19:59:06 +0100 Subject: [Box Backup-commit] COMMIT r1846 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2007-09-21 19:59:06 +0100 (Fri, 21 Sep 2007) New Revision: 1846 Modified: box/trunk/bin/bbackupd/bbackupd-config.in Log: Undo bad changes (not all exclude options take a regex). Modified: box/trunk/bin/bbackupd/bbackupd-config.in =================================================================== --- box/trunk/bin/bbackupd/bbackupd-config.in 2007-09-21 18:01:05 UTC (rev 1845) +++ box/trunk/bin/bbackupd/bbackupd-config.in 2007-09-21 18:59:06 UTC (rev 1846) @@ -467,9 +467,9 @@ # # For example: # -# ExcludeDir = ^/home/guest-user$ +# ExcludeDir = /home/guest-user # ExcludeFilesRegex = \.(mp3|MP3)\$ -# AlwaysIncludeFile = ^/home/username/veryimportant\.mp3$ +# AlwaysIncludeFile = /home/username/veryimportant.mp3 # # This excludes the directory /home/guest-user from the backup along with all mp3 # files, except one MP3 file in particular. @@ -487,10 +487,10 @@ # # ExcludeDirsRegex = ^/home/user/bigfiles/ # ExcludeFilesRegex = ^/home/user/bigfiles/ -# AlwaysIncludeDir = ^/home/user/bigfiles/path -# AlwaysIncludeDir = ^/home/user/bigfiles/path/to -# AlwaysIncludeDir = ^/home/user/bigfiles/path/important -# AlwaysIncludeDir = ^/home/user/bigfiles/path/important/files +# AlwaysIncludeDir = /home/user/bigfiles/path +# AlwaysIncludeDir = /home/user/bigfiles/path/to +# AlwaysIncludeDir = /home/user/bigfiles/path/important +# AlwaysIncludeDir = /home/user/bigfiles/path/important/files # AlwaysIncludeDirsRegex = ^/home/user/bigfiles/path/important/files/ # AlwaysIncludeFilesRegex = ^/home/user/bigfiles/path/important/files/ # From boxbackup-dev at fluffy.co.uk Fri Sep 21 20:00:44 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 21 Sep 2007 20:00:44 +0100 Subject: [Box Backup-commit] COMMIT r1847 - box/chris/general/bin/bbackupd/win32 Message-ID: Author: chris Date: 2007-09-21 20:00:44 +0100 (Fri, 21 Sep 2007) New Revision: 1847 Modified: box/chris/general/bin/bbackupd/win32/bbackupd.conf Log: Undo bad changes (not all exclude options take a regex). Modified: box/chris/general/bin/bbackupd/win32/bbackupd.conf =================================================================== --- box/chris/general/bin/bbackupd/win32/bbackupd.conf 2007-09-21 18:59:06 UTC (rev 1846) +++ box/chris/general/bin/bbackupd/win32/bbackupd.conf 2007-09-21 19:00:44 UTC (rev 1847) @@ -12,64 +12,35 @@ # If you do not install it in the default location - also do not forget to # change the pid file location (below) -# This script is run whenever bbackupd changes state or encounters a -# problem which requires the system administrator to assist: -# + +# This script is run whenever bbackupd encounters a problem which requires +# the system administrator to assist: # 1) The store is full, and no more data can be uploaded. # 2) Some files or directories were not readable. -# 3) A backup run starts or finishes. -# -# The default script emails the system administrator, except for backups -# starting and stopping, where it does nothing. -# -# NOTE: If your client does not run a local SMTP server then you MUST -# edit this script and uncomment the lines near the end, which specify -# the remote SMTP server to use for sending mail. +# The default script emails the system administrator. -NotifyScript = cscript "C:\Program Files\Box Backup\NotifySysAdmin.vbs" +# NotifyScript = NotifySysadmin.sh -# The number of seconds between backup runs under normal conditions. To avoid -# cycles of load on the server, this time is randomly adjusted by a small +# A scan of the local discs will be made once an hour (approximately). +# To avoid cycles of load on the server, this time is randomly adjusted by a small # percentage as the daemon runs. UpdateStoreInterval = 3600 -# The minimum age of a file, in seconds, that will be uploaded. Avoids -# repeated uploads of a file which is constantly being modified. +# A file must have been modified at least 6 hours ago before it will be uploaded. MinimumFileAge = 21600 -# If a file is modified repeated, it won't be uploaded immediately in case -# it's modified again, due to the MinimumFileAge specified above. However, it -# should be uploaded eventually even if it is being modified repeatedly. This -# is how long we should wait, in seconds, after first noticing a change. -# (86400 seconds = 1 day) +# If a file is modified repeated, it won't be uploaded immediately in case it's modified again. +# However, it should be uploaded eventually. This is how long we should wait after first noticing +# a change. (1 day) MaxUploadWait = 86400 -# If the connection is idle for some time (e.g. over 10 minutes or 600 -# seconds, not sure exactly how long) then the server will give up and -# disconnect the client, resulting in Connection Protocol_Timeout errors -# on the server and TLSReadFailed or TLSWriteFailed errors on the client. -# Also, some firewalls and NAT gateways will kill idle connections after -# similar lengths of time. -# -# This can happen for example when most files are backed up already and -# don't need to be sent to the store again, while scanning a large -# directory, or while calculating diffs of a large file. To avoid this, -# KeepAliveTime specifies that special keep-alive messages should be sent -# when the connection is otherwise idle for a certain length of time, -# specified here in seconds. -# -# The default is that these messages are never sent, equivalent to setting -# this option to zero, but we recommend that all users enable this. -KeepAliveTime = 120 - - # Files above this size (in bytes) are tracked, and if they are renamed they will simply be # renamed on the server, rather than being uploaded again. (64k - 1) @@ -82,38 +53,30 @@ DiffingUploadSizeThreshold = 8192 -# The limit on how much time is spent diffing files, in seconds. Most files -# shouldn't take very long, but if you have really big files you can use this -# to limit the time spent diffing them. -# +# The limit on how much time is spent diffing files. Most files shouldn't take very long, +# but if you have really big files you can use this to limit the time spent diffing them. # * Reduce if you are having problems with processor usage. -# -# * Increase if you have large files, and think the upload of changes is too -# large and you want bbackupd to spend more time searching for unchanged -# blocks. +# * Increase if you have large files, and think the upload of changes is too large and want +# to spend more time searching for unchanged blocks. -MaximumDiffingTime = 120 +MaximumDiffingTime = 20 +# KeepAliveTime requires Gary's SSL KeepAlive patches +# KeepAliveTime = 250 # Uncomment this line to see exactly what the daemon is going when it's connected to the server. # ExtendedLogging = yes -# This specifies a program or script script which is run just before each -# sync, and ideally the full path to the interpreter. It will be run as the -# same user bbackupd is running as, usually root. -# -# The script must output (print) either "now" or a number to STDOUT (and a -# terminating newline, no quotes). -# -# If the result was "now", then the sync will happen. If it's a number, then -# no backup will happen for that number of seconds (bbackupd will pause) and -# then the script will be run again. -# -# Use this to temporarily stop bbackupd from syncronising or connecting to the -# store. For example, you could use this on a laptop to only backup when on a -# specific network, or when it has a working Internet connection. +# Use this to temporarily stop bbackupd from syncronising or connecting to the store. +# This specifies a program or script script which is run just before each sync, and ideally +# the full path to the interpreter. It will be run as the same user bbackupd is running as, +# usually root. +# The script prints either "now" or a number to STDOUT (and a terminating newline, no quotes). +# If the result was "now", then the sync will happen. If it's a number, then the script will +# be asked again in that number of seconds. +# For example, you could use this on a laptop to only backup when on a specific network. # SyncAllowScript = /path/to/intepreter/or/exe script-name parameters etc @@ -122,21 +85,16 @@ CommandSocket = pipe -# Uncomment the StoreObjectInfoFile to enable the experimental archiving -# of the daemon's state (including client store marker and configuration) -# between backup runs. This saves time and increases efficiency when -# bbackupd is frequently stopped and started, since it removes the need -# to rescan all directories on the remote server. However, it is new and -# not yet heavily tested, so use with caution. -# StoreObjectInfoFile = C:\Program Files\Box Backup\bbackupd\bbackupd.state - Server { PidFile = C:\Program Files\Box Backup\bbackupd\bbackupd.pid } +# StoreObjectInfoFile requires Gary's client marker serialisation patch +# StoreObjectInfoFile = C:\Program Files\Box Backup\bbackupd\bbackupd.dat +# # BackupLocations specifies which locations on disc should be backed up. Each # directory is in the format # @@ -158,12 +116,19 @@ # For example: # # ExcludeDir = /home/guest-user -# ExcludeFilesRegex = *.(mp3|MP3)$ +# ExcludeFilesRegex = \.(mp3|MP3)$ # AlwaysIncludeFile = /home/username/veryimportant.mp3 # # This excludes the directory /home/guest-user from the backup along with all mp3 # files, except one MP3 file in particular. -# +# +# If a directive ends in Regex, then it is a regular expression rather than a +# explicit full pathname. See: +# +# http://bbdev.fluffy.co.uk/trac/wiki/Win32Regex +# +# for more information about regular expressions on Windows. +# # In general, Exclude excludes a file or directory, unless the directory is # explicitly mentioned in a AlwaysInclude directive. However, Box Backup # does NOT scan inside excluded directories and will never back up an @@ -173,23 +138,47 @@ # To back up a directory inside an excluded directory, use a configuration # like this, to ensure that each directory in the path to the important # files is included, but none of their contents will be backed up except -# the directories futher down that path to the important one. +# the directories further down that path to the important one. # -# ExcludeDirsRegex = /home/user/bigfiles/.* -# ExcludeFilesRegex = /home/user/bigfiles/.* +# ExcludeDirsRegex = ^/home/user/bigfiles/ +# ExcludeFilesRegex = ^/home/user/bigfiles/ # AlwaysIncludeDir = /home/user/bigfiles/path # AlwaysIncludeDir = /home/user/bigfiles/path/to # AlwaysIncludeDir = /home/user/bigfiles/path/important # AlwaysIncludeDir = /home/user/bigfiles/path/important/files -# AlwaysIncludeDirsRegex = /home/user/bigfiles/path/important/files/.* -# AlwaysIncludeFilesRegex = /home/user/bigfiles/path/important/files/.* -# -# If a directive ends in Regex, then it is a regular expression rather than a -# explicit full pathname. See -# -# man 7 re_format -# -# for the regex syntax on your platform. +# AlwaysIncludeDirsRegex = ^/home/user/bigfiles/path/important/files/ +# AlwaysIncludeFilesRegex = ^/home/user/bigfiles/path/important/files/ +# +# Here are some more examples of possible regular expressions for Windows: +# +# ExcludeDir = C:\Documents and Settings\Owner +# ExcludeFilesRegex = \.(mp3|MP3)$ +# AlwaysIncludeFile = C:\Documents and Settings\Owner\My Documents\My Music\veryimportant.mp3 +# ExcludeFilesRegex = \.pst$ +# AlwaysIncludeFilesRegex = \.*backup.*\.pst$ +# ExcludeFilesRegex = \.avi$ +# ExcludeDirsRegex = \\Temporary Internet Files$ +# ExcludeFilesRegex = \\pagefile\.sys$ +# ExcludeDirsRegex = \\pagefile\.sys$ +# ExcludeFilesRegex = \\boot\.ini$ +# ExcludeFilesRegex = \\NTDETECT\.COM$ +# ExcludeFilesRegex = \\UsrClass\.dat\.LOG$ +# ExcludeDirsRegex = \\System Volume Information$ +# ExcludeFilesRegex = \\ntldr$ +# ExcludeDirsRegex = \\Local Settings\\.*\\Cache$ +# ExcludeFilesRegex = \\thumbs\.db$ +# ExcludeFilesRegex = \\~.* +# ExcludeFilesRegex = \\Perflib.* +# ExcludeDirsRegex = \\Application Data$ +# ExcludeFilesRegex = \.bk[~!0-9]$ +# ExcludeFilesRegex = \.iso$ +# ExcludeFilesRegex = \.mpe?[2345g]$ +# ExcludeFilesRegex = \.qbw$ +# AlwaysIncludeFilesRegex = \.qbb$ +# ExcludeFilesRegex = \.tif[f]$ +# ExcludeFilesRegex = \.wmv$ +# ExcludeFilesRegex = \.avi$ +# ExcludeFilesRegex = \.(avi|iso|mp(e)?[g345]|bk[~!1-9]|[mt]bk)$ BackupLocations { From boxbackup-dev at fluffy.co.uk Fri Sep 21 20:47:07 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 21 Sep 2007 20:47:07 +0100 Subject: [Box Backup-commit] COMMIT r1848 - box/chris/general/lib/win32 Message-ID: Author: chris Date: 2007-09-21 20:47:07 +0100 (Fri, 21 Sep 2007) New Revision: 1848 Modified: box/chris/general/lib/win32/getopt_long.cxx Log: Fix compilation on MinGW. Not yet actually used on MinGW due to the file extension, but it might be soon, if the default implementation doesn't do what I want. Modified: box/chris/general/lib/win32/getopt_long.cxx =================================================================== --- box/chris/general/lib/win32/getopt_long.cxx 2007-09-21 19:00:44 UTC (rev 1847) +++ box/chris/general/lib/win32/getopt_long.cxx 2007-09-21 19:47:07 UTC (rev 1848) @@ -57,14 +57,17 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "Box.h" +// #include "Box.h" #include #include #include +#include #include -#ifdef _MSC_VER +#include "getopt.h" + +#if defined _MSC_VER || defined __MINGW32__ #define REPLACE_GETOPT /* use this getopt as the system getopt(3) */ #endif From boxbackup-dev at fluffy.co.uk Fri Sep 21 20:48:23 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 21 Sep 2007 20:48:23 +0100 Subject: [Box Backup-commit] COMMIT r1849 - box/chris/general/lib/server Message-ID: Author: chris Date: 2007-09-21 20:48:23 +0100 (Fri, 21 Sep 2007) New Revision: 1849 Modified: box/chris/general/lib/server/Daemon.cpp box/chris/general/lib/server/Daemon.h Log: Refactor out command-line option processing, so that it can be extended by subclasses. Modified: box/chris/general/lib/server/Daemon.cpp =================================================================== --- box/chris/general/lib/server/Daemon.cpp 2007-09-21 19:47:07 UTC (rev 1848) +++ box/chris/general/lib/server/Daemon.cpp 2007-09-21 19:48:23 UTC (rev 1849) @@ -50,7 +50,8 @@ mTerminateWanted(false), mSingleProcess(false), mRunInForeground(false), - mKeepConsoleOpenAfterFork(false) + mKeepConsoleOpenAfterFork(false), + mHaveConfigFile(false); { if(spDaemon != NULL) { @@ -87,6 +88,126 @@ // -------------------------------------------------------------------------- // // Function +// Name: Daemon::GetOptionString() +// Purpose: Returns the valid Getopt command-line options. +// This should be overridden by subclasses to add +// their own options, which should override +// ProcessOption, handle their own, and delegate to +// ProcessOption for the standard options. +// Created: 2007/09/18 +// +// -------------------------------------------------------------------------- +std::string Daemon::GetOptionString() +{ + return "c:DFqvVt:Tk"; +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: Daemon::ProcessOption(int option) +// Purpose: Processes the supplied option (equivalent to the +// return code from getopt()). Return zero if the +// option was handled successfully, or nonzero to +// abort the program with that return value. +// Created: 2007/09/18 +// +// -------------------------------------------------------------------------- +int Daemon::ProcessOption(signed int option) +{ + switch(option) + { + case 'c': + { + mConfigFileName = optarg; + mHaveConfigFile = true; + } + break; + + case 'D': + { + mSingleProcess = true; + } + break; + + case 'F': + { + mRunInForeground = true; + } + break; + + case 'q': + { + if(mLogLevel == Log::NOTHING) + { + BOX_FATAL("Too many '-q': " + "Cannot reduce logging " + "level any more"); + return 2; + } + mLogLevel--; + } + break; + + case 'v': + { + if(mLogLevel == Log::EVERYTHING) + { + BOX_FATAL("Too many '-v': " + "Cannot increase logging " + "level any more"); + return 2; + } + mLogLevel++; + } + break; + + case 'V': + { + mLogLevel = Log::EVERYTHING; + } + break; + + case 't': + { + Console::SetTag(optarg); + } + break; + + case 'T': + { + Console::SetShowTime(true); + } + break; + + case 'k': + { + mKeepConsoleOpenAfterFork = true; + } + break; + + case '?': + { + BOX_FATAL("Unknown option on command line: " + << "'" << (char)optopt << "'"); + return 2; + } + break; + + default: + { + BOX_FATAL("Unknown error in getopt: returned " + << "'" << option << "'"); + return 1; + } + } + + return 0; +} + +// -------------------------------------------------------------------------- +// +// Function // Name: Daemon::Main(const char *, int, const char *[]) // Purpose: Parses command-line options, and then calls // Main(std::string& configFile, bool singleProcess) @@ -98,12 +219,11 @@ { // Find filename of config file mConfigFileName = DefaultConfigFile; - bool haveConfigFile = false; #ifdef NDEBUG - int masterLevel = Log::NOTICE; // need an int to do math with + mLogLevel = Log::NOTICE; // need an int to do math with #else - int masterLevel = Log::INFO; // need an int to do math with + mLogLevel = Log::INFO; // need an int to do math with #endif signed int c; @@ -118,97 +238,18 @@ optreset = 1; #endif - while((c = getopt(argc, (char * const *)argv, "c:DFqvVt:Tk")) != -1) + while((c = getopt(argc, (char * const *)argv, + GetOptionString().c_str())) != -1) { - switch(c) + int returnCode = ProcessOption(c); + + if (returnCode != 0) { - case 'c': - { - mConfigFileName = optarg; - haveConfigFile = true; - } - break; - - case 'D': - { - mSingleProcess = true; - } - break; - - case 'F': - { - mRunInForeground = true; - } - break; - - case 'q': - { - if(masterLevel == Log::NOTHING) - { - BOX_FATAL("Too many '-q': " - "Cannot reduce logging " - "level any more"); - return 2; - } - masterLevel--; - } - break; - - case 'v': - { - if(masterLevel == Log::EVERYTHING) - { - BOX_FATAL("Too many '-v': " - "Cannot increase logging " - "level any more"); - return 2; - } - masterLevel++; - } - break; - - case 'V': - { - masterLevel = Log::EVERYTHING; - } - break; - - case 't': - { - Console::SetTag(optarg); - } - break; - - case 'T': - { - Console::SetShowTime(true); - } - break; - - case 'k': - { - mKeepConsoleOpenAfterFork = true; - } - break; - - case '?': - { - BOX_FATAL("Unknown option on command line: " - << "'" << (char)optopt << "'"); - return 2; - } - break; - - default: - { - BOX_FATAL("Unknown error in getopt: returned " - << "'" << c << "'"); - return 1; - } + return returnCode; } } - if (argc > optind && !haveConfigFile) + if (argc > optind && !mHaveConfigFile) { mConfigFileName = argv[optind]; optind++; } @@ -225,7 +266,7 @@ return 2; } - Logging::SetGlobalLevel((Log::Level)masterLevel); + Logging::SetGlobalLevel((Log::Level)mLogLevel); return Main(mConfigFileName); } Modified: box/chris/general/lib/server/Daemon.h =================================================================== --- box/chris/general/lib/server/Daemon.h 2007-09-21 19:47:07 UTC (rev 1848) +++ box/chris/general/lib/server/Daemon.h 2007-09-21 19:48:23 UTC (rev 1849) @@ -67,12 +67,13 @@ protected: box_time_t GetLoadedConfigModifiedTime() const; bool IsSingleProcess() { return mSingleProcess; } + std::string GetOptionString(); + int ProcessOption(signed int option); private: static void SignalHandler(int sigraised); box_time_t GetConfigFileModifiedTime() const; -private: std::string mConfigFileName; Configuration *mpConfiguration; box_time_t mLoadedConfigModifiedTime; @@ -81,6 +82,8 @@ bool mSingleProcess; bool mRunInForeground; bool mKeepConsoleOpenAfterFork; + bool mHaveConfigFile; + int mLogLevel; // need an int to do math with static Daemon *spDaemon; }; From boxbackup-dev at fluffy.co.uk Fri Sep 21 21:34:09 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 21 Sep 2007 21:34:09 +0100 Subject: [Box Backup-commit] COMMIT r1850 - box/chris/general/lib/server Message-ID: Author: chris Date: 2007-09-21 21:34:09 +0100 (Fri, 21 Sep 2007) New Revision: 1850 Modified: box/chris/general/lib/server/Daemon.cpp Log: Compile fix. Modified: box/chris/general/lib/server/Daemon.cpp =================================================================== --- box/chris/general/lib/server/Daemon.cpp 2007-09-21 19:48:23 UTC (rev 1849) +++ box/chris/general/lib/server/Daemon.cpp 2007-09-21 20:34:09 UTC (rev 1850) @@ -51,7 +51,7 @@ mSingleProcess(false), mRunInForeground(false), mKeepConsoleOpenAfterFork(false), - mHaveConfigFile(false); + mHaveConfigFile(false) { if(spDaemon != NULL) { From boxbackup-dev at fluffy.co.uk Fri Sep 21 23:58:34 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 21 Sep 2007 23:58:34 +0100 Subject: [Box Backup-commit] COMMIT r1851 - box/chris/general/lib/server Message-ID: Author: chris Date: 2007-09-21 23:58:34 +0100 (Fri, 21 Sep 2007) New Revision: 1851 Modified: box/chris/general/lib/server/SocketStream.cpp Log: Report more useful error messages on connect() failure on Windows. Modified: box/chris/general/lib/server/SocketStream.cpp =================================================================== --- box/chris/general/lib/server/SocketStream.cpp 2007-09-21 20:34:09 UTC (rev 1850) +++ box/chris/general/lib/server/SocketStream.cpp 2007-09-21 22:58:34 UTC (rev 1851) @@ -161,17 +161,26 @@ { // Dispose of the socket #ifdef WIN32 + DWORD err = WSAGetLastError(); ::closesocket(mSocketHandle); #else + int err = errno; ::close(mSocketHandle); #endif + BOX_ERROR("Failed to connect to socket (type " << Type << ", name " << Name << ", port " << Port << "): " << - "error " << errno << " (" << strerror(errno) << - ")"); + #ifdef WIN32 + GetErrorMessage(err) + #else + strerror(err) << " (" << err << ")" + #endif + ); + mSocketHandle = INVALID_SOCKET_VALUE; THROW_EXCEPTION(ConnectionException, Conn_SocketConnectError) } + ResetCounters(); } From boxbackup-dev at fluffy.co.uk Fri Sep 21 23:59:16 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 21 Sep 2007 23:59:16 +0100 Subject: [Box Backup-commit] COMMIT r1852 - box/chris/general/lib/server Message-ID: Author: chris Date: 2007-09-21 23:59:16 +0100 (Fri, 21 Sep 2007) New Revision: 1852 Modified: box/chris/general/lib/server/Daemon.h Log: Make Main(), GetOptionString() and ProcessOption virtual so that they can actually be overridden. Modified: box/chris/general/lib/server/Daemon.h =================================================================== --- box/chris/general/lib/server/Daemon.h 2007-09-21 22:58:34 UTC (rev 1851) +++ box/chris/general/lib/server/Daemon.h 2007-09-21 22:59:16 UTC (rev 1852) @@ -41,7 +41,9 @@ public: int Main(const char *DefaultConfigFile, int argc, const char *argv[]); - int Main(const std::string &rConfigFile); + + /* override this Main() if you want custom option processing: */ + virtual int Main(const std::string &rConfigFile); virtual void Run(); const Configuration &GetConfiguration() const; @@ -67,8 +69,8 @@ protected: box_time_t GetLoadedConfigModifiedTime() const; bool IsSingleProcess() { return mSingleProcess; } - std::string GetOptionString(); - int ProcessOption(signed int option); + virtual std::string GetOptionString(); + virtual int ProcessOption(signed int option); private: static void SignalHandler(int sigraised); From boxbackup-dev at fluffy.co.uk Sat Sep 22 00:03:10 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 22 Sep 2007 00:03:10 +0100 Subject: [Box Backup-commit] COMMIT r1853 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2007-09-22 00:03:10 +0100 (Sat, 22 Sep 2007) New Revision: 1853 Modified: box/chris/general/bin/bbackupd/Win32BackupService.cpp box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp box/chris/general/bin/bbackupd/Win32ServiceFunctions.h Log: Record the exit status of the daemon when running as a service, and return it to Windows so that Windows doesn't tell the admin that "the service did not report an error" when it stopped unexpectedly. When failing to contact the SCM, report a textual error message as well as the error code. Make OurService() take a const char * instead of char *, so that we can pass it a std::string.c_str(). InstallService creates service using "-s" option instead of "--service", which no longer works once we use getopt() for option processing (to follow). Modified: box/chris/general/bin/bbackupd/Win32BackupService.cpp =================================================================== --- box/chris/general/bin/bbackupd/Win32BackupService.cpp 2007-09-21 22:59:16 UTC (rev 1852) +++ box/chris/general/bin/bbackupd/Win32BackupService.cpp 2007-09-21 23:03:10 UTC (rev 1853) @@ -14,10 +14,12 @@ Win32BackupService* gpDaemonService = NULL; extern HANDLE gStopServiceEvent; +extern DWORD gServiceReturnCode; unsigned int WINAPI RunService(LPVOID lpParameter) { DWORD retVal = gpDaemonService->WinService((const char*) lpParameter); + gServiceReturnCode = retVal; SetEvent(gStopServiceEvent); return retVal; } Modified: box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp 2007-09-21 22:59:16 UTC (rev 1852) +++ box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp 2007-09-21 23:03:10 UTC (rev 1853) @@ -30,6 +30,7 @@ SERVICE_STATUS gServiceStatus; SERVICE_STATUS_HANDLE gServiceStatusHandle = 0; HANDLE gStopServiceEvent = 0; +DWORD gServiceReturnCode = 0; #define SERVICE_NAME "boxbackup" @@ -43,7 +44,8 @@ { char buf[256]; memset(buf, 0, sizeof(buf)); - _snprintf(buf, sizeof(buf)-1, "%s (%d)", s, err); + _snprintf(buf, sizeof(buf)-1, "%s: %s", s, + GetErrorMessage(err).c_str()); BOX_ERROR(buf); MessageBox(0, buf, "Error", MB_OK | MB_SETFOREGROUND | MB_DEFAULT_DESKTOP_ONLY); @@ -156,14 +158,22 @@ // service is now stopped gServiceStatus.dwControlsAccepted &= ~(SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); + gServiceStatus.dwCurrentState = SERVICE_STOPPED; + + if (gServiceReturnCode != 0) + { + gServiceStatus.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR; + gServiceStatus.dwServiceSpecificExitCode = gServiceReturnCode; + } + SetServiceStatus(gServiceStatusHandle, &gServiceStatus); } } -int OurService(char* pConfigFileName) +int OurService(const char* pConfigFileName) { - spConfigFileName = pConfigFileName; + spConfigFileName = strdup(pConfigFileName); SERVICE_TABLE_ENTRY serviceTable[] = { @@ -175,6 +185,9 @@ // Register with the SCM success = StartServiceCtrlDispatcher(serviceTable); + free(spConfigFileName); + spConfigFileName = NULL; + if (!success) { ErrorHandler("Failed to start service. Did you start " @@ -222,7 +235,7 @@ cmd[sizeof(cmd)-1] = 0; std::string cmdWithArgs(cmd); - cmdWithArgs += " --service"; + cmdWithArgs += " -s"; if (pConfigFileName != NULL) { Modified: box/chris/general/bin/bbackupd/Win32ServiceFunctions.h =================================================================== --- box/chris/general/bin/bbackupd/Win32ServiceFunctions.h 2007-09-21 22:59:16 UTC (rev 1852) +++ box/chris/general/bin/bbackupd/Win32ServiceFunctions.h 2007-09-21 23:03:10 UTC (rev 1853) @@ -14,6 +14,6 @@ int RemoveService (void); int InstallService (const char* pConfigFilePath); -int OurService (char* pConfigFileName); +int OurService (const char* pConfigFileName); #endif From boxbackup-dev at fluffy.co.uk Sat Sep 22 00:05:26 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 22 Sep 2007 00:05:26 +0100 Subject: [Box Backup-commit] COMMIT r1854 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2007-09-22 00:05:25 +0100 (Sat, 22 Sep 2007) New Revision: 1854 Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp box/chris/general/bin/bbackupd/BackupDaemon.h box/chris/general/bin/bbackupd/bbackupd.cpp Log: Use Daemon's delegated option processing instead of our own hacks. Move Windows service startup, installation and removal to BackupDaemon. Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-21 23:03:10 UTC (rev 1853) +++ box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-21 23:05:25 UTC (rev 1854) @@ -76,6 +76,13 @@ #include "Logging.h" #include "autogen_ClientException.h" +#ifdef WIN32 + #include "Win32ServiceFunctions.h" + #include "Win32BackupService.h" + + extern Win32BackupService* gpDaemonService; +#endif + #include "MemLeakFindOn.h" static const time_t MAX_SLEEP_TIME = 1024; @@ -116,6 +123,11 @@ mpCommandSocketInfo(0), mDeleteUnusedRootDirEntriesAfter(0), mLogAllFileAccess(false) + #ifdef WIN32 + , mInstallService(false), + mRemoveService(false), + mRunAsService(false) + #endif { // Only ever one instance of a daemon SSLLib::Initialise(); @@ -276,6 +288,83 @@ } #ifdef WIN32 +std::string BackupDaemon::GetOptionString() +{ + std::string oldOpts = this->Daemon::GetOptionString(); + ASSERT(oldOpts.find("s") == std::string::npos); + ASSERT(oldOpts.find("S") == std::string::npos); + ASSERT(oldOpts.find("i") == std::string::npos); + ASSERT(oldOpts.find("r") == std::string::npos); + return oldOpts + "sS:ir"; +} + +int BackupDaemon::ProcessOption(signed int option) +{ + switch(option) + { + case 's': + { + mRunAsService = true; + return 0; + } + + case 'S': + { + mServiceName = optarg; + return 0; + } + + case 'i': + { + mInstallService = true; + return 0; + } + + case 'r': + { + mRemoveService = true; + return 0; + } + + default: + { + return this->Daemon::ProcessOption(option); + } + } +} + +int BackupDaemon::Main(const std::string &rConfigFileName) +{ + if (mInstallService) + { + return InstallService(rConfigFileName.c_str()); + } + + if (mRemoveService) + { + return RemoveService(); + } + + int returnCode; + + if (mRunAsService) + { + // We will be called reentrantly by the Service Control + // Manager, and we had better not call OurService again! + mRunAsService = false; + + BOX_INFO("Box Backup service starting"); + returnCode = OurService(rConfigFileName.c_str()); + BOX_INFO("Box Backup service shut down"); + } + else + { + returnCode = this->Daemon::Main(rConfigFileName); + } + + return returnCode; +} + void BackupDaemon::RunHelperThread(void) { const Configuration &conf(GetConfiguration()); Modified: box/chris/general/bin/bbackupd/BackupDaemon.h =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.h 2007-09-21 23:03:10 UTC (rev 1853) +++ box/chris/general/bin/bbackupd/BackupDaemon.h 2007-09-21 23:05:25 UTC (rev 1854) @@ -58,7 +58,14 @@ box_time_t & theLastSyncTime, box_time_t & theNextSyncTime); bool DeleteStoreObjectInfo() const; BackupDaemon(const BackupDaemon &); + public: + #ifdef WIN32 + // add command-line options to handle Windows services + std::string GetOptionString(); + int ProcessOption(signed int option); + int Main(const std::string &rConfigFileName); + #endif void Run(); virtual const char *DaemonName() const; @@ -416,6 +423,8 @@ private: bool mDoSyncFlagOut, mSyncIsForcedOut; + bool mInstallService, mRemoveService, mRunAsService; + std::string mServiceName; HANDLE mhMessageToSendEvent, mhCommandReceivedEvent; CRITICAL_SECTION mMessageQueueLock; std::vector mMessageList; Modified: box/chris/general/bin/bbackupd/bbackupd.cpp =================================================================== --- box/chris/general/bin/bbackupd/bbackupd.cpp 2007-09-21 23:03:10 UTC (rev 1853) +++ box/chris/general/bin/bbackupd/bbackupd.cpp 2007-09-21 23:05:25 UTC (rev 1854) @@ -35,63 +35,12 @@ #ifdef WIN32 - if(argc == 2 && - (::strcmp(argv[1], "--help") == 0 || - ::strcmp(argv[1], "-h") == 0)) - { - printf("-h help, -i install service, -r remove service,\n" - "-c start daemon now"); - return 2; - } - if(argc == 2 && ::strcmp(argv[1], "-r") == 0) - { - return RemoveService(); - } - if((argc == 2 || argc == 3) && ::strcmp(argv[1], "-i") == 0) - { - const char* config = NULL; - if (argc == 3) - { - config = argv[2]; - } - return InstallService(config); - } - - bool runAsWin32Service = false; - if (argc >= 2 && ::strcmp(argv[1], "--service") == 0) - { - runAsWin32Service = true; - } - - gpDaemonService = new Win32BackupService(); - EnableBackupRights(); - if (runAsWin32Service) - { - BOX_INFO("Box Backup service starting"); - - char* config = NULL; - if (argc >= 3) - { - config = strdup(argv[2]); - } - - ExitCode = OurService(config); - - if (config) - { - free(config); - } - - BOX_INFO("Box Backup service shut down"); - } - else - { - ExitCode = gpDaemonService->Main( - BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE, argc, argv); - } - + gpDaemonService = new Win32BackupService(); + ExitCode = gpDaemonService->Daemon::Main( + BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE, + argc, argv); delete gpDaemonService; #else // !WIN32 From boxbackup-dev at fluffy.co.uk Sat Sep 22 00:52:08 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 22 Sep 2007 00:52:08 +0100 Subject: [Box Backup-commit] COMMIT r1855 - in box/chris/general: bin/bbackupd bin/bbstored lib/server Message-ID: Author: chris Date: 2007-09-22 00:52:08 +0100 (Sat, 22 Sep 2007) New Revision: 1855 Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp box/chris/general/bin/bbackupd/BackupDaemon.h box/chris/general/bin/bbackupd/bbackupd.cpp box/chris/general/bin/bbstored/BackupStoreDaemon.cpp box/chris/general/bin/bbstored/BackupStoreDaemon.h box/chris/general/lib/server/Daemon.cpp box/chris/general/lib/server/Daemon.h Log: Add "-h" and "/?" options to display usage in Daemon. Extend usage info with service commands in BackupDaemon. Disable useless -D, -V and -k options on Windows. Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-21 23:05:25 UTC (rev 1854) +++ box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-21 23:52:08 UTC (rev 1855) @@ -38,6 +38,8 @@ #include #endif +#include + #include "Configuration.h" #include "IOStream.h" #include "MemBlockStream.h" @@ -209,13 +211,21 @@ // Created: 1/1/04 // // -------------------------------------------------------------------------- -const char *BackupDaemon::DaemonBanner() const +std::string BackupDaemon::DaemonBanner() const { -#ifndef NDEBUG - // Don't display banner in debug builds - return 0; -#else return BANNER_TEXT("Backup Client"); +} + +void BackupDaemon::Usage() +{ + this->Daemon::Usage(); + +#ifdef WIN32 + std::cout << + " -s Run as a Windows Service, for internal use only\n" + " -i Install Windows Service (you may want to specify a config file)\n" + " -r Remove Windows Service\n" + " -S Service name for -i and -r options\n"; #endif } Modified: box/chris/general/bin/bbackupd/BackupDaemon.h =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.h 2007-09-21 23:05:25 UTC (rev 1854) +++ box/chris/general/bin/bbackupd/BackupDaemon.h 2007-09-21 23:52:08 UTC (rev 1855) @@ -69,7 +69,8 @@ void Run(); virtual const char *DaemonName() const; - virtual const char *DaemonBanner() const; + virtual std::string DaemonBanner() const; + virtual void Usage(); const ConfigurationVerify *GetConfigVerify() const; bool FindLocationPathName(const std::string &rLocationName, std::string &rPathOut) const; Modified: box/chris/general/bin/bbackupd/bbackupd.cpp =================================================================== Modified: box/chris/general/bin/bbstored/BackupStoreDaemon.cpp =================================================================== --- box/chris/general/bin/bbstored/BackupStoreDaemon.cpp 2007-09-21 23:05:25 UTC (rev 1854) +++ box/chris/general/bin/bbstored/BackupStoreDaemon.cpp 2007-09-21 23:52:08 UTC (rev 1855) @@ -93,14 +93,9 @@ // Created: 1/1/04 // // -------------------------------------------------------------------------- -const char *BackupStoreDaemon::DaemonBanner() const +std::string BackupStoreDaemon::DaemonBanner() const { -#ifndef NDEBUG - // Don't display banner in debug builds - return 0; -#else return BANNER_TEXT("Backup Store Server"); -#endif } Modified: box/chris/general/bin/bbstored/BackupStoreDaemon.h =================================================================== --- box/chris/general/bin/bbstored/BackupStoreDaemon.h 2007-09-21 23:05:25 UTC (rev 1854) +++ box/chris/general/bin/bbstored/BackupStoreDaemon.h 2007-09-21 23:52:08 UTC (rev 1855) @@ -56,7 +56,7 @@ void Connection2(SocketStreamTLS &rStream); virtual const char *DaemonName() const; - virtual const char *DaemonBanner() const; + virtual std::string DaemonBanner() const; const ConfigurationVerify *GetConfigVerify() const; Modified: box/chris/general/lib/server/Daemon.cpp =================================================================== --- box/chris/general/lib/server/Daemon.cpp 2007-09-21 23:05:25 UTC (rev 1854) +++ box/chris/general/lib/server/Daemon.cpp 2007-09-21 23:52:08 UTC (rev 1855) @@ -23,6 +23,8 @@ #include #endif +#include + #include "Daemon.h" #include "Configuration.h" #include "ServerException.h" @@ -51,7 +53,8 @@ mSingleProcess(false), mRunInForeground(false), mKeepConsoleOpenAfterFork(false), - mHaveConfigFile(false) + mHaveConfigFile(false), + mAppName(DaemonName()) { if(spDaemon != NULL) { @@ -99,9 +102,35 @@ // -------------------------------------------------------------------------- std::string Daemon::GetOptionString() { - return "c:DFqvVt:Tk"; + return "c:" + #ifndef WIN32 + "DFk" + #endif + "hqvVt:T"; } +void Daemon::Usage() +{ + std::cout << + DaemonBanner() << "\n" + "\n" + "Usage: " << mAppName << " [options] [config file]\n" << + "\n" + "Options:\n" + " -c Use the specified configuration file. If -c is omitted, the last\n" + " argument is the configuration file\n" +#ifndef WIN32 + " -D Debugging mode, do not fork, one process only, one client only\n" + " -F Do not fork into background, but fork to serve multiple clients\n" + " -k Keep console open after fork, keep writing log messages to it\n" +#endif + " -q Run more quietly, reduce verbosity level by one, can repeat\n" + " -v Run more verbosely, increase verbosity level by one, can repeat\n" + " -V Run at maximum verbosity\n" + " -t Tag console output with specified marker\n" + " -T Timestamp console output\n"; +} + // -------------------------------------------------------------------------- // // Function @@ -124,6 +153,7 @@ } break; +#ifndef WIN32 case 'D': { mSingleProcess = true; @@ -136,6 +166,20 @@ } break; + case 'k': + { + mKeepConsoleOpenAfterFork = true; + } + break; +#endif + + case 'h': + { + Usage(); + return 2; + } + break; + case 'q': { if(mLogLevel == Log::NOTHING) @@ -180,12 +224,6 @@ } break; - case 'k': - { - mKeepConsoleOpenAfterFork = true; - } - break; - case '?': { BOX_FATAL("Unknown option on command line: " @@ -219,6 +257,7 @@ { // Find filename of config file mConfigFileName = DefaultConfigFile; + mAppName = argv[0]; #ifdef NDEBUG mLogLevel = Log::NOTICE; // need an int to do math with @@ -226,6 +265,12 @@ mLogLevel = Log::INFO; // need an int to do math with #endif + if (argc == 2 && strcmp(argv[1], "/?") == 0) + { + Usage(); + return 2; + } + signed int c; // reset getopt, just in case anybody used it before. @@ -283,11 +328,9 @@ { // Banner (optional) { - const char *banner = DaemonBanner(); - if(banner != 0) - { - BOX_NOTICE(banner); - } + #ifndef NDEBUG + BOX_NOTICE(DaemonBanner()); + #endif } std::string pidFileName; @@ -671,9 +714,9 @@ // Created: 1/1/04 // // -------------------------------------------------------------------------- -const char *Daemon::DaemonBanner() const +std::string Daemon::DaemonBanner() const { - return 0; + return "Generic daemon using the Box Application Framework"; } Modified: box/chris/general/lib/server/Daemon.h =================================================================== --- box/chris/general/lib/server/Daemon.h 2007-09-21 23:05:25 UTC (rev 1854) +++ box/chris/general/lib/server/Daemon.h 2007-09-21 23:52:08 UTC (rev 1855) @@ -50,8 +50,9 @@ const std::string &GetConfigFileName() const {return mConfigFileName;} virtual const char *DaemonName() const; - virtual const char *DaemonBanner() const; + virtual std::string DaemonBanner() const; virtual const ConfigurationVerify *GetConfigVerify() const; + virtual void Usage(); bool StopRun() {return mReloadConfigWanted | mTerminateWanted;} bool IsReloadConfigWanted() {return mReloadConfigWanted;} @@ -87,6 +88,7 @@ bool mHaveConfigFile; int mLogLevel; // need an int to do math with static Daemon *spDaemon; + std::string mAppName; }; #define DAEMON_VERIFY_SERVER_KEYS {"PidFile", 0, ConfigTest_Exists, 0}, \ From boxbackup-dev at fluffy.co.uk Sun Sep 23 10:18:20 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 23 Sep 2007 10:18:20 +0100 Subject: [Box Backup-commit] COMMIT r1856 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2007-09-23 10:18:20 +0100 (Sun, 23 Sep 2007) New Revision: 1856 Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp box/chris/general/bin/bbackupd/Win32ServiceFunctions.h Log: Use the specified service name when installing and removing the service. Pass the service name on the service command line, and use it for event log messages. Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-21 23:52:08 UTC (rev 1855) +++ box/chris/general/bin/bbackupd/BackupDaemon.cpp 2007-09-23 09:18:20 UTC (rev 1856) @@ -128,7 +128,8 @@ #ifdef WIN32 , mInstallService(false), mRemoveService(false), - mRunAsService(false) + mRunAsService(false), + mServiceName("bbackupd") #endif { // Only ever one instance of a daemon @@ -347,14 +348,16 @@ { if (mInstallService) { - return InstallService(rConfigFileName.c_str()); + return InstallService(rConfigFileName.c_str(), mServiceName); } if (mRemoveService) { - return RemoveService(); + return RemoveService(mServiceName); } + Logging::SetProgramName("Box Backup (" + mServiceName + ")"); + int returnCode; if (mRunAsService) Modified: box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp 2007-09-21 23:52:08 UTC (rev 1855) +++ box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp 2007-09-23 09:18:20 UTC (rev 1856) @@ -199,7 +199,7 @@ return 0; } -int InstallService(const char* pConfigFileName) +int InstallService(const char* pConfigFileName, const std::string& rServiceName) { if (pConfigFileName != NULL) { @@ -235,7 +235,7 @@ cmd[sizeof(cmd)-1] = 0; std::string cmdWithArgs(cmd); - cmdWithArgs += " -s"; + cmdWithArgs += " -s -S \"" + rServiceName + "\""; if (pConfigFileName != NULL) { @@ -244,10 +244,12 @@ cmdWithArgs += "\""; } + std::string serviceDesc = "Box Backup (" + rServiceName + ")"; + SC_HANDLE newService = CreateService( scm, - SERVICE_NAME, - "Box Backup", + rServiceName.c_str(), + serviceDesc.c_str(), SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, @@ -312,7 +314,7 @@ return 0; } -int RemoveService(void) +int RemoveService(const std::string& rServiceName) { SC_HANDLE scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); @@ -323,7 +325,7 @@ return 1; } - SC_HANDLE service = OpenService(scm, SERVICE_NAME, + SC_HANDLE service = OpenService(scm, rServiceName.c_str(), SERVICE_ALL_ACCESS|DELETE); DWORD err = GetLastError(); CloseServiceHandle(scm); Modified: box/chris/general/bin/bbackupd/Win32ServiceFunctions.h =================================================================== --- box/chris/general/bin/bbackupd/Win32ServiceFunctions.h 2007-09-21 23:52:08 UTC (rev 1855) +++ box/chris/general/bin/bbackupd/Win32ServiceFunctions.h 2007-09-23 09:18:20 UTC (rev 1856) @@ -12,8 +12,8 @@ #ifndef WIN32SERVICEFUNCTIONS_H #define WIN32SERVICEFUNCTIONS_H -int RemoveService (void); -int InstallService (const char* pConfigFilePath); +int RemoveService (const std::string& rServiceName); +int InstallService (const char* pConfigFilePath, const std::string& rServiceName); int OurService (const char* pConfigFileName); #endif From boxbackup-dev at fluffy.co.uk Sun Sep 23 10:19:05 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 23 Sep 2007 10:19:05 +0100 Subject: [Box Backup-commit] COMMIT r1857 - box/chris/general/lib/common Message-ID: Author: chris Date: 2007-09-23 10:19:04 +0100 (Sun, 23 Sep 2007) New Revision: 1857 Modified: box/chris/general/lib/common/Timer.cpp Log: Make detailed timer debugging work on Windows as well. Add a couple of macros to clean up the code. Modified: box/chris/general/lib/common/Timer.cpp =================================================================== --- box/chris/general/lib/common/Timer.cpp 2007-09-23 09:18:20 UTC (rev 1856) +++ box/chris/general/lib/common/Timer.cpp 2007-09-23 09:19:04 UTC (rev 1857) @@ -129,6 +129,14 @@ Reschedule(); } +#define FORMAT_BOX_TIME(t) \ + (BoxTimeToSeconds(t)) << "." << \ + (BoxTimeToMicroSeconds(t) % MICRO_SEC_IN_SEC) + +#define FORMAT_MICROSECONDS(t) \ + (int)(t / 1000000) << "." << \ + (int)(t % 1000000) + // -------------------------------------------------------------------------- // // Function @@ -175,8 +183,7 @@ if (timeToExpiry <= 0) { - BOX_TRACE((int)(timeNow / 1000000) << "." << - (int)(timeNow % 1000000) << + BOX_TRACE(FORMAT_MICROSECONDS(timeNow) << ": timer " << *i << " has expired, " "triggering it"); rTimer.OnExpire(); @@ -186,12 +193,10 @@ } else { - BOX_TRACE((int)(timeNow / 1000000) << "." << - (int)(timeNow % 1000000) << + BOX_TRACE(FORMAT_MICROSECONDS(timeNow) << ": timer " << *i << " has not " "expired, triggering in " << - (int)(timeToExpiry / 1000000) << "." << - (int)(timeToExpiry % 1000000) << + FORMAT_MICROSECONDS(timeToExpiry) << " seconds"); } } @@ -257,22 +262,20 @@ : mExpires(GetCurrentBoxTime() + SecondsToBoxTime(timeoutSecs)), mExpired(false) { - #if !defined NDEBUG && !defined WIN32 - struct timeval tv; - gettimeofday(&tv, NULL); + #ifndef NDEBUG + box_time_t timeNow = GetCurrentBoxTime(); if (timeoutSecs == 0) { - BOX_TRACE(tv.tv_sec << "." << tv.tv_usec << + BOX_TRACE(FORMAT_BOX_TIME(timeNow) << ": timer " << this << " initialised for " << timeoutSecs << " secs, will not fire"); } else { - BOX_TRACE(tv.tv_sec << "." << tv.tv_usec << + BOX_TRACE(FORMAT_BOX_TIME(timeNow) << ": timer " << this << " initialised for " << timeoutSecs << " secs, to fire at " << - (int)(mExpires / 1000000) << "." << - (int)(mExpires % 1000000)); + FORMAT_MICROSECONDS(mExpires)); } #endif @@ -288,10 +291,9 @@ Timer::~Timer() { - #if !defined NDEBUG && !defined WIN32 - struct timeval tv; - gettimeofday(&tv, NULL); - BOX_TRACE(tv.tv_sec << "." << tv.tv_usec << + #ifndef NDEBUG + box_time_t timeNow = GetCurrentBoxTime(); + BOX_TRACE(FORMAT_BOX_TIME(timeNow) << ": timer " << this << " destroyed"); #endif @@ -302,24 +304,23 @@ : mExpires(rToCopy.mExpires), mExpired(rToCopy.mExpired) { - #if !defined NDEBUG && !defined WIN32 - struct timeval tv; - gettimeofday(&tv, NULL); + #ifndef NDEBUG + box_time_t timeNow = GetCurrentBoxTime(); if (mExpired) { - BOX_TRACE(tv.tv_sec << "." << tv.tv_usec << + BOX_TRACE(FORMAT_BOX_TIME(timeNow) << ": timer " << this << " initialised from timer " << &rToCopy << ", already expired, will not fire"); } else if (mExpires == 0) { - BOX_TRACE(tv.tv_sec << "." << tv.tv_usec << + BOX_TRACE(FORMAT_BOX_TIME(timeNow) << ": timer " << this << " initialised from timer " << &rToCopy << ", no expiry, will not fire"); } else { - BOX_TRACE(tv.tv_sec << "." << tv.tv_usec << + BOX_TRACE(FORMAT_BOX_TIME(timeNow) << ": timer " << this << " initialised from timer " << &rToCopy << " to fire at " << (int)(mExpires / 1000000) << "." << @@ -335,24 +336,23 @@ Timer& Timer::operator=(const Timer& rToCopy) { - #if !defined NDEBUG && !defined WIN32 - struct timeval tv; - gettimeofday(&tv, NULL); + #ifndef NDEBUG + box_time_t timeNow = GetCurrentBoxTime(); if (rToCopy.mExpired) { - BOX_TRACE(tv.tv_sec << "." << tv.tv_usec << + BOX_TRACE(FORMAT_BOX_TIME(timeNow) << ": timer " << this << " initialised from timer " << &rToCopy << ", already expired, will not fire"); } else if (rToCopy.mExpires == 0) { - BOX_TRACE(tv.tv_sec << "." << tv.tv_usec << + BOX_TRACE(FORMAT_BOX_TIME(timeNow) << ": timer " << this << " initialised from timer " << &rToCopy << ", no expiry, will not fire"); } else { - BOX_TRACE(tv.tv_sec << "." << tv.tv_usec << + BOX_TRACE(FORMAT_BOX_TIME(timeNow) << ": timer " << this << " initialised from timer " << &rToCopy << " to fire at " << (int)(rToCopy.mExpires / 1000000) << "." << @@ -372,11 +372,9 @@ void Timer::OnExpire() { - #if !defined NDEBUG && !defined WIN32 - struct timeval tv; - gettimeofday(&tv, NULL); - BOX_TRACE(tv.tv_sec << "." << tv.tv_usec << - ": timer " << this << " fired"); + #ifndef NDEBUG + box_time_t timeNow = GetCurrentBoxTime(); + BOX_TRACE(FORMAT_BOX_TIME(timeNow) << ": timer " << this << " fired"); #endif mExpired = true; From boxbackup-dev at fluffy.co.uk Sun Sep 23 10:54:16 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 23 Sep 2007 10:54:16 +0100 Subject: [Box Backup-commit] COMMIT r1858 - box/chris/win32/releases Message-ID: Author: chris Date: 2007-09-23 10:54:16 +0100 (Sun, 23 Sep 2007) New Revision: 1858 Added: box/chris/win32/releases/boxbackup-chris_general_1857-backup-client-mingw32.zip Log: New client release [1857], with the following new features: * Add James O'Gorman's NotifySysAdmin.vbs script to client parcel on Windows [1838] * Update NotifySysAdmin.vbs to send a message to the event log if it fails to send an email (James O'Gorman) [1837] * Don't include the install-backup-client script in Windows builds, as it's pretty useless without Cygwin (Pete Jalajas) [1841] * Fix the examples in the sample configuration file [1847] * Make Windows Service-related command-line processing use getopt, like the other options [1849] [1850] [1852] [1854] * Report more useful error messages on connect() failure on Windows [1851] * Record the exit status of the daemon when running as a service, and return it to Windows so that Windows doesn't tell the admin that "the service did not report an error" when it stopped unexpectedly [1853] * When failing to contact the SCM, report a textual error message as well as the error code [1853] * InstallService uses the new "-s" option instead of "--service" on the service command line [1853] * Add proper usage information (-h option) in Daemon for all subclasses [1855] * Add usage information for service options in BackupDaemon [1855] * Disable useless -D, -F and -k options on Windows [1855] * Use the specified service name when installing and removing the service [1856] * Pass the service name on the service command line, and use it for event log messages [1856] * Improve timer debugging on Windows [1857] Added: box/chris/win32/releases/boxbackup-chris_general_1857-backup-client-mingw32.zip =================================================================== (Binary files differ) Property changes on: box/chris/win32/releases/boxbackup-chris_general_1857-backup-client-mingw32.zip ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From boxbackup-dev at fluffy.co.uk Sun Sep 23 19:51:52 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 23 Sep 2007 19:51:52 +0100 Subject: [Box Backup-commit] COMMIT r1859 - box/trunk/lib/common Message-ID: Author: chris Date: 2007-09-23 19:51:52 +0100 (Sun, 23 Sep 2007) New Revision: 1859 Modified: box/trunk/lib/common/ExcludeList.cpp Log: Compile fix. Modified: box/trunk/lib/common/ExcludeList.cpp =================================================================== --- box/trunk/lib/common/ExcludeList.cpp 2007-09-23 09:54:16 UTC (rev 1858) +++ box/trunk/lib/common/ExcludeList.cpp 2007-09-23 18:51:52 UTC (rev 1859) @@ -194,9 +194,15 @@ #endif // Compile - if(::regcomp(pregex, entry.c_str(), - REG_EXTENDED | REG_NOSUB) != 0) + int errcode = ::regcomp(pregex, entry.c_str(), + REG_EXTENDED | REG_NOSUB); + + if (errcode != 0) { + char buf[1024]; + regerror(errcode, pregex, buf, sizeof(buf)); + BOX_ERROR("Invalid regular expression: " << + entry << ": " << buf); THROW_EXCEPTION(CommonException, BadRegularExpression) } From boxbackup-dev at fluffy.co.uk Sun Sep 23 19:54:08 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 23 Sep 2007 19:54:08 +0100 Subject: [Box Backup-commit] COMMIT r1860 - box/trunk/bin/bbackupquery Message-ID: Author: chris Date: 2007-09-23 19:54:08 +0100 (Sun, 23 Sep 2007) New Revision: 1860 Modified: box/trunk/bin/bbackupquery/bbackupquery.cpp Log: Set the locale from the environment, so that international characters may be entered when using editline. Modified: box/trunk/bin/bbackupquery/bbackupquery.cpp =================================================================== --- box/trunk/bin/bbackupquery/bbackupquery.cpp 2007-09-23 18:51:52 UTC (rev 1859) +++ box/trunk/bin/bbackupquery/bbackupquery.cpp 2007-09-23 18:54:08 UTC (rev 1860) @@ -303,7 +303,16 @@ } // Get commands from input + #ifdef HAVE_LIBREADLINE + // Must initialise the locale before using editline's readline(), + // otherwise cannot enter international characters. + if (setlocale(LC_ALL, "") == NULL) + { + BOX_ERROR("Failed to initialise locale. International " + "character support may not work."); + } + #ifdef HAVE_READLINE_HISTORY using_history(); #endif From boxbackup-dev at fluffy.co.uk Sun Sep 23 21:17:01 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 23 Sep 2007 21:17:01 +0100 Subject: [Box Backup-commit] COMMIT r1861 - box/chris/general/lib/server Message-ID: Author: chris Date: 2007-09-23 21:17:01 +0100 (Sun, 23 Sep 2007) New Revision: 1861 Modified: box/chris/general/lib/server/SocketStream.cpp Log: Compile fix for MSVC (Gary) Modified: box/chris/general/lib/server/SocketStream.cpp =================================================================== --- box/chris/general/lib/server/SocketStream.cpp 2007-09-23 18:54:08 UTC (rev 1860) +++ box/chris/general/lib/server/SocketStream.cpp 2007-09-23 20:17:01 UTC (rev 1861) @@ -168,14 +168,17 @@ ::close(mSocketHandle); #endif +#ifdef WIN32 BOX_ERROR("Failed to connect to socket (type " << Type << ", name " << Name << ", port " << Port << "): " << - #ifdef WIN32 GetErrorMessage(err) - #else + ); +#else + BOX_ERROR("Failed to connect to socket (type " << Type << + ", name " << Name << ", port " << Port << "): " << strerror(err) << " (" << err << ")" - #endif ); +#endif mSocketHandle = INVALID_SOCKET_VALUE; THROW_EXCEPTION(ConnectionException, Conn_SocketConnectError) From boxbackup-dev at fluffy.co.uk Tue Sep 25 00:24:36 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Mon, 24 Sep 2007 23:24:36 -0000 Subject: [Box Backup-commit] Re: #2: When downloading a large file (>0x7fffffff) from server, connection is aborted In-Reply-To: <049.c2636e415ce342eee1d7f9a815487a5d@fluffy.co.uk> References: <049.c2636e415ce342eee1d7f9a815487a5d@fluffy.co.uk> Message-ID: <058.07ef2cf59d2204c97c4fb5ec62cf362f@fluffy.co.uk> #2: When downloading a large file (>0x7fffffff) from server, connection is aborted ----------------------------+----------------------------------------------- Reporter: ben | Owner: chris Type: defect | Status: assigned Priority: critical | Milestone: 0.11 Component: box libraries | Version: 0.10 Resolution: | Keywords: windows unix large file BackupStore BadBackupStoreFile 4/11 ----------------------------+----------------------------------------------- Changes (by chris): * cc: Dave, Bamford, (added) Comment: Dave Bamford reports that this is still not fixed on Windows: Date: Mon, 24 Sep 2007 22:23:19 +0100 Is the backup/restore of large files over 2G fixed? from http://bbdev.fluffy.co.uk/trac/wiki/WindowsClientReleases Build 1662 says its fixed. But its still listed under known bugs for the windows client. I am having trouble backing up a 2.5G file. Its reporting 00001 blocks on the server and a "get" restores a file of 0 bytes. However the event log reports it being backed up (no issues). I am using release 1857 in http://bbdev.fluffy.co.uk/svn/box/chris/win32/releases/ as the client on a windows 2003 server to a Debian etch server running the vanilla 0.10 release. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From boxbackup-dev at fluffy.co.uk Tue Sep 25 07:13:03 2007 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Tue, 25 Sep 2007 06:13:03 -0000 Subject: [Box Backup-commit] Re: #2: When downloading a large file (>0x7fffffff) from server, connection is aborted In-Reply-To: <049.c2636e415ce342eee1d7f9a815487a5d@fluffy.co.uk> References: <049.c2636e415ce342eee1d7f9a815487a5d@fluffy.co.uk> Message-ID: <058.229e19bad352a9c3e9f031fdcaec9535@fluffy.co.uk> #2: When downloading a large file (>0x7fffffff) from server, connection is aborted ----------------------------+----------------------------------------------- Reporter: ben | Owner: chris Type: defect | Status: assigned Priority: critical | Milestone: 0.11 Component: box libraries | Version: 0.10 Resolution: | Keywords: windows unix large file BackupStore BadBackupStoreFile 4/11 ----------------------------+----------------------------------------------- Changes (by jamesog): * cc: Dave, Bamford, (removed) * cc: dave at logical-progress.com (added) Comment: Correcting CC: field (email addresses only). -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX.