[Box Backup-dev] COMMIT r295 - in box/chris/boxi: . bin/bbackupctl bin/bbackupd bin/bbackupobjdump bin/bbackupquery bin/bbstoreaccounts bin/bbstored distribution distribution/boxbackup distribution/boxbackup/contrib/rpm infrastructure infrastructure/m4 lib/backupclient lib/backupstore lib/common lib/compress lib/crypto lib/raidfile lib/server lib/win32 test/backupdiff test/backupstore test/backupstorefix test/backupstorepatch test/basicserver test/bbackupd test/common test/compress test/crypto test/raidfile

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sat, 31 Dec 2005 14:04:48 +0000 (GMT)


Author: chris
Date: 2005-12-31 14:04:39 +0000 (Sat, 31 Dec 2005)
New Revision: 295

Added:
   box/chris/boxi/VERSION.txt
   box/chris/boxi/infrastructure/m4/ax_compare_version.m4
   box/chris/boxi/infrastructure/m4/ax_path_bdb.m4
   box/chris/boxi/infrastructure/m4/ax_split_version.m4
Removed:
   box/chris/boxi/VERSION.txt
Modified:
   box/chris/boxi/
   box/chris/boxi/bin/bbackupctl/
   box/chris/boxi/bin/bbackupd/
   box/chris/boxi/bin/bbackupd/BackupClientContext.cpp
   box/chris/boxi/bin/bbackupd/BackupClientInodeToIDMap.cpp
   box/chris/boxi/bin/bbackupd/BackupDaemon.cpp
   box/chris/boxi/bin/bbackupd/BackupDaemon.h
   box/chris/boxi/bin/bbackupd/CommandSocketManager.cpp
   box/chris/boxi/bin/bbackupobjdump/
   box/chris/boxi/bin/bbackupquery/
   box/chris/boxi/bin/bbackupquery/BackupQueries.cpp
   box/chris/boxi/bin/bbstoreaccounts/
   box/chris/boxi/bin/bbstored/
   box/chris/boxi/bin/bbstored/BBStoreDHousekeeping.cpp
   box/chris/boxi/configure.ac
   box/chris/boxi/distribution/COMMON-MANIFEST.txt
   box/chris/boxi/distribution/boxbackup/DISTRIBUTION-MANIFEST.txt
   box/chris/boxi/distribution/boxbackup/VERSION.txt
   box/chris/boxi/distribution/boxbackup/contrib/rpm/boxbackup.spec
   box/chris/boxi/infrastructure/
   box/chris/boxi/infrastructure/m4/ax_check_bdb_v1.m4
   box/chris/boxi/infrastructure/m4/ax_check_mount_point.m4
   box/chris/boxi/infrastructure/makedistribution.pl
   box/chris/boxi/lib/backupclient/
   box/chris/boxi/lib/backupclient/BackupStoreFile.h
   box/chris/boxi/lib/backupstore/
   box/chris/boxi/lib/common/
   box/chris/boxi/lib/common/Box.h
   box/chris/boxi/lib/common/BoxPlatform.h
   box/chris/boxi/lib/common/BoxTime.cpp
   box/chris/boxi/lib/common/BoxTime.h
   box/chris/boxi/lib/common/BoxTimeToText.cpp
   box/chris/boxi/lib/common/ConversionString.cpp
   box/chris/boxi/lib/common/Utils.cpp
   box/chris/boxi/lib/compress/
   box/chris/boxi/lib/crypto/
   box/chris/boxi/lib/raidfile/
   box/chris/boxi/lib/server/
   box/chris/boxi/lib/win32/
   box/chris/boxi/test/backupdiff/
   box/chris/boxi/test/backupdiff/testbackupdiff.cpp
   box/chris/boxi/test/backupstore/
   box/chris/boxi/test/backupstorefix/
   box/chris/boxi/test/backupstorepatch/
   box/chris/boxi/test/basicserver/
   box/chris/boxi/test/bbackupd/
   box/chris/boxi/test/bbackupd/testbbackupd.cpp
   box/chris/boxi/test/common/
   box/chris/boxi/test/compress/
   box/chris/boxi/test/crypto/
   box/chris/boxi/test/raidfile/
Log:
Merged trunk fixes from revisions 226-294 into Boxi tree



Property changes on: box/chris/boxi
___________________________________________________________________
Name: svn:ignore
   + aclocal.m4
autom4te.cache
config.log
config.status
configure
debug
ExceptionCodes.txt
local
Makefile
parcels
release


Deleted: box/chris/boxi/VERSION.txt
===================================================================
--- box/chris/boxi/VERSION.txt	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/VERSION.txt	2005-12-31 14:04:39 UTC (rev 295)
@@ -1,2 +0,0 @@
-0.09_autoconf_win32
-boxbackup

Copied: box/chris/boxi/VERSION.txt (from rev 294, box/trunk/VERSION.txt)
===================================================================
--- box/trunk/VERSION.txt	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/VERSION.txt	2005-12-31 14:04:39 UTC (rev 295)
@@ -0,0 +1,2 @@
+0.09_boxi
+boxbackup


Property changes on: box/chris/boxi/bin/bbackupctl
___________________________________________________________________
Name: svn:ignore
   + Makefile



Property changes on: box/chris/boxi/bin/bbackupd
___________________________________________________________________
Name: svn:ignore
   + Makefile


Modified: box/chris/boxi/bin/bbackupd/BackupClientContext.cpp
===================================================================
--- box/chris/boxi/bin/bbackupd/BackupClientContext.cpp	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/bin/bbackupd/BackupClientContext.cpp	2005-12-31 14:04:39 UTC (rev 295)
@@ -202,7 +202,7 @@
 			if(mClientStoreMarker == ClientStoreMarker_NotKnown)
 			{
 				// Yes, choose one, the current time will do
-				int64_t marker = GetCurrentBoxTime();
+				box_time_t marker = GetCurrentBoxTime();
 				
 				// Set it on the store
 				mpConnection->QuerySetClientStoreMarker(marker);

Modified: box/chris/boxi/bin/bbackupd/BackupClientInodeToIDMap.cpp
===================================================================
--- box/chris/boxi/bin/bbackupd/BackupClientInodeToIDMap.cpp	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/bin/bbackupd/BackupClientInodeToIDMap.cpp	2005-12-31 14:04:39 UTC (rev 295)
@@ -14,7 +14,7 @@
 	#include <sys/types.h>
 	#include <fcntl.h>
 	#include <limits.h>
-	#include DB_HEADER
+	#include <db.h>
 	#include <sys/stat.h>
 #endif
 
@@ -65,7 +65,7 @@
 #ifndef BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION
 	if(dbp != 0)
 	{
-#ifdef BERKELY_V4
+#if BDB_VERSION_MAJOR >= 3
 		dbp->close(0);
 #else
 		dbp->close(dbp);
@@ -94,7 +94,7 @@
 	ASSERT(!mEmpty);
 	
 	// Open the database file
-#ifdef BERKELY_V4
+#if BDB_VERSION_MAJOR >= 3
 	dbp = new Db(0,0);
 	dbp->set_pagesize(1024);		/* Page size: 1K. */
 	dbp->set_cachesize(0, 32 * 1024, 0);
@@ -146,7 +146,7 @@
 #ifndef BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION
 	if(dbp != 0)
 	{
-#ifdef BERKELY_V4
+#if BDB_VERSION_MAJOR >= 3
 		if(dbp->close(0) != 0)
 #else
 		if(dbp->close(dbp) != 0)
@@ -188,7 +188,7 @@
 	rec.mObjectID = ObjectID;
 	rec.mInDirectory = InDirectory;
 
-#ifdef BERKELY_V4
+#if BDB_VERSION_MAJOR >= 3
 	Dbt key(&InodeRef, sizeof(InodeRef));
 	Dbt data(&rec, sizeof(rec));
 
@@ -250,7 +250,7 @@
 		THROW_EXCEPTION(BackupStoreException, InodeMapNotOpen);
 	}
 
-#ifdef BERKELY_V4
+#if BDB_VERSION_MAJOR >= 3
 	Dbt key(&InodeRef, sizeof(InodeRef));
 	Dbt data(0, 0);
 	switch(dbp->get(NULL, &key, &data, 0))
@@ -280,7 +280,7 @@
 	}
 
 	// Check for sensible return
-#ifdef BERKELY_V4
+#if BDB_VERSION_MAJOR >= 3
 	if(key.get_data() == 0 || data.get_size() != sizeof(IDBRecord))
 	{
 		// Assert in debug version

Modified: box/chris/boxi/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/boxi/bin/bbackupd/BackupDaemon.cpp	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/bin/bbackupd/BackupDaemon.cpp	2005-12-31 14:04:39 UTC (rev 295)
@@ -64,7 +64,7 @@
 
 #include "MemLeakFindOn.h"
 
-#define 	MAX_SLEEP_TIME	((unsigned int)1024)
+static const time_t MAX_SLEEP_TIME = 1024;
 
 // Make the actual sync period have a little bit of extra time, up to a 64th of the main sync period.
 // This prevents repetative cycles of load on the server
@@ -441,16 +441,16 @@
 	// Setup various timings
 	
 	// How often to connect to the store (approximate)
-	box_time_t updateStoreInterval = SecondsToBoxTime((uint32_t)conf.GetKeyValueInt("UpdateStoreInterval"));
+	box_time_t updateStoreInterval = SecondsToBoxTime(conf.GetKeyValueInt("UpdateStoreInterval"));
 
 	// But are we connecting automatically?
 	bool automaticBackup = conf.GetKeyValueBool("AutomaticBackup");
 	
 	// The minimum age a file needs to be before it will be considered for uploading
-	box_time_t minimumFileAge = SecondsToBoxTime((uint32_t)conf.GetKeyValueInt("MinimumFileAge"));
+	box_time_t minimumFileAge = SecondsToBoxTime(conf.GetKeyValueInt("MinimumFileAge"));
 
 	// The maximum time we'll wait to upload a file, regardless of how often it's modified
-	box_time_t maxUploadWait = SecondsToBoxTime((uint32_t)conf.GetKeyValueInt("MaxUploadWait"));
+	box_time_t maxUploadWait = SecondsToBoxTime(conf.GetKeyValueInt("MaxUploadWait"));
 	// Adjust by subtracting the minimum file age, so is relative to sync period end in comparisons
 	maxUploadWait = (maxUploadWait > minimumFileAge)?(maxUploadWait - minimumFileAge):(0);
 
@@ -487,7 +487,8 @@
 				// Pause a while, but no more than MAX_SLEEP_TIME seconds (use the conditional because times are unsigned)
 				box_time_t requiredDelay = (nextSyncTime < currentTime)?(0):(nextSyncTime - currentTime);
 				// If there isn't automatic backup happening, set a long delay. And limit delays at the same time.
-				if(!automaticBackup || requiredDelay > SecondsToBoxTime((uint32_t)MAX_SLEEP_TIME)) requiredDelay = SecondsToBoxTime((uint32_t)MAX_SLEEP_TIME);
+				if(!automaticBackup || requiredDelay > SecondsToBoxTime(MAX_SLEEP_TIME))
+					requiredDelay = SecondsToBoxTime(MAX_SLEEP_TIME);
 
 				// Only do the delay if there is a delay required
 				if(requiredDelay > 0)
@@ -502,7 +503,7 @@
 					else
 					{
 						// No command socket or connection, just do a normal sleep
-						int sleepSeconds = BoxTimeToSeconds(requiredDelay);
+						time_t sleepSeconds = BoxTimeToSeconds(requiredDelay);
 						::sleep((sleepSeconds <= 0)?1:sleepSeconds);
 					}
 				}
@@ -527,7 +528,7 @@
 			if(d > 0)
 			{
 				// Script has asked for a delay
-				nextSyncTime = GetCurrentBoxTime() + SecondsToBoxTime((uint32_t)d);
+				nextSyncTime = GetCurrentBoxTime() + SecondsToBoxTime(d);
 			}
 			else
 			{
@@ -567,7 +568,7 @@
 				// files which are modified after the scan run started.
 				// Of course, they may be eligable to be synced again the next time round,
 				// but this should be OK, because the changes only upload should upload no data.
-				syncPeriodEndExtended += SecondsToBoxTime((uint32_t)(356*24*3600));
+				syncPeriodEndExtended += SecondsToBoxTime((time_t)(356*24*3600));
 			}
 			
 			// Do sync
@@ -593,7 +594,7 @@
 				params.mMaxUploadWait = maxUploadWait;
 				params.mFileTrackingSizeThreshold = conf.GetKeyValueInt("FileTrackingSizeThreshold");
 				params.mDiffingUploadSizeThreshold = conf.GetKeyValueInt("DiffingUploadSizeThreshold");
-				params.mMaxFileTimeInFuture = SecondsToBoxTime((uint32_t)conf.GetKeyValueInt("MaxFileTimeInFuture"));
+				params.mMaxFileTimeInFuture = SecondsToBoxTime(conf.GetKeyValueInt("MaxFileTimeInFuture"));
 				params.mpCommandSocket = mpCommandSocketInfo;
 				
 				// Set store marker
@@ -1137,7 +1138,7 @@
 		ASSERT(mUnusedRootDirEntries.size() > 0);
 		// Time to delete them
 		mDeleteUnusedRootDirEntriesAfter =
-			GetCurrentBoxTime() + SecondsToBoxTime((uint32_t)BACKUP_DELETE_UNUSED_ROOT_ENTRIES_AFTER);
+			GetCurrentBoxTime() + SecondsToBoxTime(BACKUP_DELETE_UNUSED_ROOT_ENTRIES_AFTER);
 	}
 }
 
@@ -1423,40 +1424,6 @@
   	{
  		mpCommandSocketInfo->SendStateUpdate(mState);
 	}
-
-	char newState[64];
-	char newStateSize = sprintf(newState, "state %d\n", State);
-
-#ifdef WIN32
-	#warning FIX ME: race condition
-	// what happens if the socket is closed by the other thread before
-	// we can write to it? Null pointer deref at best.
-	if (mpCommandSocketInfo && 
-	    mpCommandSocketInfo->mListeningSocket.IsConnected())
-	{
-		try
-		{
-			mpCommandSocketInfo->mListeningSocket.Write(newState, newStateSize);
-		}
-		catch(...)
-		{
-			CloseCommandConnection();
-		}
-	}
-#else
-	if(mpCommandSocketInfo != 0 && mpCommandSocketInfo->mpConnectedSocket.get() != 0)
-	{
-		// Something connected to the command socket, tell it about the new state
-		try
-		{
-			mpCommandSocketInfo->mpConnectedSocket->Write(newState, newStateSize);
-		}
-		catch(...)
-		{
-			CloseCommandConnection();
-		}
-	}
-#endif
 }
 
 

Modified: box/chris/boxi/bin/bbackupd/BackupDaemon.h
===================================================================
--- box/chris/boxi/bin/bbackupd/BackupDaemon.h	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/bin/bbackupd/BackupDaemon.h	2005-12-31 14:04:39 UTC (rev 295)
@@ -19,6 +19,10 @@
 #include "BackupClientContext.h"
 #include "BackupClientDirectoryRecord.h"
 
+#ifndef WIN32
+	#include <syslog.h>
+#endif
+
 class Configuration;
 class BackupClientInodeToIDMap;
 class ExcludeList;

Modified: box/chris/boxi/bin/bbackupd/CommandSocketManager.cpp
===================================================================
--- box/chris/boxi/bin/bbackupd/CommandSocketManager.cpp	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/bin/bbackupd/CommandSocketManager.cpp	2005-12-31 14:04:39 UTC (rev 295)
@@ -7,7 +7,9 @@
 //
 // --------------------------------------------------------------------------
 
-#include <syslog.h>
+#ifndef WIN32
+	#include <syslog.h>
+#endif
 
 #include "Box.h"
 #include "IOStreamGetLine.h"


Property changes on: box/chris/boxi/bin/bbackupobjdump
___________________________________________________________________
Name: svn:ignore
   + Makefile



Property changes on: box/chris/boxi/bin/bbackupquery
___________________________________________________________________
Name: svn:ignore
   + autogen_Documentation.cpp
Makefile


Modified: box/chris/boxi/bin/bbackupquery/BackupQueries.cpp
===================================================================
--- box/chris/boxi/bin/bbackupquery/BackupQueries.cpp	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/bin/bbackupquery/BackupQueries.cpp	2005-12-31 14:04:39 UTC (rev 295)
@@ -979,7 +979,7 @@
 		{
 			// Files modified after this time shouldn't be on the server, so report errors slightly differently
 			params.mLatestFileUploadTime = FileModificationTime(st)
-					- SecondsToBoxTime((uint32_t)mrConfiguration.GetKeyValueInt("MinimumFileAge"));
+					- SecondsToBoxTime(mrConfiguration.GetKeyValueInt("MinimumFileAge"));
 		}
 		else
 		{


Property changes on: box/chris/boxi/bin/bbstoreaccounts
___________________________________________________________________
Name: svn:ignore
   + Makefile



Property changes on: box/chris/boxi/bin/bbstored
___________________________________________________________________
Name: svn:ignore
   + autogen_BackupProtocolServer.cpp
autogen_BackupProtocolServer.h
Makefile


Modified: box/chris/boxi/bin/bbstored/BBStoreDHousekeeping.cpp
===================================================================
--- box/chris/boxi/bin/bbstored/BBStoreDHousekeeping.cpp	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/bin/bbstored/BBStoreDHousekeeping.cpp	2005-12-31 14:04:39 UTC (rev 295)
@@ -33,7 +33,7 @@
 {
 	// Get the time between housekeeping runs
 	const Configuration &rconfig(GetConfiguration());
-	int64_t housekeepingInterval = SecondsToBoxTime((uint32_t)rconfig.GetKeyValueInt("TimeBetweenHousekeeping"));
+	int64_t housekeepingInterval = SecondsToBoxTime(rconfig.GetKeyValueInt("TimeBetweenHousekeeping"));
 	
 	int64_t lastHousekeepingRun = 0;
 
@@ -108,7 +108,7 @@
 		
 		// Calculate how long should wait before doing the next housekeeping run
 		timeNow = GetCurrentBoxTime();
-		int64_t secondsToGo = BoxTimeToSeconds((lastHousekeepingRun + housekeepingInterval) - timeNow);
+		time_t secondsToGo = BoxTimeToSeconds((lastHousekeepingRun + housekeepingInterval) - timeNow);
 		if(secondsToGo < 1) secondsToGo = 1;
 		if(secondsToGo > 60) secondsToGo = 60;
 		int32_t millisecondsToGo = ((int)secondsToGo) * 1000;

Modified: box/chris/boxi/configure.ac
===================================================================
--- box/chris/boxi/configure.ac	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/configure.ac	2005-12-31 14:04:39 UTC (rev 295)
@@ -4,11 +4,10 @@
 AC_PREREQ(2.59)
 AC_INIT([Box Backup], 0.09, [box@fluffy.co.uk])
 AC_CONFIG_SRCDIR([lib/common/Box.h])
-AC_CONFIG_HEADERS([lib/common/config.h])
+AC_CONFIG_HEADERS([lib/common/BoxConfig.h])
 
 touch install-sh
 AC_CANONICAL_SYSTEM
-# echo "Build target OS: '$target_os'"
 test -s install-sh || rm install-sh
 
 ### Checks for programs.
@@ -30,18 +29,30 @@
 
 
 ### Checks for libraries.
+
 if test "$target_os" != "mingw32" -a "$target_os" != "winnt"; then
-AC_SEARCH_LIBS([nanosleep], [rt], [ac_have_nanosleep=yes], 
-	[AC_MSG_ERROR([[Cannot find a short sleep function (nanosleep)]])])
+  AC_SEARCH_LIBS([nanosleep], [rt], [ac_have_nanosleep=yes],
+                 [AC_MSG_ERROR([[cannot find a short sleep function (nanosleep)]])])
 fi
-
-AC_CHECK_LIB([z], [zlibVersion],, [AC_MSG_ERROR([[Cannot find zlib]])])
-AX_CHECK_BDB_V1
+AC_CHECK_LIB([z], [zlibVersion],, [AC_MSG_ERROR([[cannot find zlib]])])
 VL_LIB_READLINE
 have_libreadline=no
 test "x$vl_cv_lib_readline" != "xno" && have_libreadline=yes
 
+## Check for Berkely DB. Restrict to certain versions
+AX_PATH_BDB(, [
+  LIBS="$BDB_LIBS $LIBS"
+  LDFLAGS="$BDB_LDFLAGS $LDFLAGS"
+  CPPFLAGS="$CPPFLAGS $BDB_CPPFLAGS"
 
+  AX_COMPARE_VERSION([$BDB_VERSION],[ge],[4.1],,
+    [AX_COMPARE_VERSION([$BDB_VERSION],[lt],[2],,
+      [AC_MSG_ERROR([[only Berkely DB versions 1.x or at least 4.1 are currently supported]])]
+      )]
+  )
+  AX_SPLIT_VERSION([BDB_VERSION], [$BDB_VERSION])
+])
+
 ## Check for Open SSL, use old versions only if explicitly requested
 AX_CHECK_SSL(, [AC_MSG_ERROR([[OpenSSL is not installed but is required]])])
 AC_ARG_ENABLE(
@@ -66,6 +77,7 @@
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS([execinfo.h netinet/in.h regex.h sys/types.h sys/xattr.h])
+AC_CHECK_HEADERS([sys/endian.h asm/byteorder.h])
 
 
 ### Checks for typedefs, structures, and compiler characteristics.
@@ -95,12 +107,14 @@
 AC_SYS_LARGEFILE
 AX_CHECK_LLONG_MINMAX
 AX_CHECK_DEFINE_PRAGMA
-
 if test "$target_os" != "mingw32"; then
-AX_RANDOM_DEVICE
+  AX_RANDOM_DEVICE
 fi
-
-AX_CHECK_MOUNT_POINT([],[])
+AX_CHECK_MOUNT_POINT(,[
+  if test "$target_os" != "mingw32" -a "$target_os" != "winnt"; then
+    AC_MSG_ERROR([[cannot work out how to discover mount points on your platform]])
+  fi
+  ])
 AX_CHECK_MALLOC_WORKAROUND
 
 
@@ -134,6 +148,13 @@
 AC_CHECK_FUNCS([flock])
 AC_CHECK_DECLS([O_EXLOCK],,, [[#include <fcntl.h>]])
 AC_CHECK_DECLS([F_SETLK],,, [[#include <fcntl.h>]])
+if test "x$ac_cv_func_flock" != "xyes" && \
+   test "x$ac_cv_have_decl_O_EXLOCK" != "xyes" && \
+   test "x$ac_cv_have_decl_F_SETLK" != "xyes" && \
+   test "$target_os" != "mingw32" -a "$target_os" != "winnt"
+then
+  AC_MSG_ERROR([[cannot work out how to do file locking on your platform]])
+fi
 
 ## Get tmpdir
 temp_directory_name="/tmp"
@@ -148,7 +169,7 @@
   [static-bin],
   [AC_HELP_STRING([--enable-static-bin], [Link binaries with static libraries])])
 if test "x$enable_static_bin" = "xyes"; then
-  AC_CHECK_LIB([ssl],[SSL_read],[],[],[crypto])
+  AC_CHECK_LIB([ssl],[SSL_read],,, [crypto])
   LIBS="-Wl,-Bstatic $LIBS -Wl,-Bdynamic"
 fi
 
@@ -169,7 +190,7 @@
 to the documentation for more information on each feature.
 
 Large files:         $have_large_file_support
-Berkeley DB:         $ac_have_bdb
+Berkeley DB:         $ax_path_bdb_ok
 Readline:            $have_libreadline
 Extended attributes: $ac_cv_header_sys_xattr_h
 EOC
@@ -195,8 +216,3 @@
 libedit or libeditline instead.]])
     ;;
 esac
-
-if test "x$ac_have_bdb" != "xyes"; then
-  echo
-  AC_MSG_WARN([[db is not installed -- will run in reduced efficiency mode without it]])
-fi

Modified: box/chris/boxi/distribution/COMMON-MANIFEST.txt
===================================================================
--- box/chris/boxi/distribution/COMMON-MANIFEST.txt	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/distribution/COMMON-MANIFEST.txt	2005-12-31 14:04:39 UTC (rev 295)
@@ -15,10 +15,15 @@
 MKDIR infrastructure
 infrastructure/buildenv-testmain-template.cpp
 infrastructure/makebuildenv.pl
-infrastructure/BoxPlatform.pm
+infrastructure/BoxPlatform.pm.in
 infrastructure/makeparcels.pl
-MKDIR infrastructure/tests
-infrastructure/tests/common_tests.pl
+configure.ac
+NO-LICENSE config.sub
+config.sub
+NO-LICENSE config.guess
+config.guess
+bootstrap
 parcels.txt
-configure
 runtest.pl
+NO-LICENSE-IN-DIR infrastructure/m4
+infrastructure/m4

Modified: box/chris/boxi/distribution/boxbackup/DISTRIBUTION-MANIFEST.txt
===================================================================
--- box/chris/boxi/distribution/boxbackup/DISTRIBUTION-MANIFEST.txt	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/distribution/boxbackup/DISTRIBUTION-MANIFEST.txt	2005-12-31 14:04:39 UTC (rev 295)
@@ -3,9 +3,11 @@
 test/raidfile/testfiles
 lib/backupclient
 lib/backupstore
+lib/win32
 bin/bbstored
 bin/bbstoreaccounts
 bin/bbackupd
+bin/bbackupd/win32
 bin/bbackupquery
 bin/bbackupctl
 bin/bbackupobjdump

Modified: box/chris/boxi/distribution/boxbackup/VERSION.txt
===================================================================
--- box/chris/boxi/distribution/boxbackup/VERSION.txt	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/distribution/boxbackup/VERSION.txt	2005-12-31 14:04:39 UTC (rev 295)
@@ -1,2 +1,2 @@
-0.08
+0.09_trunk
 boxbackup

Modified: box/chris/boxi/distribution/boxbackup/contrib/rpm/boxbackup.spec
===================================================================
--- box/chris/boxi/distribution/boxbackup/contrib/rpm/boxbackup.spec	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/distribution/boxbackup/contrib/rpm/boxbackup.spec	2005-12-31 14:04:39 UTC (rev 295)
@@ -3,7 +3,7 @@
 
 # Detect distribution. So far we only special-case SUSE. If you need to make
 # any distro specific changes to get the package building on your system
-# please email them to martin@zepler.org
+# please email them to boxbackup-dev@fluffy.co.uk
 #%define is_fc   %(test -e %{_sysconfdir}/fedora-release && echo 1 || echo 0)
 #%define is_mdk  %(test -e %{_sysconfdir}/mandrake-release && echo 1 || echo 0)
 #%define is_rh   %(test -e %{_sysconfdir}/redhat-release && echo 1 || echo 0)
@@ -25,7 +25,7 @@
 Release: 1
 License: BSD
 Group: Applications/Archiving
-Packager: Martin Ebourne <martin@zepler.org>
+Packager: Martin Ebourne <boxbackup-dev@fluffy.co.uk>
 URL: http://www.fluffy.co.uk/boxbackup/
 Source0: %{ident}.tgz
 Requires: openssl >= 0.9.7a
@@ -72,7 +72,8 @@
 %setup -q
 
 %build
-./configure
+test -e configure || ./bootstrap
+%configure
 
 make
 
@@ -194,6 +195,9 @@
 %{_sbindir}/raidfile-config
 
 %changelog
+* Wed Dec 28 2005 Martin Ebourne <martin@zepler.org>
+- Box now uses autoconf so use configure macro
+
 * Fri Oct  1 2004 Martin Ebourne <martin@zepler.org> - 0.08-3
 - Moved most of the exes to /usr/sbin
 - SUSE updates from Chris Smith


Property changes on: box/chris/boxi/infrastructure
___________________________________________________________________
Name: svn:ignore
   + BoxPlatform.pm


Modified: box/chris/boxi/infrastructure/m4/ax_check_bdb_v1.m4
===================================================================
--- box/chris/boxi/infrastructure/m4/ax_check_bdb_v1.m4	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/infrastructure/m4/ax_check_bdb_v1.m4	2005-12-31 14:04:39 UTC (rev 295)
@@ -18,9 +18,9 @@
                    [ac_bdb_header=$ac_header; break], [ac_bdb_header=""])
   if test "x$ac_bdb_header" != x; then
     AC_SEARCH_LIBS([__db185_open],
-                   [db db-4.3 db-4.2 db-4.1 db-4.0 db-3],
+                   [db db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db4 db-3 db3],
                    [ac_have_bdb=yes],
-                   [AC_SEARCH_LIBS([dbopen], [db-1 db], [ac_have_bdb=yes])])
+                   [AC_SEARCH_LIBS([dbopen], [db-1 db1 db], [ac_have_bdb=yes])])
   fi
   if test "x$ac_have_bdb" = "xyes"; then
     AC_MSG_CHECKING([whether found db libraries work])

Modified: box/chris/boxi/infrastructure/m4/ax_check_mount_point.m4
===================================================================
--- box/chris/boxi/infrastructure/m4/ax_check_mount_point.m4	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/infrastructure/m4/ax_check_mount_point.m4	2005-12-31 14:04:39 UTC (rev 295)
@@ -19,10 +19,18 @@
 
 AC_DEFUN([AX_CHECK_MOUNT_POINT], [
   AC_CHECK_FUNCS([getmntent statfs])
-  AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/mount.h],,, [[#include <stdio.h>]])
+  AC_CHECK_HEADERS([sys/param.h])
+  AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/mount.h],,, [[
+    #include <stdio.h>
+    #ifdef HAVE_SYS_PARAM_H
+      #include <sys/param.h>
+    #endif
+    ]])
   # BSD
   AC_CHECK_MEMBERS([struct statfs.f_mntonname],,, [[
-    #include <sys/param.h>
+    #ifdef HAVE_SYS_PARAM_H
+      #include <sys/param.h>
+    #endif
     #include <sys/mount.h>
     ]])
   # Linux

Copied: box/chris/boxi/infrastructure/m4/ax_compare_version.m4 (from rev 294, box/trunk/infrastructure/m4/ax_compare_version.m4)

Copied: box/chris/boxi/infrastructure/m4/ax_path_bdb.m4 (from rev 294, box/trunk/infrastructure/m4/ax_path_bdb.m4)

Copied: box/chris/boxi/infrastructure/m4/ax_split_version.m4 (from rev 294, box/trunk/infrastructure/m4/ax_split_version.m4)

Modified: box/chris/boxi/infrastructure/makedistribution.pl
===================================================================
--- box/chris/boxi/infrastructure/makedistribution.pl	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/infrastructure/makedistribution.pl	2005-12-31 14:04:39 UTC (rev 295)
@@ -78,6 +78,10 @@
 		{
 			replace_version_in($dst);
 		}
+		elsif($src eq 'NO-LICENSE')
+		{
+			$no_license{$dst} = 1;
+		}
 		elsif(-d $src)
 		{
 			$modules_included{$_} = 1;
@@ -205,8 +209,8 @@
 		}
 	}
 	
-	# make sure perl scripts are marked as executable, and other things aren't
-	if($ext eq 'pl' || $ext eq '')
+	# copy executable bit from src
+	if(-x $fn)
 	{
 		system 'chmod','a+x',"$base_name/$dst_fn"
 	}


Property changes on: box/chris/boxi/lib/backupclient
___________________________________________________________________
Name: svn:ignore
   + autogen_BackupProtocolClient.cpp
autogen_BackupProtocolClient.h
autogen_BackupStoreException.cpp
autogen_BackupStoreException.h
Makefile


Modified: box/chris/boxi/lib/backupclient/BackupStoreFile.h
===================================================================
--- box/chris/boxi/lib/backupclient/BackupStoreFile.h	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/lib/backupclient/BackupStoreFile.h	2005-12-31 14:04:39 UTC (rev 295)
@@ -123,19 +123,20 @@
 		uint8_t *a = (uint8_t*)malloc((Size) + (BACKUPSTOREFILE_CODING_BLOCKSIZE * 3));
 		if(a == 0) return 0;
 		// Align to main block size
-		ASSERT(sizeof(uint32_t) == sizeof(void*));	// make sure casting the right pointer size, will need to fix on platforms with 64 bit pointers
-		uint32_t adjustment = BACKUPSTOREFILE_CODING_BLOCKSIZE - (((uint32_t)(long)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE);
+		ASSERT(sizeof(unsigned long) >= sizeof(void*));	// make sure casting the right pointer size
+		uint8_t adjustment = BACKUPSTOREFILE_CODING_BLOCKSIZE
+							  - (uint8_t)(((unsigned long)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE);
 		uint8_t *b = (a + adjustment);
 		// Store adjustment
-		*b = (uint8_t)adjustment;
+		*b = adjustment;
 		// Return offset
 		return b + BACKUPSTOREFILE_CODING_OFFSET;
 	}
 	inline static void CodingChunkFree(void *Block)
 	{
 		// Check alignment is as expected
-		ASSERT(sizeof(uint32_t) == sizeof(void*));	// make sure casting the right pointer size, will need to fix on platforms with 64 bit pointers
-		ASSERT((((uint32_t)(long)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
+		ASSERT(sizeof(unsigned long) >= sizeof(void*));	// make sure casting the right pointer size
+		ASSERT((uint8_t)(((unsigned long)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
 		uint8_t *a = (uint8_t*)Block;
 		a -= BACKUPSTOREFILE_CODING_OFFSET;
 		// Adjust downwards...


Property changes on: box/chris/boxi/lib/backupstore
___________________________________________________________________
Name: svn:ignore
   + Makefile



Property changes on: box/chris/boxi/lib/common
___________________________________________________________________
Name: svn:ignore
   + autogen_CommonException.cpp
autogen_CommonException.h
autogen_ConversionException.cpp
autogen_ConversionException.h
BoxConfig.h
BoxConfig.h.in
Makefile



Modified: box/chris/boxi/lib/common/Box.h
===================================================================
--- box/chris/boxi/lib/common/Box.h	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/lib/common/Box.h	2005-12-31 14:04:39 UTC (rev 295)
@@ -114,6 +114,10 @@
 
 // extra macros for converting to network byte order
 
+#ifdef HAVE_NETINET_IN_H
+	#include <netinet/in.h>
+#endif
+
 // Always define a swap64 function, as it's useful.
 inline uint64_t box_swap64(uint64_t x)
 {
@@ -131,13 +135,21 @@
 	#define box_hton64(x) (x)
 	#define box_ntoh64(x) (x)
 #else
-	#define box_hton64(x) box_swap64(x)
-	#define box_ntoh64(x) box_swap64(x)
+	#ifdef HAVE_SYS_ENDIAN_H
+		#include <sys/endian.h>
+		// betoh64 (OpenBSD) is sometimes called be64toh (FreeBSD, NetBSD).
+		// Rather than check for it just reuse htobe64 since they are symmetrical
+		#define box_hton64(x) htobe64(x)
+		#define box_ntoh64(x) htobe64(x)
+	#elif HAVE_ASM_BYTEORDER_H
+		#include <asm/byteorder.h>
+		#define box_hton64(x) __cpu_to_be64(x)
+		#define box_ntoh64(x) __be64_to_cpu(x)
+	#else
+		#define box_hton64(x) box_swap64(x)
+		#define box_ntoh64(x) box_swap64(x)
+	#endif
 #endif
 
-#ifdef HAVE_NETINET_IN_H
-	#include <netinet/in.h>
-#endif
-
 #endif // BOX__H
 

Modified: box/chris/boxi/lib/common/BoxPlatform.h
===================================================================
--- box/chris/boxi/lib/common/BoxPlatform.h	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/lib/common/BoxPlatform.h	2005-12-31 14:04:39 UTC (rev 295)
@@ -21,7 +21,7 @@
 
 #define PLATFORM_DEV_NULL			"/dev/null"
 
-#include "config.h"
+#include "BoxConfig.h"
 
 #ifdef WIN32
 	// need msvcrt version 6.1 or higher for _gmtime64()

Modified: box/chris/boxi/lib/common/BoxTime.cpp
===================================================================
--- box/chris/boxi/lib/common/BoxTime.cpp	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/lib/common/BoxTime.cpp	2005-12-31 14:04:39 UTC (rev 295)
@@ -25,8 +25,7 @@
 // --------------------------------------------------------------------------
 box_time_t GetCurrentBoxTime()
 {
-	ASSERT(sizeof(uint32_t) == sizeof(time_t));
-	return SecondsToBoxTime((uint32_t)time(0));
+	return SecondsToBoxTime(time(0));
 }
 
 

Modified: box/chris/boxi/lib/common/BoxTime.h
===================================================================
--- box/chris/boxi/lib/common/BoxTime.h	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/lib/common/BoxTime.h	2005-12-31 14:04:39 UTC (rev 295)
@@ -23,19 +23,15 @@
 
 box_time_t GetCurrentBoxTime();
 
-inline box_time_t SecondsToBoxTime(uint32_t Seconds)
+inline box_time_t SecondsToBoxTime(time_t Seconds)
 {
 	return ((box_time_t)Seconds * MICRO_SEC_IN_SEC_LL);
 }
-inline box_time_t SecondsToBoxTime(uint64_t Seconds)
+inline time_t BoxTimeToSeconds(box_time_t Time)
 {
-	return ((box_time_t)Seconds * MICRO_SEC_IN_SEC_LL);
-}
-inline box_time_t BoxTimeToSeconds(box_time_t Time)
-{
 	return Time / MICRO_SEC_IN_SEC_LL;
 }
-inline box_time_t BoxTimeToMilliSeconds(box_time_t Time)
+inline uint64_t BoxTimeToMilliSeconds(box_time_t Time)
 {
 	return Time / MILLI_SEC_IN_NANO_SEC_LL;
 }

Modified: box/chris/boxi/lib/common/BoxTimeToText.cpp
===================================================================
--- box/chris/boxi/lib/common/BoxTimeToText.cpp	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/lib/common/BoxTimeToText.cpp	2005-12-31 14:04:39 UTC (rev 295)
@@ -29,7 +29,7 @@
 {
 #ifdef WIN32
 	struct tm *time;
-	box_time_t bob = BoxTimeToSeconds(Time);
+	time_t bob = BoxTimeToSeconds(Time);
 
 	__time64_t winTime = bob;
 
@@ -46,7 +46,7 @@
 		time->tm_mon + 1, time->tm_mday, time->tm_hour, 
 		time->tm_min, time->tm_sec);
 #else // ! WIN32
-	time_t timeInSecs = (time_t)BoxTimeToSeconds(Time);
+	time_t timeInSecs = BoxTimeToSeconds(Time);
 	struct tm time;
 	gmtime_r(&timeInSecs, &time);
 	

Modified: box/chris/boxi/lib/common/ConversionString.cpp
===================================================================
--- box/chris/boxi/lib/common/ConversionString.cpp	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/lib/common/ConversionString.cpp	2005-12-31 14:04:39 UTC (rev 295)
@@ -72,11 +72,17 @@
 	{
 	case 32:
 		{
-			// No extra checking needed, if this assert holds true
-			ASSERT(sizeof(long) == sizeof(int32_t));
+			// No extra checking needed if long is an int32
+			if(sizeof(long) > sizeof(int32_t))
+			{
+				if(r <= (0 - 0x7fffffffL) || r > 0x7fffffffL)
+				{
+					THROW_EXCEPTION(ConversionException, IntOverflowInConvertFromString)
+				}
+			}
+			break;
 		}
-		break;
-		
+
 	case 16:
 		{
 			if(r <= (0 - 0x7fff) || r > 0x7fff)

Modified: box/chris/boxi/lib/common/Utils.cpp
===================================================================
--- box/chris/boxi/lib/common/Utils.cpp	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/lib/common/Utils.cpp	2005-12-31 14:04:39 UTC (rev 295)
@@ -76,7 +76,9 @@
 	for(i = 0; i < size; i++)
 		printf("%s\n", strings[i]);
 
+#ifndef MEMLEAKFINDER_MALLOC_MONITORING_DEFINED
 	free (strings);
+#endif
 }
 #endif
 


Property changes on: box/chris/boxi/lib/compress
___________________________________________________________________
Name: svn:ignore
   + autogen_CompressException.cpp
autogen_CompressException.h
Makefile



Property changes on: box/chris/boxi/lib/crypto
___________________________________________________________________
Name: svn:ignore
   + autogen_CipherException.cpp
autogen_CipherException.h
Makefile



Property changes on: box/chris/boxi/lib/raidfile
___________________________________________________________________
Name: svn:ignore
   + autogen_RaidFileException.cpp
autogen_RaidFileException.h
Makefile



Property changes on: box/chris/boxi/lib/server
___________________________________________________________________
Name: svn:ignore
   + autogen_ConnectionException.cpp
autogen_ConnectionException.h
autogen_ServerException.cpp
autogen_ServerException.h
Makefile



Property changes on: box/chris/boxi/lib/win32
___________________________________________________________________
Name: svn:ignore
   + Makefile



Property changes on: box/chris/boxi/test/backupdiff
___________________________________________________________________
Name: svn:ignore
   + _main.cpp
Makefile
_t
_t-gdb


Modified: box/chris/boxi/test/backupdiff/testbackupdiff.cpp
===================================================================
--- box/chris/boxi/test/backupdiff/testbackupdiff.cpp	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/test/backupdiff/testbackupdiff.cpp	2005-12-31 14:04:39 UTC (rev 295)
@@ -487,7 +487,7 @@
 			2000 /* object ID of the file diffing from */, blockindex, IOStream::TimeOutInfinite,
 			0, 0));
 		encoded->CopyStreamTo(out);
-		TEST_THAT(time(0) < (beginTime + 20));
+		TEST_THAT(time(0) < (beginTime + 40));
 	}
 	// Remove zero-files to save disk space
 	remove("testfiles/zero.0");


Property changes on: box/chris/boxi/test/backupstore
___________________________________________________________________
Name: svn:ignore
   + _main.cpp
Makefile
_t
_t-gdb



Property changes on: box/chris/boxi/test/backupstorefix
___________________________________________________________________
Name: svn:ignore
   + _main.cpp
Makefile
_t
_t-gdb



Property changes on: box/chris/boxi/test/backupstorepatch
___________________________________________________________________
Name: svn:ignore
   + _main.cpp
Makefile
_t
_t-gdb



Property changes on: box/chris/boxi/test/basicserver
___________________________________________________________________
Name: svn:ignore
   + autogen_TestProtocolClient.cpp
autogen_TestProtocolClient.h
autogen_TestProtocolServer.cpp
autogen_TestProtocolServer.h
_main.cpp
Makefile
_t
_t-gdb



Property changes on: box/chris/boxi/test/bbackupd
___________________________________________________________________
Name: svn:ignore
   + _main.cpp
Makefile
_t
_t-gdb


Modified: box/chris/boxi/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/chris/boxi/test/bbackupd/testbbackupd.cpp	2005-12-28 15:09:19 UTC (rev 294)
+++ box/chris/boxi/test/bbackupd/testbbackupd.cpp	2005-12-31 14:04:39 UTC (rev 295)
@@ -452,7 +452,7 @@
 			fclose(f);
 			// and then move the time backwards!
 			struct timeval times[2];
-			BoxTimeToTimeval(SecondsToBoxTime((uint32_t)(365*24*60*60)), times[1]);
+			BoxTimeToTimeval(SecondsToBoxTime((time_t)(365*24*60*60)), times[1]);
 			times[0] = times[1];
 			TEST_THAT(::utimes("testfiles/TestDir1/sub23/rand.h", times) == 0);
 		}
@@ -646,7 +646,7 @@
 			fclose(f);
 			// and then move the time forwards!
 			struct timeval times[2];
-			BoxTimeToTimeval(GetCurrentBoxTime() + SecondsToBoxTime((uint32_t)(365*24*60*60)), times[1]);
+			BoxTimeToTimeval(GetCurrentBoxTime() + SecondsToBoxTime((time_t)(365*24*60*60)), times[1]);
 			times[0] = times[1];
 			TEST_THAT(::utimes("testfiles/TestDir1/sub23/in-the-future", times) == 0);
 		}


Property changes on: box/chris/boxi/test/common
___________________________________________________________________
Name: svn:ignore
   + _main.cpp
Makefile
_t
_t-gdb



Property changes on: box/chris/boxi/test/compress
___________________________________________________________________
Name: svn:ignore
   + _main.cpp
Makefile
_t
_t-gdb



Property changes on: box/chris/boxi/test/crypto
___________________________________________________________________
Name: svn:ignore
   + _main.cpp
Makefile
_t
_t-gdb



Property changes on: box/chris/boxi/test/raidfile
___________________________________________________________________
Name: svn:ignore
   + _main.cpp
Makefile
_t
_t-gdb