From subversion at boxbackup.org Sun Feb 7 21:41:28 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sun, 7 Feb 2010 21:41:28 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2603 - box/trunk/lib/common Message-ID: <20100207214129.D3D3832508E@www.boxbackup.org> Author: chris Date: 2010-02-07 21:41:03 +0000 (Sun, 07 Feb 2010) New Revision: 2603 Modified: box/trunk/lib/common/Box.h Log: Allow logging any std::ostringstream expression in THROW_EXCEPTION_MESSAGE, fixes compile error. Modified: box/trunk/lib/common/Box.h =================================================================== --- box/trunk/lib/common/Box.h 2010-01-31 22:57:46 UTC (rev 2602) +++ box/trunk/lib/common/Box.h 2010-02-07 21:41:03 UTC (rev 2603) @@ -119,8 +119,8 @@ { \ OPTIONAL_DO_BACKTRACE \ BOX_WARNING("Exception thrown: " \ - #type "(" #subtype ") (" message ") at " \ - __FILE__ "(" << __LINE__ << ")") \ + #type "(" #subtype ") (" << message << \ + ") at " __FILE__ "(" << __LINE__ << ")") \ } \ throw type(type::subtype, message); \ } From trac at boxbackup.org Mon Feb 8 14:10:59 2010 From: trac at boxbackup.org (Box Backup) Date: Mon, 08 Feb 2010 14:10:59 -0000 Subject: [Box Backup-commit] #64: Always a lot of 'has different attributes to store file' messages when comparing Message-ID: <040.7bf00f24ed0cfd1a888cbc690bdc3a82@boxbackup.org> #64: Always a lot of 'has different attributes to store file' messages when comparing ---------------------+------------------------------------------------------ Reporter: roy | Type: defect Status: new | Priority: normal Milestone: | Component: bbackupquery Version: 0.11rc2 | Keywords: different attributes, compare, ---------------------+------------------------------------------------------ When I compare my local files to the store (compare -a) I get a lot of messages saying: Local file 'xxxx' has different attributes to store file 'xxxx'. The problem is that it clutters the view from 'real' errors (different contents) and that the problem is never solved. Box Backup won't update the different attributes to those files ever if the timestamp is not changed. BTW I have not checked that the attributes are updated if the timestamp is changed, so maybe the attributes are never updated and only stored on initial upload. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From subversion at boxbackup.org Wed Feb 10 19:01:13 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Wed, 10 Feb 2010 19:01:13 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2604 - in box/trunk: bin/bbackupquery lib/backupclient lib/common Message-ID: <20100210190113.8FFAE32508E@www.boxbackup.org> Author: chris Date: 2010-02-10 19:01:12 +0000 (Wed, 10 Feb 2010) New Revision: 2604 Modified: box/trunk/bin/bbackupquery/bbackupquery.cpp box/trunk/lib/backupclient/BackupClientFileAttributes.cpp box/trunk/lib/common/Logging.cpp box/trunk/lib/common/Logging.h Log: Log more detailed info about backup comparison failures, for debugging. Enable -V option in bbackupquery, and document that -q, -v, -V and -W are allowed in the command-line help. Modified: box/trunk/bin/bbackupquery/bbackupquery.cpp =================================================================== --- box/trunk/bin/bbackupquery/bbackupquery.cpp 2010-02-07 21:41:03 UTC (rev 2603) +++ box/trunk/bin/bbackupquery/bbackupquery.cpp 2010-02-10 19:01:12 UTC (rev 2604) @@ -60,7 +60,7 @@ void PrintUsageAndExit() { - printf("Usage: bbackupquery [-q] [-w] " + printf("Usage: bbackupquery [-q*|v*|V|W] [-w] " #ifdef WIN32 "[-u] " #endif @@ -123,10 +123,10 @@ #endif #ifdef WIN32 - const char* validOpts = "qvwuc:l:o:O:W:"; + const char* validOpts = "qvVwuc:l:o:O:W:"; bool unicodeConsole = false; #else - const char* validOpts = "qvwc:l:o:O:W:"; + const char* validOpts = "qvVwc:l:o:O:W:"; #endif std::string fileLogFile; @@ -138,7 +138,7 @@ { switch(c) { - case 'q': + case 'q': { if(masterLevel == Log::NOTHING) { @@ -151,7 +151,7 @@ } break; - case 'v': + case 'v': { if(masterLevel == Log::EVERYTHING) { @@ -164,6 +164,12 @@ } break; + case 'V': + { + masterLevel = Log::EVERYTHING; + } + break; + case 'W': { masterLevel = Logging::GetNamedLevel(optarg); Modified: box/trunk/lib/backupclient/BackupClientFileAttributes.cpp =================================================================== --- box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-07 21:41:03 UTC (rev 2603) +++ box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-10 19:01:12 UTC (rev 2604) @@ -234,6 +234,10 @@ // Check sizes are the same, as a first check if(mpClearAttributes->GetSize() != rAttr.mpClearAttributes->GetSize()) { + BOX_TRACE("Attribute Compare: Attributes objects are " + "different sizes, cannot compare them: local " << + mpClearAttributes->GetSize() << " bytes, remote " << + rAttr.mpClearAttributes->GetSize() << " bytes"); return false; } @@ -241,15 +245,20 @@ // Bytes are checked in network order, but this doesn't matter as we're only checking for equality. attr_StreamFormat *a1 = (attr_StreamFormat*)mpClearAttributes->GetBuffer(); attr_StreamFormat *a2 = (attr_StreamFormat*)rAttr.mpClearAttributes->GetBuffer(); - - if(a1->AttributeType != a2->AttributeType - || a1->UID != a2->UID - || a1->GID != a2->GID - || a1->UserDefinedFlags != a2->UserDefinedFlags - || a1->Mode != a2->Mode) - { - return false; + + #define COMPARE(attribute, message) \ + if (a1->attribute != a2->attribute) \ + { \ + BOX_TRACE("Attribute Compare: " << message << " differ: " \ + "local " << a1->attribute << ", " \ + "remote " << a2->attribute); \ + return false; \ } + COMPARE(AttributeType, "Attribute types"); + COMPARE(UID, "UIDs"); + COMPARE(GID, "GIDs"); + COMPARE(UserDefinedFlags, "User-defined flags"); + COMPARE(Mode, "Modes"); if(!IgnoreModTime) { @@ -257,6 +266,9 @@ int t2 = a2->ModificationTime / 1000000; if(t1 != t2) { + BOX_TRACE("Attribute Compare: File modification " + "times differ: local " << t1 << ", " + "remote " << t2); return false; } } @@ -267,6 +279,9 @@ int t2 = a2->AttrModificationTime / 1000000; if(t1 != t2) { + BOX_TRACE("Attribute Compare: Attribute modification " + "times differ: local " << t1 << ", " + "remote " << t2); return false; } } @@ -276,8 +291,16 @@ if(size > sizeof(attr_StreamFormat)) { // Symlink strings don't match. This also compares xattrs - if(::memcmp(a1 + 1, a2 + 1, size - sizeof(attr_StreamFormat)) != 0) + int datalen = size - sizeof(attr_StreamFormat); + + if(::memcmp(a1 + 1, a2 + 1, datalen) != 0) { + std::string s1((char *)(a1 + 1), datalen); + std::string s2((char *)(a2 + 1), datalen); + BOX_TRACE("Attribute Compare: Symbolic link target " + "or extended attributes differ: " + "local " << PrintEscapedBinaryData(s1) << ", " + "remote " << PrintEscapedBinaryData(s2)); return false; } } Modified: box/trunk/lib/common/Logging.cpp =================================================================== --- box/trunk/lib/common/Logging.cpp 2010-02-07 21:41:03 UTC (rev 2603) +++ box/trunk/lib/common/Logging.cpp 2010-02-10 19:01:12 UTC (rev 2604) @@ -495,3 +495,24 @@ Logging::Add(this); return true; } + +std::string PrintEscapedBinaryData(const std::string& rInput) +{ + std::ostringstream output; + + for (size_t i = 0; i < rInput.length(); i++) + { + if (isprint(rInput[i])) + { + output << rInput[i]; + } + else + { + output << "\\x" << std::hex << std::setw(2) << + std::setfill('0') << (int) rInput[i] << + std::dec; + } + } + + return output.str(); +} Modified: box/trunk/lib/common/Logging.h =================================================================== --- box/trunk/lib/common/Logging.h 2010-02-07 21:41:03 UTC (rev 2603) +++ box/trunk/lib/common/Logging.h 2010-02-10 19:01:12 UTC (rev 2604) @@ -18,19 +18,8 @@ #include "FileStream.h" -/* #define BOX_LOG(level, stuff) \ { \ - if(Log::sMaxLoggingLevelForAnyOutput >= level) \ - std::ostringstream line; \ - line << stuff; \ - Log::Write(level, __FILE__, __LINE__, line.str()); \ - } \ -} -*/ - -#define BOX_LOG(level, stuff) \ -{ \ std::ostringstream _box_log_line; \ _box_log_line << stuff; \ Logging::Log(level, __FILE__, __LINE__, _box_log_line.str()); \ @@ -52,13 +41,21 @@ if (Logging::IsEnabled(Log::TRACE)) \ { BOX_LOG(Log::TRACE, stuff) } +#define BOX_SYS_ERROR(stuff) \ + stuff << ": " << std::strerror(errno) << " (" << errno << ")" + #define BOX_LOG_SYS_WARNING(stuff) \ - BOX_WARNING(stuff << ": " << std::strerror(errno) << " (" << errno << ")") + BOX_WARNING(BOX_SYS_ERROR(stuff)) #define BOX_LOG_SYS_ERROR(stuff) \ - BOX_ERROR(stuff << ": " << std::strerror(errno) << " (" << errno << ")") + BOX_ERROR(BOX_SYS_ERROR(stuff)) #define BOX_LOG_SYS_FATAL(stuff) \ - BOX_FATAL(stuff << ": " << std::strerror(errno) << " (" << errno << ")") + BOX_FATAL(BOX_SYS_ERROR(stuff)) +#define LOG_AND_THROW_ERROR(message, filename, exception, subtype) \ + BOX_LOG_SYS_ERROR(message << ": " << filename); \ + THROW_EXCEPTION_MESSAGE(exception, subtype, \ + BOX_SYS_ERROR(message << ": " << filename)); + inline std::string GetNativeErrorMessage() { #ifdef WIN32 @@ -339,4 +336,6 @@ bool mOldHiddenState; }; +std::string PrintEscapedBinaryData(const std::string& rInput); + #endif // LOGGING__H From subversion at boxbackup.org Thu Feb 11 08:39:38 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Thu, 11 Feb 2010 08:39:38 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2605 - box/chris/win32/releases Message-ID: <20100211083938.EE09D32508E@www.boxbackup.org> Author: chris Date: 2010-02-11 08:39:37 +0000 (Thu, 11 Feb 2010) New Revision: 2605 Added: box/chris/win32/releases/boxbackup-trunk_2604-backup-client-mingw32.zip Log: Add windows client release 2604 with compare attribute mismatch debugging. Added: box/chris/win32/releases/boxbackup-trunk_2604-backup-client-mingw32.zip =================================================================== (Binary files differ) Property changes on: box/chris/win32/releases/boxbackup-trunk_2604-backup-client-mingw32.zip ___________________________________________________________________ Added: svn:mime-type + application/octet-stream From subversion at boxbackup.org Mon Feb 15 12:42:01 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 15 Feb 2010 12:42:01 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2606 - box/trunk/lib/common Message-ID: <20100215124201.06651325099@www.boxbackup.org> Author: chris Date: 2010-02-15 12:41:59 +0000 (Mon, 15 Feb 2010) New Revision: 2606 Modified: box/trunk/lib/common/Box.h Log: Support throwing exception with more complex stringstream-formatted messages. Modified: box/trunk/lib/common/Box.h =================================================================== --- box/trunk/lib/common/Box.h 2010-02-11 08:39:37 UTC (rev 2605) +++ box/trunk/lib/common/Box.h 2010-02-15 12:41:59 UTC (rev 2606) @@ -115,6 +115,8 @@ #define THROW_EXCEPTION_MESSAGE(type, subtype, message) \ { \ + std::ostringstream _box_throw_line; \ + _box_throw_line << message; \ if(!HideExceptionMessageGuard::ExceptionsHidden()) \ { \ OPTIONAL_DO_BACKTRACE \ @@ -122,7 +124,7 @@ #type "(" #subtype ") (" << message << \ ") at " __FILE__ "(" << __LINE__ << ")") \ } \ - throw type(type::subtype, message); \ + throw type(type::subtype, _box_throw_line.str()); \ } // extra macros for converting to network byte order From subversion at boxbackup.org Mon Feb 15 12:43:04 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 15 Feb 2010 12:43:04 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2607 - box/trunk/infrastructure Message-ID: <20100215124304.3E980325099@www.boxbackup.org> Author: chris Date: 2010-02-15 12:43:03 +0000 (Mon, 15 Feb 2010) New Revision: 2607 Modified: box/trunk/infrastructure/makebuildenv.pl.in Log: Add support for linking to qdbm and other imported libraries with external build systems. Rewrite some library dependency code for readability. Modified: box/trunk/infrastructure/makebuildenv.pl.in =================================================================== --- box/trunk/infrastructure/makebuildenv.pl.in 2010-02-15 12:41:59 UTC (rev 2606) +++ box/trunk/infrastructure/makebuildenv.pl.in 2010-02-15 12:43:03 UTC (rev 2607) @@ -257,7 +257,7 @@ push @modules,$mod; my @md; # module dependencies my @lo; # link line options - for(@deps) + for (@deps) { if(/\A-l/) { @@ -273,7 +273,7 @@ # make directories, but not if we're using an external library and this a library module my ($s,$d) = split /\//,$mod; - if($s ne 'lib' || $external_lib eq '') + if ($s ne 'lib' or $external_lib eq '') { mkdir "release/$s",0755; mkdir "release/$s/$d",0755; @@ -371,11 +371,11 @@ closedir DIR; } +# Then write a makefile for each module print "done\n\nGenerating Makefiles...\n"; my %module_resources_win32; -# Then write a makefile for each module for my $mod (@implicit_deps, @modules) { print $mod,"\n"; @@ -775,8 +775,20 @@ } print MAKE $deps_makeinfo if $bsd_make; - # get the list of library things to add -- in order of dependency so things link properly - my $lib_files = join(' ',map {($_ =~ m/lib\/(.+)\Z/)?('$(OUTBASE)/'.$_.'/'.$1.'.a'):undef} (reverse(@all_deps_for_module))); + # get the list of library things to add -- in order of dependency + # so things link properly + my @lib_files; + foreach my $dep (reverse @all_deps_for_module) + { + if ($dep =~ m|^lib\/(.+)$|) + { + push @lib_files, "\$(OUTBASE)/$dep/$1.a"; + } + elsif ($dep =~ m|^([^/]+)$|) + { + push @lib_files, "../../$dep/lib$1.a"; + } + } # need to see if the extra makefile fragments require extra object files # or include any more makefiles @@ -795,7 +807,7 @@ } print MAKE $end_target,': ',$o_file_list; - print MAKE " ",$lib_files unless $target_is_library; + print MAKE " @lib_files" unless $target_is_library; print MAKE "\n"; if ($target_windows) @@ -822,13 +834,26 @@ # work out library options # need to be... least used first, in absolute order they appear in the modules.txt file my @libops; + sub libops_fill { - my ($m,$r) = @_; - push @$r,$_ for(@{$module_library_link_opts{$m}}); - libops_fill($_,$r) for(@{$module_dependency{$m}}); + my ($module, $libops_ref) = @_; + + my $library_link_opts = $module_library_link_opts{$module}; + if ($library_link_opts) + { + push @$libops_ref, @$library_link_opts; + } + + my $deps = $module_dependency{$module}; + foreach my $dep (@$deps) + { + libops_fill($dep, $libops_ref); + } } + libops_fill($mod,\@libops); + my $lo = ''; my %ldone; for(@libops) @@ -841,7 +866,7 @@ # link line... print MAKE "\t\$(_LINK) \$(LDFLAGS) $link_line_extra " . "-o $end_target $o_file_list " . - "$lib_files$lo $platform_lib_files\n"; + "@lib_files $lo $platform_lib_files\n"; } # tests need to copy the test file over if($type eq 'test') From subversion at boxbackup.org Mon Feb 15 12:44:26 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 15 Feb 2010 12:44:26 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2608 - box/trunk/infrastructure Message-ID: <20100215124426.D1765325099@www.boxbackup.org> Author: chris Date: 2010-02-15 12:44:26 +0000 (Mon, 15 Feb 2010) New Revision: 2608 Modified: box/trunk/infrastructure/makeparcels.pl.in Log: Fix the default and clean targets by moving cleaning lines back where they belong. Modified: box/trunk/infrastructure/makeparcels.pl.in =================================================================== --- box/trunk/infrastructure/makeparcels.pl.in 2010-02-15 12:43:03 UTC (rev 2607) +++ box/trunk/infrastructure/makeparcels.pl.in 2010-02-15 12:44:26 UTC (rev 2608) @@ -115,25 +115,7 @@ print MAKE "all:\t",join(' ',map {"build-".$_} @parcels),"\n\n"; -print MAKE "clean:\n"; -for my $parcel (@parcels) -{ - print MAKE "\trm -rf ", BoxPlatform::parcel_dir($parcel), "\n"; - print MAKE "\trm -f ", BoxPlatform::parcel_target($parcel), "\n"; -} - -if ($build_os eq 'CYGWIN') -{ - print MAKE "\tfind release debug -type f | xargs -r rm -f\n"; -} -else -{ - print MAKE "\tfind release debug -type f -exec rm -f {} \\;\n"; -} - print MAKE <<__END_OF_FRAGMENT; - \$(MAKE) -C docs clean - test: release/common/test release/common/test: @@ -146,6 +128,7 @@ __END_OF_FRAGMENT my $release_flag = BoxPlatform::make_flag('RELEASE'); +my @clean_deps; for my $parcel (@parcels) { @@ -259,6 +242,20 @@ EOF push @parcel_deps, "$dir/docs/${name}.html"; } + elsif ($type eq 'subdir') + { + print MAKE <local/install.msg" or die "Can't open install message file for writing"; From subversion at boxbackup.org Mon Feb 15 12:48:30 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 15 Feb 2010 12:48:30 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2609 - box/trunk/bin/bbackupd/win32 Message-ID: <20100215124830.036C4325099@www.boxbackup.org> Author: chris Date: 2010-02-15 12:48:28 +0000 (Mon, 15 Feb 2010) New Revision: 2609 Modified: box/trunk/bin/bbackupd/win32/installer.iss Log: Remove the obsolete win32 InstallShield installer script. Modified: box/trunk/bin/bbackupd/win32/installer.iss =================================================================== --- box/trunk/bin/bbackupd/win32/installer.iss 2010-02-15 12:44:26 UTC (rev 2608) +++ box/trunk/bin/bbackupd/win32/installer.iss 2010-02-15 12:48:28 UTC (rev 2609) @@ -1,51 +0,0 @@ -; Script to generate output file for Box Backup client for the Windows Platform -; -; Very important - this is the release process -; -; 1/ Upgrade BOX_VERSION in the file emu.h to the current version for example 0.09eWin32 - then perform a full rebuild -; -; 2/ Upgrade the AppVerName below to reflect the version -; -; 3/ Generate the output file, then rename it to the relevent filename to reflect the version - -[Setup] -AppName=Box Backup -AppVerName=BoxWin32 0.09h -AppPublisher=Fluffy & Omniis -AppPublisherURL=http://www.omniis.com -AppSupportURL=http://www.omniis.com -AppUpdatesURL=http://www.omniis.com -DefaultDirName={pf}\Box Backup -DefaultGroupName=Box Backup -Compression=lzma -SolidCompression=yes -PrivilegesRequired=admin - -[Files] -Source: "..\..\Release\bbackupd.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace -Source: "..\..\Release\bbackupctl.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace -Source: "..\..\Release\bbackupquery.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace -Source: "..\..\ExceptionCodes.txt"; DestDir: "{app}"; Flags: ignoreversion restartreplace -Source: "icon.ico"; DestDir: "{app}\"; Flags: ignoreversion restartreplace -Source: "msvcr71.dll"; DestDir: "{app}\"; Flags: restartreplace -Source: "bbackupd.conf"; DestDir: "{app}"; Flags: confirmoverwrite -Source: "..\..\..\zlib\zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace -Source: "..\..\..\openssl\bin\libeay32.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace -Source: "..\..\..\openssl\bin\ssleay32.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace -Source: "ReadMe.txt"; DestDir: "{app}"; Flags: ignoreversion restartreplace - -; NOTE: Don't use "Flags: ignoreversion" on any shared system files - -[Icons] -Name: "{group}\Box Backup Query"; Filename: "{app}\bbackupquery.exe"; IconFilename: "{app}\icon.ico" ;Parameters: "-c bbackupd.conf"; WorkingDir: "{app}" -Name: "{group}\Service\Install Service"; Filename: "{app}\bbackupd.exe"; IconFilename: "{app}\icon.ico" ;Parameters: "-i"; WorkingDir: "{app}" -Name: "{group}\Service\Remove Service"; Filename: "{app}\bbackupd.exe"; IconFilename: "{app}\icon.ico" ;Parameters: "-r"; WorkingDir: "{app}" -Name: "{group}\Initiate Backup Now"; Filename: "{app}\bbackupctl.exe"; IconFilename: "{app}\icon.ico" ;Parameters: "-c bbackupd.conf sync"; WorkingDir: "{app}" - -[Dirs] -Name: "{app}\bbackupd" - -[Run] -Filename: "{app}\bbackupd.exe"; Description: "Install Boxbackup as service"; Parameters: "-i"; Flags: postinstall -Filename: "{app}\Readme.txt"; Description: "View upgrade notes"; Flags: postinstall shellexec skipifsilent - From subversion at boxbackup.org Tue Feb 16 22:10:55 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Tue, 16 Feb 2010 22:10:55 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2610 - box/trunk Message-ID: <20100216221058.6A49B325099@www.boxbackup.org> Author: chris Date: 2010-02-16 22:10:47 +0000 (Tue, 16 Feb 2010) New Revision: 2610 Modified: box/trunk/modules.txt Log: Add qdbm to library dependencies for bbackupd. Modified: box/trunk/modules.txt =================================================================== --- box/trunk/modules.txt 2010-02-15 12:48:28 UTC (rev 2609) +++ box/trunk/modules.txt 2010-02-16 22:10:47 UTC (rev 2610) @@ -31,7 +31,7 @@ bin/bbackupobjdump lib/backupclient lib/backupstore bin/bbstored lib/raidfile lib/server lib/backupstore lib/backupclient bin/bbstoreaccounts lib/raidfile lib/backupstore -bin/bbackupd lib/server lib/backupclient +bin/bbackupd lib/server lib/backupclient qdbm bin/bbackupquery lib/server lib/backupclient bin/bbackupctl lib/server lib/backupclient From subversion at boxbackup.org Tue Feb 16 22:11:34 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Tue, 16 Feb 2010 22:11:34 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2611 - box/trunk/lib/backupclient Message-ID: <20100216221134.65373325099@www.boxbackup.org> Author: chris Date: 2010-02-16 22:11:33 +0000 (Tue, 16 Feb 2010) New Revision: 2611 Modified: box/trunk/lib/backupclient/BackupClientFileAttributes.cpp Log: Reformat for readability. Modified: box/trunk/lib/backupclient/BackupClientFileAttributes.cpp =================================================================== --- box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-16 22:10:47 UTC (rev 2610) +++ box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-16 22:11:33 UTC (rev 2611) @@ -315,14 +315,21 @@ // -------------------------------------------------------------------------- // // Function -// Name: BackupClientFileAttributes::ReadAttributes(const char *) -// Purpose: Read the attributes of the file, and store them ready for streaming. -// Optionally retrieve the modification time and attribute modification time. +// Name: BackupClientFileAttributes::ReadAttributes( +// const char *Filename, bool ZeroModificationTimes, +// box_time_t *pModTime, box_time_t *pAttrModTime, +// int64_t *pFileSize, InodeRefType *pInodeNumber, +// bool *pHasMultipleLinks) +// Purpose: Read the attributes of the file, and store them +// ready for streaming. Optionally retrieve the +// modification time and attribute modification time. // Created: 2003/10/07 // // -------------------------------------------------------------------------- -void BackupClientFileAttributes::ReadAttributes(const char *Filename, bool ZeroModificationTimes, box_time_t *pModTime, - box_time_t *pAttrModTime, int64_t *pFileSize, InodeRefType *pInodeNumber, bool *pHasMultipleLinks) +void BackupClientFileAttributes::ReadAttributes(const char *Filename, + bool ZeroModificationTimes, box_time_t *pModTime, + box_time_t *pAttrModTime, int64_t *pFileSize, + InodeRefType *pInodeNumber, bool *pHasMultipleLinks) { StreamableMemBlock *pnewAttr = 0; try From subversion at boxbackup.org Tue Feb 16 22:12:19 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Tue, 16 Feb 2010 22:12:19 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2612 - box/trunk/lib/common Message-ID: <20100216221219.5FDD6325099@www.boxbackup.org> Author: chris Date: 2010-02-16 22:12:18 +0000 (Tue, 16 Feb 2010) New Revision: 2612 Added: box/trunk/lib/common/FileModificationTime.cpp Modified: box/trunk/lib/common/FileModificationTime.h Log: Move modification time functions out-of-line to help with debugging them. Copied: box/trunk/lib/common/FileModificationTime.cpp (from rev 2605, box/trunk/lib/common/FileModificationTime.h) =================================================================== --- box/trunk/lib/common/FileModificationTime.cpp (rev 0) +++ box/trunk/lib/common/FileModificationTime.cpp 2010-02-16 22:12:18 UTC (rev 2612) @@ -0,0 +1,64 @@ +// -------------------------------------------------------------------------- +// +// File +// Name: FileModificationTime.cpp +// Purpose: Function for getting file modification time. +// Created: 2010/02/15 +// +// -------------------------------------------------------------------------- + +#include "Box.h" + +#include + +#include "BoxTime.h" +#include "FileModificationTime.h" + +#include "MemLeakFindOn.h" + +box_time_t FileModificationTime(EMU_STRUCT_STAT &st) +{ +#ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC + box_time_t datamodified = ((int64_t)st.st_mtime) * (MICRO_SEC_IN_SEC_LL); +#else + box_time_t datamodified = (((int64_t)st.st_mtimespec.tv_nsec) / NANO_SEC_IN_USEC_LL) + + (((int64_t)st.st_mtimespec.tv_sec) * (MICRO_SEC_IN_SEC_LL)); +#endif + + return datamodified; +} + +box_time_t FileAttrModificationTime(EMU_STRUCT_STAT &st) +{ + box_time_t statusmodified = +#ifdef HAVE_STRUCT_STAT_ST_MTIMESPEC + (((int64_t)st.st_ctimespec.tv_nsec) / (NANO_SEC_IN_USEC_LL)) + + (((int64_t)st.st_ctimespec.tv_sec) * (MICRO_SEC_IN_SEC_LL)); +#elif defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC + (((int64_t)st.st_ctim.tv_nsec) / (NANO_SEC_IN_USEC_LL)) + + (((int64_t)st.st_ctim.tv_sec) * (MICRO_SEC_IN_SEC_LL)); +#elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC + (((int64_t)st.st_ctimensec) / (NANO_SEC_IN_USEC_LL)) + + (((int64_t)st.st_ctime) * (MICRO_SEC_IN_SEC_LL)); +#else // no nanoseconds anywhere + (((int64_t)st.st_ctime) * (MICRO_SEC_IN_SEC_LL)); +#endif + + return statusmodified; +} + +box_time_t FileModificationTimeMaxModAndAttr(EMU_STRUCT_STAT &st) +{ +#ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC + box_time_t datamodified = ((int64_t)st.st_mtime) * (MICRO_SEC_IN_SEC_LL); + box_time_t statusmodified = ((int64_t)st.st_ctime) * (MICRO_SEC_IN_SEC_LL); +#else + box_time_t datamodified = (((int64_t)st.st_mtimespec.tv_nsec) / NANO_SEC_IN_USEC_LL) + + (((int64_t)st.st_mtimespec.tv_sec) * (MICRO_SEC_IN_SEC_LL)); + box_time_t statusmodified = (((int64_t)st.st_ctimespec.tv_nsec) / NANO_SEC_IN_USEC_LL) + + (((int64_t)st.st_ctimespec.tv_sec) * (MICRO_SEC_IN_SEC_LL)); +#endif + + return (datamodified > statusmodified)?datamodified:statusmodified; +} + Modified: box/trunk/lib/common/FileModificationTime.h =================================================================== --- box/trunk/lib/common/FileModificationTime.h 2010-02-16 22:11:33 UTC (rev 2611) +++ box/trunk/lib/common/FileModificationTime.h 2010-02-16 22:12:18 UTC (rev 2612) @@ -14,51 +14,9 @@ #include "BoxTime.h" -inline box_time_t FileModificationTime(EMU_STRUCT_STAT &st) -{ -#ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC - box_time_t datamodified = ((int64_t)st.st_mtime) * (MICRO_SEC_IN_SEC_LL); -#else - box_time_t datamodified = (((int64_t)st.st_mtimespec.tv_nsec) / NANO_SEC_IN_USEC_LL) - + (((int64_t)st.st_mtimespec.tv_sec) * (MICRO_SEC_IN_SEC_LL)); -#endif - - return datamodified; -} +box_time_t FileModificationTime(EMU_STRUCT_STAT &st); +box_time_t FileAttrModificationTime(EMU_STRUCT_STAT &st); +box_time_t FileModificationTimeMaxModAndAttr(EMU_STRUCT_STAT &st); -inline box_time_t FileAttrModificationTime(EMU_STRUCT_STAT &st) -{ - box_time_t statusmodified = -#ifdef HAVE_STRUCT_STAT_ST_MTIMESPEC - (((int64_t)st.st_ctimespec.tv_nsec) / (NANO_SEC_IN_USEC_LL)) + - (((int64_t)st.st_ctimespec.tv_sec) * (MICRO_SEC_IN_SEC_LL)); -#elif defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC - (((int64_t)st.st_ctim.tv_nsec) / (NANO_SEC_IN_USEC_LL)) + - (((int64_t)st.st_ctim.tv_sec) * (MICRO_SEC_IN_SEC_LL)); -#elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC - (((int64_t)st.st_ctimensec) / (NANO_SEC_IN_USEC_LL)) + - (((int64_t)st.st_ctime) * (MICRO_SEC_IN_SEC_LL)); -#else // no nanoseconds anywhere - (((int64_t)st.st_ctime) * (MICRO_SEC_IN_SEC_LL)); -#endif - - return statusmodified; -} - -inline box_time_t FileModificationTimeMaxModAndAttr(EMU_STRUCT_STAT &st) -{ -#ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC - box_time_t datamodified = ((int64_t)st.st_mtime) * (MICRO_SEC_IN_SEC_LL); - box_time_t statusmodified = ((int64_t)st.st_ctime) * (MICRO_SEC_IN_SEC_LL); -#else - box_time_t datamodified = (((int64_t)st.st_mtimespec.tv_nsec) / NANO_SEC_IN_USEC_LL) - + (((int64_t)st.st_mtimespec.tv_sec) * (MICRO_SEC_IN_SEC_LL)); - box_time_t statusmodified = (((int64_t)st.st_ctimespec.tv_nsec) / NANO_SEC_IN_USEC_LL) - + (((int64_t)st.st_ctimespec.tv_sec) * (MICRO_SEC_IN_SEC_LL)); -#endif - - return (datamodified > statusmodified)?datamodified:statusmodified; -} - #endif // FILEMODIFICATIONTIME__H From subversion at boxbackup.org Tue Feb 16 23:05:35 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Tue, 16 Feb 2010 23:05:35 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2613 - box/trunk/lib/common Message-ID: <20100216230535.24D23325099@www.boxbackup.org> Author: chris Date: 2010-02-16 23:05:33 +0000 (Tue, 16 Feb 2010) New Revision: 2613 Modified: box/trunk/lib/common/Box.h Log: Add overloaded hton() and ntoh() functions for file attribute comparison macro. Modified: box/trunk/lib/common/Box.h =================================================================== --- box/trunk/lib/common/Box.h 2010-02-16 22:12:18 UTC (rev 2612) +++ box/trunk/lib/common/Box.h 2010-02-16 23:05:33 UTC (rev 2613) @@ -163,5 +163,23 @@ #define box_ntoh64(x) box_swap64(x) #endif +// overloaded auto-conversion functions +inline uint64_t hton(uint64_t in) { return box_hton64(in); } +inline uint32_t hton(uint32_t in) { return htonl(in); } +inline uint16_t hton(uint16_t in) { return htons(in); } +inline uint8_t hton(uint8_t in) { return in; } +inline int64_t hton(int64_t in) { return box_hton64(in); } +inline int32_t hton(int32_t in) { return htonl(in); } +inline int16_t hton(int16_t in) { return htons(in); } +inline int8_t hton(int8_t in) { return in; } +inline uint64_t ntoh(uint64_t in) { return box_ntoh64(in); } +inline uint32_t ntoh(uint32_t in) { return ntohl(in); } +inline uint16_t ntoh(uint16_t in) { return ntohs(in); } +inline uint8_t ntoh(uint8_t in) { return in; } +inline int64_t ntoh(int64_t in) { return box_ntoh64(in); } +inline int32_t ntoh(int32_t in) { return ntohl(in); } +inline int16_t ntoh(int16_t in) { return ntohs(in); } +inline int8_t ntoh(int8_t in) { return in; } + #endif // BOX__H From subversion at boxbackup.org Tue Feb 16 23:07:11 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Tue, 16 Feb 2010 23:07:11 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2614 - box/trunk/lib/backupclient Message-ID: <20100216230711.B7AAF325099@www.boxbackup.org> Author: chris Date: 2010-02-16 23:07:11 +0000 (Tue, 16 Feb 2010) New Revision: 2614 Modified: box/trunk/lib/backupclient/BackupClientFileAttributes.cpp Log: Convert attributes to host byte order when reporting errors. Convert timestamps to host byte order before dividing from usecs to secs, store in uint64_t variables to avoid truncation, and display in host byte order. Modified: box/trunk/lib/backupclient/BackupClientFileAttributes.cpp =================================================================== --- box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-16 23:05:33 UTC (rev 2613) +++ box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-16 23:07:11 UTC (rev 2614) @@ -250,8 +250,8 @@ if (a1->attribute != a2->attribute) \ { \ BOX_TRACE("Attribute Compare: " << message << " differ: " \ - "local " << a1->attribute << ", " \ - "remote " << a2->attribute); \ + "local " << ntoh(a1->attribute) << ", " \ + "remote " << ntoh(a2->attribute)); \ return false; \ } COMPARE(AttributeType, "Attribute types"); @@ -262,8 +262,8 @@ if(!IgnoreModTime) { - int t1 = a1->ModificationTime / 1000000; - int t2 = a2->ModificationTime / 1000000; + uint64_t t1 = box_ntoh64(a1->ModificationTime) / 1000000; + uint64_t t2 = box_ntoh64(a2->ModificationTime) / 1000000; if(t1 != t2) { BOX_TRACE("Attribute Compare: File modification " @@ -275,8 +275,8 @@ if(!IgnoreAttrModTime) { - int t1 = a1->AttrModificationTime / 1000000; - int t2 = a2->AttrModificationTime / 1000000; + uint64_t t1 = box_ntoh64(a1->AttrModificationTime) / 1000000; + uint64_t t2 = box_ntoh64(a2->AttrModificationTime) / 1000000; if(t1 != t2) { BOX_TRACE("Attribute Compare: Attribute modification " @@ -299,7 +299,7 @@ std::string s2((char *)(a2 + 1), datalen); BOX_TRACE("Attribute Compare: Symbolic link target " "or extended attributes differ: " - "local " << PrintEscapedBinaryData(s1) << ", " + "local " << PrintEscapedBinaryData(s1) << ", " "remote " << PrintEscapedBinaryData(s2)); return false; } From subversion at boxbackup.org Wed Feb 17 06:47:44 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Wed, 17 Feb 2010 06:47:44 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2615 - box/chris/win32/releases Message-ID: <20100217064744.1F89F32503B@www.boxbackup.org> Author: chris Date: 2010-02-17 06:47:43 +0000 (Wed, 17 Feb 2010) New Revision: 2615 Added: box/chris/win32/releases/boxbackup-trunk_2614-backup-client-mingw32.zip Log: Add a new client release, fix attribute compare logging to be in host byte order. Added: box/chris/win32/releases/boxbackup-trunk_2614-backup-client-mingw32.zip =================================================================== (Binary files differ) Property changes on: box/chris/win32/releases/boxbackup-trunk_2614-backup-client-mingw32.zip ___________________________________________________________________ Added: svn:mime-type + application/octet-stream From subversion at boxbackup.org Wed Feb 17 16:00:49 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Wed, 17 Feb 2010 16:00:49 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2616 - box/trunk/lib/common Message-ID: <20100217160049.2955232503B@www.boxbackup.org> Author: chris Date: 2010-02-17 16:00:48 +0000 (Wed, 17 Feb 2010) New Revision: 2616 Modified: box/trunk/lib/common/BannerText.h Log: Update banner to say 2003-2010. Modified: box/trunk/lib/common/BannerText.h =================================================================== --- box/trunk/lib/common/BannerText.h 2010-02-17 06:47:43 UTC (rev 2615) +++ box/trunk/lib/common/BannerText.h 2010-02-17 16:00:48 UTC (rev 2616) @@ -12,7 +12,7 @@ #define BANNER_TEXT(UtilityName) \ "Box " UtilityName " v" BOX_VERSION ", (c) Ben Summers and " \ - "contributors 2003-2008" + "contributors 2003-2010" #endif // BANNERTEXT__H From subversion at boxbackup.org Thu Feb 18 14:58:19 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Thu, 18 Feb 2010 14:58:19 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2617 - box/trunk Message-ID: <20100218145819.D4E0432503B@www.boxbackup.org> Author: chris Date: 2010-02-18 14:58:18 +0000 (Thu, 18 Feb 2010) New Revision: 2617 Modified: box/trunk/modules.txt Log: Remove qdbm again, not all infrastructure is there yet. Modified: box/trunk/modules.txt =================================================================== --- box/trunk/modules.txt 2010-02-17 16:00:48 UTC (rev 2616) +++ box/trunk/modules.txt 2010-02-18 14:58:18 UTC (rev 2617) @@ -31,7 +31,7 @@ bin/bbackupobjdump lib/backupclient lib/backupstore bin/bbstored lib/raidfile lib/server lib/backupstore lib/backupclient bin/bbstoreaccounts lib/raidfile lib/backupstore -bin/bbackupd lib/server lib/backupclient qdbm +bin/bbackupd lib/server lib/backupclient bin/bbackupquery lib/server lib/backupclient bin/bbackupctl lib/server lib/backupclient From subversion at boxbackup.org Thu Feb 18 14:59:47 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Thu, 18 Feb 2010 14:59:47 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2618 - box/trunk/lib/backupclient Message-ID: <20100218145947.91AFF32503B@www.boxbackup.org> Author: chris Date: 2010-02-18 14:59:47 +0000 (Thu, 18 Feb 2010) New Revision: 2618 Modified: box/trunk/lib/backupclient/BackupClientFileAttributes.cpp Log: Log the mismatched timestamps of files during compare in a human-readable format as well as the raw numbers. Use existing helper functions to convert box_time_t to seconds, rather than just arbitrarily dividing by 1000000. Modified: box/trunk/lib/backupclient/BackupClientFileAttributes.cpp =================================================================== --- box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-18 14:58:18 UTC (rev 2617) +++ box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-18 14:59:47 UTC (rev 2618) @@ -259,29 +259,37 @@ COMPARE(GID, "GIDs"); COMPARE(UserDefinedFlags, "User-defined flags"); COMPARE(Mode, "Modes"); - + if(!IgnoreModTime) { - uint64_t t1 = box_ntoh64(a1->ModificationTime) / 1000000; - uint64_t t2 = box_ntoh64(a2->ModificationTime) / 1000000; - if(t1 != t2) + uint64_t t1 = box_ntoh64(a1->ModificationTime); + uint64_t t2 = box_ntoh64(a2->ModificationTime); + time_t s1 = BoxTimeToSeconds(t1); + time_t s2 = BoxTimeToSeconds(t2); + if(s1 != s2) { BOX_TRACE("Attribute Compare: File modification " - "times differ: local " << t1 << ", " - "remote " << t2); + "times differ: local " << + FormatTime(t1, true) << " (" << s1 << "), " + "remote " << + FormatTime(t2, true) << " (" << s2 << ")"); return false; } } - + if(!IgnoreAttrModTime) { - uint64_t t1 = box_ntoh64(a1->AttrModificationTime) / 1000000; - uint64_t t2 = box_ntoh64(a2->AttrModificationTime) / 1000000; - if(t1 != t2) + uint64_t t1 = box_ntoh64(a1->AttrModificationTime); + uint64_t t2 = box_ntoh64(a2->AttrModificationTime); + time_t s1 = BoxTimeToSeconds(t1); + time_t s2 = BoxTimeToSeconds(t2); + if(s1 != s2) { BOX_TRACE("Attribute Compare: Attribute modification " - "times differ: local " << t1 << ", " - "remote " << t2); + "times differ: local " << + FormatTime(t1, true) << " (" << s1 << "), " + "remote " << + FormatTime(t2, true) << " (" << s2 << ")"); return false; } } From subversion at boxbackup.org Thu Feb 18 18:11:02 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Thu, 18 Feb 2010 18:11:02 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2619 - box/trunk Message-ID: <20100218181102.6033D32503B@www.boxbackup.org> Author: chris Date: 2010-02-18 18:11:01 +0000 (Thu, 18 Feb 2010) New Revision: 2619 Modified: box/trunk/configure.ac Log: Configure subdirectories specified in modules.txt. Detect C compiler as well as C++. Modified: box/trunk/configure.ac =================================================================== --- box/trunk/configure.ac 2010-02-18 14:59:47 UTC (rev 2618) +++ box/trunk/configure.ac 2010-02-18 18:11:01 UTC (rev 2619) @@ -13,6 +13,7 @@ ### Checks for programs. AC_LANG([C++]) +AC_PROG_CC AC_PROG_CXX AC_CXX_EXCEPTIONS AC_CXX_NAMESPACES @@ -382,6 +383,19 @@ exit 1 fi +cat parcels.txt | sed -e 's/#.*//' | while read cmd subdir configure_args; do + if test "$cmd" = "subdir"; then + echo + echo "Configuring $subdir..." + cd $subdir + export CC CXX CXXFLAGS LDFLAGS LIBS + if ! ./configure $configure_args; then + echo "Configuring $subdir failed!" >&2 + exit 1 + fi + fi +done || exit $? + # Write summary of important info cat < Author: chris Date: 2010-02-18 18:12:00 +0000 (Thu, 18 Feb 2010) New Revision: 2620 Modified: box/trunk/parcels.txt Log: Add qdbm as additional subdir to be configured. Modified: box/trunk/parcels.txt =================================================================== --- box/trunk/parcels.txt 2010-02-18 18:11:01 UTC (rev 2619) +++ box/trunk/parcels.txt 2010-02-18 18:12:00 UTC (rev 2620) @@ -18,6 +18,8 @@ html bbackupd-config html bbackupd.conf + subdir qdbm + EXCEPT:mingw32,mingw32msvc man bbackupd.8 man bbackupquery.8 From subversion at boxbackup.org Thu Feb 18 18:14:36 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Thu, 18 Feb 2010 18:14:36 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2621 - box/trunk Message-ID: <20100218181436.9D5F132503B@www.boxbackup.org> Author: chris Date: 2010-02-18 18:14:36 +0000 (Thu, 18 Feb 2010) New Revision: 2621 Modified: box/trunk/configure.ac Log: Pass target to sub-configure as well, for mingw, as boxi does to box backup. Modified: box/trunk/configure.ac =================================================================== --- box/trunk/configure.ac 2010-02-18 18:12:00 UTC (rev 2620) +++ box/trunk/configure.ac 2010-02-18 18:14:36 UTC (rev 2621) @@ -389,8 +389,10 @@ echo "Configuring $subdir..." cd $subdir export CC CXX CXXFLAGS LDFLAGS LIBS - if ! ./configure $configure_args; then - echo "Configuring $subdir failed!" >&2 + args="$configure_args --target=$target_alias" + echo "Configuring $subdir with: $args" + if ! ./configure $args; then + echo "Configuring $subdir with $args failed!" >&2 exit 1 fi fi From subversion at boxbackup.org Fri Feb 19 18:39:39 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 19 Feb 2010 18:39:39 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2622 - box/trunk/infrastructure Message-ID: <20100219183939.6071E32503B@www.boxbackup.org> Author: chris Date: 2010-02-19 18:39:38 +0000 (Fri, 19 Feb 2010) New Revision: 2622 Modified: box/trunk/infrastructure/makebuildenv.pl.in Log: Make the explicit target of each dependency, including libraries, to solve problems with integrating QDBM into build system (default target tries to build stuff we don't want). Modified: box/trunk/infrastructure/makebuildenv.pl.in =================================================================== --- box/trunk/infrastructure/makebuildenv.pl.in 2010-02-18 18:14:36 UTC (rev 2621) +++ box/trunk/infrastructure/makebuildenv.pl.in 2010-02-19 18:39:38 UTC (rev 2622) @@ -479,6 +479,7 @@ } my @all_deps_for_module; + { # work out what dependencies need to be run my @deps_raw; @@ -768,7 +769,27 @@ # run make for things we require for my $dep (@all_deps_for_module) { - $deps_makeinfo .= "\t\t\$(HIDE) (cd ../../$dep; \$(MAKE)$sub_make_options -q \$(DEPENDMAKEFLAGS) -D NODEPS || \$(MAKE)$sub_make_options \$(DEPENDMAKEFLAGS) -D NODEPS)\n"; + my $dep_target = ""; + if ($dep =~ m|^lib/(.*)|) + { + $dep_target = "\$(OUTBASE)/$dep/$1.a"; + } + elsif ($dep =~ m|^.*/(.*)|) + { + $dep_target = "\$(OUTBASE)/$dep/$1$platform_exe_ext"; + } + else + { + $dep_target = "lib$dep.a"; + } + + $deps_makeinfo .= < Author: chris Date: 2010-02-19 18:40:13 +0000 (Fri, 19 Feb 2010) New Revision: 2623 Modified: box/trunk/qdbm/Makefile.in Log: Honour CFLAGS in QDBM so that Cygwin/MinGW builds work. Modified: box/trunk/qdbm/Makefile.in =================================================================== --- box/trunk/qdbm/Makefile.in 2010-02-19 18:39:38 UTC (rev 2622) +++ box/trunk/qdbm/Makefile.in 2010-02-19 18:40:13 UTC (rev 2623) @@ -56,7 +56,7 @@ -D_XOPEN_SOURCE_EXTENDED=1 -D_GNU_SOURCE=1 -D__EXTENSIONS__=1 -D_HPUX_SOURCE=1 \ -D_POSIX_MAPPED_FILES=1 -D_POSIX_SYNCHRONIZED_IO=1 \ -DPIC=1 -D_THREAD_SAFE=1 -D_REENTRANT=1 -DNDEBUG -CFLAGS = -Wall -pedantic -fPIC -fsigned-char -O3 -fomit-frame-pointer -fforce-addr @MYOPTS@ +CFLAGS = @CFLAGS@ -Wall -pedantic -fPIC -fsigned-char -O3 -fomit-frame-pointer -fforce-addr @MYOPTS@ LD = @LD@ LIBS = -lqdbm @LIBS@ LIBLDFLAGS = @LDFLAGS@ -L. -L$(MYLIBDIR) -L$(HOME)/lib -L/usr/local/lib @LIBS@ From subversion at boxbackup.org Fri Feb 19 18:40:36 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 19 Feb 2010 18:40:36 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2624 - box/trunk Message-ID: <20100219184036.5B55D325044@www.boxbackup.org> Author: chris Date: 2010-02-19 18:40:36 +0000 (Fri, 19 Feb 2010) New Revision: 2624 Modified: box/trunk/modules.txt Log: Put qdbm back into module dependencies of bin/bbackupd. Modified: box/trunk/modules.txt =================================================================== --- box/trunk/modules.txt 2010-02-19 18:40:13 UTC (rev 2623) +++ box/trunk/modules.txt 2010-02-19 18:40:36 UTC (rev 2624) @@ -31,7 +31,7 @@ bin/bbackupobjdump lib/backupclient lib/backupstore bin/bbstored lib/raidfile lib/server lib/backupstore lib/backupclient bin/bbstoreaccounts lib/raidfile lib/backupstore -bin/bbackupd lib/server lib/backupclient +bin/bbackupd lib/server lib/backupclient qdbm bin/bbackupquery lib/server lib/backupclient bin/bbackupctl lib/server lib/backupclient From subversion at boxbackup.org Sun Feb 21 22:09:38 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sun, 21 Feb 2010 22:09:38 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2625 - box/trunk/bin/bbackupquery Message-ID: <20100221220939.07236325044@www.boxbackup.org> Author: chris Date: 2010-02-21 22:09:37 +0000 (Sun, 21 Feb 2010) New Revision: 2625 Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp Log: Move the test for excluded dirs inside the emu_lstat failure, as otherwise we don't know whether the file that we couldn't stat was really a file or a directory, so we can't know whether it should have been excluded, and the old code allowed dir excludes to make files appear not to exist locally, and therefore tests to fail. Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/trunk/bin/bbackupquery/BackupQueries.cpp 2010-02-19 18:40:36 UTC (rev 2624) +++ box/trunk/bin/bbackupquery/BackupQueries.cpp 2010-02-21 22:09:37 UTC (rev 2625) @@ -1549,24 +1549,26 @@ std::string storeDirPath(rStoreDir + "/" + localDirEn->d_name); - // Check whether dir is excluded before trying to - // stat it, to fix problems with .gvfs directories - // that are not readable by root causing compare - // to crash: - // http://lists.boxbackup.org/pipermail/boxbackup/2010-January/000013.html - if(rParams.IsExcludedDir(localDirPath)) - { - rParams.NotifyExcludedDir(localDirPath, - storeDirPath); - continue; - } - #ifndef HAVE_VALID_DIRENT_D_TYPE EMU_STRUCT_STAT st; if(EMU_LSTAT(localDirPath.c_str(), &st) != 0) { - THROW_EXCEPTION_MESSAGE(CommonException, - OSFileError, localDirPath); + // Check whether dir is excluded before trying + // to stat it, to fix problems with .gvfs + // directories that are not readable by root + // causing compare to crash: + // http://lists.boxbackup.org/pipermail/boxbackup/2010-January/000013.html + if(rParams.IsExcludedDir(localDirPath)) + { + rParams.NotifyExcludedDir(localDirPath, + storeDirPath); + continue; + } + else + { + THROW_EXCEPTION_MESSAGE(CommonException, + OSFileError, localDirPath); + } } // Entry -- file or dir? From subversion at boxbackup.org Mon Feb 22 07:54:23 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 22 Feb 2010 07:54:23 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2626 - box/trunk/infrastructure/mingw Message-ID: <20100222075423.26A46325044@www.boxbackup.org> Author: chris Date: 2010-02-22 07:54:21 +0000 (Mon, 22 Feb 2010) New Revision: 2626 Modified: box/trunk/infrastructure/mingw/configure.sh Log: Add CC to exports for mingw configure script. Modified: box/trunk/infrastructure/mingw/configure.sh =================================================================== --- box/trunk/infrastructure/mingw/configure.sh 2010-02-21 22:09:37 UTC (rev 2625) +++ box/trunk/infrastructure/mingw/configure.sh 2010-02-22 07:54:21 UTC (rev 2626) @@ -14,6 +14,7 @@ exit 2 fi +export CC="gcc -mno-cygwin" export CXX="g++ -mno-cygwin" export LD="g++ -mno-cygwin" export CFLAGS="-mno-cygwin -mthreads" From subversion at boxbackup.org Mon Feb 22 07:55:03 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 22 Feb 2010 07:55:03 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2627 - box/trunk/qdbm Message-ID: <20100222075503.3254D325044@www.boxbackup.org> Author: chris Date: 2010-02-22 07:55:03 +0000 (Mon, 22 Feb 2010) New Revision: 2627 Modified: box/trunk/qdbm/Makefile.in Log: Remove -O3 -fomit-frame-pointer from qdbm gcc options, as they make debugging impossible. Modified: box/trunk/qdbm/Makefile.in =================================================================== --- box/trunk/qdbm/Makefile.in 2010-02-22 07:54:21 UTC (rev 2626) +++ box/trunk/qdbm/Makefile.in 2010-02-22 07:55:03 UTC (rev 2627) @@ -56,7 +56,7 @@ -D_XOPEN_SOURCE_EXTENDED=1 -D_GNU_SOURCE=1 -D__EXTENSIONS__=1 -D_HPUX_SOURCE=1 \ -D_POSIX_MAPPED_FILES=1 -D_POSIX_SYNCHRONIZED_IO=1 \ -DPIC=1 -D_THREAD_SAFE=1 -D_REENTRANT=1 -DNDEBUG -CFLAGS = @CFLAGS@ -Wall -pedantic -fPIC -fsigned-char -O3 -fomit-frame-pointer -fforce-addr @MYOPTS@ +CFLAGS = @CFLAGS@ -Wall -pedantic -fPIC -fsigned-char -O0 -fforce-addr @MYOPTS@ LD = @LD@ LIBS = -lqdbm @LIBS@ LIBLDFLAGS = @LDFLAGS@ -L. -L$(MYLIBDIR) -L$(HOME)/lib -L/usr/local/lib @LIBS@ From subversion at boxbackup.org Mon Feb 22 07:55:37 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 22 Feb 2010 07:55:37 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2628 - box/trunk Message-ID: <20100222075537.4452C325044@www.boxbackup.org> Author: chris Date: 2010-02-22 07:55:37 +0000 (Mon, 22 Feb 2010) New Revision: 2628 Modified: box/trunk/configure.ac Log: Don't echo twice before configuring sub-project. Modified: box/trunk/configure.ac =================================================================== --- box/trunk/configure.ac 2010-02-22 07:55:03 UTC (rev 2627) +++ box/trunk/configure.ac 2010-02-22 07:55:37 UTC (rev 2628) @@ -386,11 +386,11 @@ cat parcels.txt | sed -e 's/#.*//' | while read cmd subdir configure_args; do if test "$cmd" = "subdir"; then echo - echo "Configuring $subdir..." - cd $subdir export CC CXX CXXFLAGS LDFLAGS LIBS args="$configure_args --target=$target_alias" echo "Configuring $subdir with: $args" + + cd $subdir if ! ./configure $args; then echo "Configuring $subdir with $args failed!" >&2 exit 1 From subversion at boxbackup.org Mon Feb 22 21:55:43 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 22 Feb 2010 21:55:43 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2629 - box/trunk/lib/common Message-ID: <20100222215543.AB68D325044@www.boxbackup.org> Author: chris Date: 2010-02-22 21:55:42 +0000 (Mon, 22 Feb 2010) New Revision: 2629 Modified: box/trunk/lib/common/Logging.h Log: Rename LOG_AND_THROW_ERROR macro to THROW_SYS_ERROR for consistency and brevity. Add THROW_SYS_FILE_ERROR which adds a filename to the message. Modified: box/trunk/lib/common/Logging.h =================================================================== --- box/trunk/lib/common/Logging.h 2010-02-22 07:55:37 UTC (rev 2628) +++ box/trunk/lib/common/Logging.h 2010-02-22 21:55:42 UTC (rev 2629) @@ -51,11 +51,14 @@ #define BOX_LOG_SYS_FATAL(stuff) \ BOX_FATAL(BOX_SYS_ERROR(stuff)) -#define LOG_AND_THROW_ERROR(message, filename, exception, subtype) \ - BOX_LOG_SYS_ERROR(message << ": " << filename); \ +#define THROW_SYS_ERROR(message, exception, subtype) \ + BOX_LOG_SYS_ERROR(message); \ THROW_EXCEPTION_MESSAGE(exception, subtype, \ - BOX_SYS_ERROR(message << ": " << filename)); + BOX_SYS_ERROR(message)) +#define THROW_SYS_FILE_ERROR(message, filename, exception, subtype) \ + THROW_SYS_ERROR(message << ": " << filename, exception, subtype) + inline std::string GetNativeErrorMessage() { #ifdef WIN32 From subversion at boxbackup.org Mon Feb 22 21:57:36 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 22 Feb 2010 21:57:36 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2630 - box/trunk/lib/common Message-ID: <20100222215736.DB1B4325044@www.boxbackup.org> Author: chris Date: 2010-02-22 21:57:36 +0000 (Mon, 22 Feb 2010) New Revision: 2630 Modified: box/trunk/lib/common/CommonException.txt Log: Add some exceptions for use by database handling classes. Modified: box/trunk/lib/common/CommonException.txt =================================================================== --- box/trunk/lib/common/CommonException.txt 2010-02-22 21:55:42 UTC (rev 2629) +++ box/trunk/lib/common/CommonException.txt 2010-02-22 21:57:36 UTC (rev 2630) @@ -45,3 +45,10 @@ TempDirPathTooLong 38 Your temporary directory path is too long. Check the TMP and TEMP environment variables. ArchiveBlockIncompleteRead 39 The Store Object Info File is too short or corrupted, and will be rewritten automatically when the next backup completes. AccessDenied 40 Access to the file or directory was denied. Please check the permissions. +DatabaseOpenFailed 41 Failed to open the database file +DatabaseReadFailed 42 Failed to read a record from the database file +DatabaseWriteFailed 43 Failed to write a record from the database file +DatabaseDeleteFailed 44 Failed to delete a record from the database file +DatabaseCloseFailed 45 Failed to close the database file +DatabaseRecordNotFound 46 The database does not contain the expected record +DatabaseRecordAlreadyExists 47 The database already contains a record with this key, which was not expected From subversion at boxbackup.org Mon Feb 22 22:10:04 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 22 Feb 2010 22:10:04 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2631 - box/trunk/bin/bbackupd Message-ID: <20100222221004.C9868325044@www.boxbackup.org> Author: chris Date: 2010-02-22 22:10:04 +0000 (Mon, 22 Feb 2010) New Revision: 2631 Modified: box/trunk/bin/bbackupd/BackupClientInodeToIDMap.cpp box/trunk/bin/bbackupd/BackupClientInodeToIDMap.h box/trunk/bin/bbackupd/BackupDaemon.cpp Log: Remove all references to bdb databases, use QDBM instead. Modified: box/trunk/bin/bbackupd/BackupClientInodeToIDMap.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupClientInodeToIDMap.cpp 2010-02-22 21:57:36 UTC (rev 2630) +++ box/trunk/bin/bbackupd/BackupClientInodeToIDMap.cpp 2010-02-22 22:10:04 UTC (rev 2631) @@ -9,32 +9,53 @@ #include "Box.h" -#ifdef HAVE_DB - // Include db headers and other OS files if they're needed for the disc implementation - #include - #include - #include - #include - #include -#endif +#include +#include #define BACKIPCLIENTINODETOIDMAP_IMPLEMENTATION #include "BackupClientInodeToIDMap.h" +#undef BACKIPCLIENTINODETOIDMAP_IMPLEMENTATION #include "BackupStoreException.h" - #include "MemLeakFindOn.h" -// What type of Berkeley DB shall we use? -#define TABLE_DATABASE_TYPE DB_HASH - typedef struct { int64_t mObjectID; int64_t mInDirectory; } IDBRecord; +#define BOX_DBM_MESSAGE(stuff) stuff << " (qdbm): " << dperrmsg(dpecode) + +#define BOX_LOG_DBM_ERROR(stuff) \ + BOX_ERROR(BOX_DBM_MESSAGE(stuff)) + +#define THROW_DBM_ERROR(message, filename, exception, subtype) \ + BOX_LOG_DBM_ERROR(message << ": " << filename); \ + THROW_EXCEPTION_MESSAGE(exception, subtype, \ + BOX_DBM_MESSAGE(message << ": " << filename)); + +#define ASSERT_DBM_OK(operation, message, filename, exception, subtype) \ + if(!(operation)) \ + { \ + THROW_DBM_ERROR(message, filename, exception, subtype); \ + } + +#define ASSERT_DBM_OPEN() \ + if(mpDepot == 0) \ + { \ + THROW_EXCEPTION_MESSAGE(BackupStoreException, InodeMapNotOpen, \ + "Inode database not open"); \ + } + +#define ASSERT_DBM_CLOSED() \ + if(mpDepot != 0) \ + { \ + THROW_EXCEPTION_MESSAGE(CommonException, Internal, \ + "Inode database already open: " << mFilename); \ + } + // -------------------------------------------------------------------------- // // Function @@ -44,11 +65,9 @@ // // -------------------------------------------------------------------------- BackupClientInodeToIDMap::BackupClientInodeToIDMap() -#ifndef BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION : mReadOnly(true), mEmpty(false), - dbp(0) -#endif + mpDepot(0) { } @@ -62,19 +81,12 @@ // -------------------------------------------------------------------------- BackupClientInodeToIDMap::~BackupClientInodeToIDMap() { -#ifndef BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION - if(dbp != 0) + if(mpDepot != 0) { -#if BDB_VERSION_MAJOR >= 3 - dbp->close(0); -#else - dbp->close(dbp); -#endif + Close(); } -#endif } - // -------------------------------------------------------------------------- // // Function @@ -83,56 +95,53 @@ // Created: 20/11/03 // // -------------------------------------------------------------------------- -void BackupClientInodeToIDMap::Open(const char *Filename, bool ReadOnly, bool CreateNew) +void BackupClientInodeToIDMap::Open(const char *Filename, bool ReadOnly, + bool CreateNew) { -#ifndef BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION + mFilename = Filename; + // Correct arguments? ASSERT(!(CreateNew && ReadOnly)); // Correct usage? - ASSERT(dbp == 0); + ASSERT_DBM_CLOSED(); ASSERT(!mEmpty); // Open the database file -#if BDB_VERSION_MAJOR >= 3 - dbp = new Db(0,0); - dbp->set_pagesize(1024); /* Page size: 1K. */ - dbp->set_cachesize(0, 32 * 1024, 0); - dbp->open(NULL, Filename, NULL, DB_HASH, DB_CREATE, 0664); -#else - dbp = dbopen(Filename, (CreateNew?O_CREAT:0) | (ReadOnly?O_RDONLY:O_RDWR), S_IRUSR | S_IWUSR | S_IRGRP, TABLE_DATABASE_TYPE, NULL); -#endif - if(dbp == NULL) + int mode = ReadOnly ? DP_OREADER : DP_OWRITER; + if(CreateNew) { - THROW_EXCEPTION(BackupStoreException, BerkelyDBFailure); + mode |= DP_OCREAT; } + mpDepot = dpopen(Filename, mode, 0); + + ASSERT_DBM_OK(mpDepot, "Failed to open inode database", mFilename, + BackupStoreException, BerkelyDBFailure); + // Read only flag mReadOnly = ReadOnly; -#endif } // -------------------------------------------------------------------------- // // Function // Name: BackupClientInodeToIDMap::OpenEmpty() -// Purpose: 'Open' this map. Not associated with a disc file. Useful for when a map -// is required, but is against an empty file on disc which shouldn't be created. -// Implies read only. +// Purpose: 'Open' this map. Not associated with a disc file. +// Useful for when a map is required, but is against +// an empty file on disc which shouldn't be created. +// Implies read only. // Created: 20/11/03 // // -------------------------------------------------------------------------- void BackupClientInodeToIDMap::OpenEmpty() { -#ifndef BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION - ASSERT(dbp == 0); + ASSERT_DBM_CLOSED(); + ASSERT(mpDepot == 0); mEmpty = true; mReadOnly = true; -#endif } - - // -------------------------------------------------------------------------- // // Function @@ -143,75 +152,46 @@ // -------------------------------------------------------------------------- void BackupClientInodeToIDMap::Close() { -#ifndef BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION - if(dbp != 0) - { -#if BDB_VERSION_MAJOR >= 3 - if(dbp->close(0) != 0) -#else - if(dbp->close(dbp) != 0) -#endif - { - THROW_EXCEPTION(BackupStoreException, BerkelyDBFailure); - } - dbp = 0; - } -#endif + ASSERT_DBM_OPEN(); + ASSERT_DBM_OK(dpclose(mpDepot), "Failed to close inode database", + mFilename, BackupStoreException, BerkelyDBFailure); + mpDepot = 0; } - // -------------------------------------------------------------------------- // // Function -// Name: BackupClientInodeToIDMap::AddToMap(InodeRefType, int64_t, int64_t) -// Purpose: Adds an entry to the map. Overwrites any existing entry. +// Name: BackupClientInodeToIDMap::AddToMap(InodeRefType, +// int64_t, int64_t) +// Purpose: Adds an entry to the map. Overwrites any existing +// entry. // Created: 11/11/03 // // -------------------------------------------------------------------------- -void BackupClientInodeToIDMap::AddToMap(InodeRefType InodeRef, int64_t ObjectID, int64_t InDirectory) +void BackupClientInodeToIDMap::AddToMap(InodeRefType InodeRef, int64_t ObjectID, + int64_t InDirectory) { -#ifdef BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION - mMap[InodeRef] = std::pair(ObjectID, InDirectory); -#else if(mReadOnly) { THROW_EXCEPTION(BackupStoreException, InodeMapIsReadOnly); } - if(dbp == 0) + if(mpDepot == 0) { THROW_EXCEPTION(BackupStoreException, InodeMapNotOpen); } + ASSERT_DBM_OPEN(); + // Setup structures IDBRecord rec; rec.mObjectID = ObjectID; rec.mInDirectory = InDirectory; -#if BDB_VERSION_MAJOR >= 3 - Dbt key(&InodeRef, sizeof(InodeRef)); - Dbt data(&rec, sizeof(rec)); - - if (dbp->put(0, &key, &data, 0) != 0) { - THROW_EXCEPTION(BackupStoreException, BerkelyDBFailure); - } -#else - - DBT key; - key.data = &InodeRef; - key.size = sizeof(InodeRef); - - DBT data; - data.data = &rec; - data.size = sizeof(rec); - - // Add to map (or replace existing entry) - if(dbp->put(dbp, &key, &data, 0) != 0) - { - THROW_EXCEPTION(BackupStoreException, BerkelyDBFailure); - } -#endif -#endif + ASSERT_DBM_OK(dpput(mpDepot, (const char *)&InodeRef, sizeof(InodeRef), + (const char *)&rec, sizeof(rec), DP_DOVER), + "Failed to add record to inode database", mFilename, + BackupStoreException, BerkelyDBFailure); } // -------------------------------------------------------------------------- @@ -228,100 +208,32 @@ bool BackupClientInodeToIDMap::Lookup(InodeRefType InodeRef, int64_t &rObjectIDOut, int64_t &rInDirectoryOut) const { -#ifdef BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION - std::map >::const_iterator i(mMap.find(InodeRef)); - - // Found? - if(i == mMap.end()) - { - return false; - } - - // Yes. Return the details - rObjectIDOut = i->second.first; - rInDirectoryOut = i->second.second; - return true; -#else if(mEmpty) { // Map is empty return false; } - if(dbp == 0) + if(mpDepot == 0) { THROW_EXCEPTION(BackupStoreException, InodeMapNotOpen); } - -#if BDB_VERSION_MAJOR >= 3 - Dbt key(&InodeRef, sizeof(InodeRef)); - Dbt data(0, 0); - switch(dbp->get(NULL, &key, &data, 0)) -#else - DBT key; - key.data = &InodeRef; - key.size = sizeof(InodeRef); - DBT data; - data.data = 0; - data.size = 0; + ASSERT_DBM_OPEN(); - switch(dbp->get(dbp, &key, &data, 0)) -#endif + IDBRecord rec; + if(dpgetwb(mpDepot, (const char *)&InodeRef, sizeof(InodeRef), + 0, sizeof(IDBRecord), (char *)&rec) == -1) { - case 1: // key not in file + // key not in file return false; - - case -1: // error - default: // not specified in docs - THROW_EXCEPTION(BackupStoreException, BerkelyDBFailure); - return false; - - case 0: // success, found it - break; } - - // Check for sensible return -#if BDB_VERSION_MAJOR >= 3 - if(key.get_data() == 0 || data.get_size() != sizeof(IDBRecord)) - { - // Assert in debug version - ASSERT(key.get_data() == 0 || data.get_size() != sizeof(IDBRecord)); - // Invalid entries mean it wasn't found - return false; - } - - // Data alignment isn't guaranteed to be on a suitable boundary - IDBRecord rec; - - ::memcpy(&rec, data.get_data(), sizeof(rec)); -#else - if(key.data == 0 || data.size != sizeof(IDBRecord)) - { - // Assert in debug version - ASSERT(key.data == 0 || data.size != sizeof(IDBRecord)); - - // Invalid entries mean it wasn't found - return false; - } - - // Data alignment isn't guaranteed to be on a suitable boundary - IDBRecord rec; - - ::memcpy(&rec, data.data, sizeof(rec)); -#endif - // Return data rObjectIDOut = rec.mObjectID; rInDirectoryOut = rec.mInDirectory; - // Don't have to worry about freeing the returned data - // Found return true; -#endif } - - Modified: box/trunk/bin/bbackupd/BackupClientInodeToIDMap.h =================================================================== --- box/trunk/bin/bbackupd/BackupClientInodeToIDMap.h 2010-02-22 21:57:36 UTC (rev 2630) +++ box/trunk/bin/bbackupd/BackupClientInodeToIDMap.h 2010-02-22 22:10:04 UTC (rev 2631) @@ -8,26 +8,17 @@ // -------------------------------------------------------------------------- #ifndef BACKUPCLIENTINODETOIDMAP_H -#define BACKUPCLIENTINODETOIDMAP__H +#define BACKUPCLIENTINODETOIDMAP_H #include #include #include -// Use in memory implementation if there isn't access to the Berkely DB on this platform -#ifndef HAVE_DB - #define BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION -#endif - // avoid having to include the DB files when not necessary #ifndef BACKIPCLIENTINODETOIDMAP_IMPLEMENTATION -#ifdef BERKELY_V4 - class Db; -#else - class DB; + class DEPOT; #endif -#endif // -------------------------------------------------------------------------- // @@ -55,19 +46,12 @@ void Close(); private: -#ifdef BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION - std::map > mMap; -#else bool mReadOnly; bool mEmpty; -#ifdef BERKELY_V4 - Db *dbp; // c++ style implimentation -#else - DB *dbp; // C style interface, use notation from documentation -#endif // BERKELY_V4 -#endif // BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION + std::string mFilename; + DEPOT *mpDepot; }; -#endif // BACKUPCLIENTINODETOIDMAP__H +#endif // BACKUPCLIENTINODETOIDMAP_H Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.cpp 2010-02-22 21:57:36 UTC (rev 2630) +++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2010-02-22 22:10:04 UTC (rev 2631) @@ -1784,31 +1784,11 @@ // -------------------------------------------------------------------------- void BackupDaemon::SetupIDMapsForSync() { - // Need to do different things depending on whether it's an - // in memory implementation, or whether it's all stored on disc. - -#ifdef BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION - // Make sure we have some blank, empty ID maps DeleteIDMapVector(mNewIDMaps); FillIDMapVector(mNewIDMaps, true /* new maps */); - - // Then make sure that the current maps have objects, - // even if they are empty (for the very first run) - if(mCurrentIDMaps.empty()) - { - FillIDMapVector(mCurrentIDMaps, false /* current maps */); - } - -#else - - // Make sure we have some blank, empty ID maps - DeleteIDMapVector(mNewIDMaps); - FillIDMapVector(mNewIDMaps, true /* new maps */); DeleteIDMapVector(mCurrentIDMaps); FillIDMapVector(mCurrentIDMaps, false /* new maps */); - -#endif } @@ -1935,21 +1915,6 @@ // -------------------------------------------------------------------------- void BackupDaemon::CommitIDMapsAfterSync() { - // Need to do different things depending on whether it's an in memory implementation, - // or whether it's all stored on disc. - -#ifdef BACKIPCLIENTINODETOIDMAP_IN_MEMORY_IMPLEMENTATION - // Remove the current ID maps - DeleteIDMapVector(mCurrentIDMaps); - - // Copy the (pointers to) "new" maps over to be the new "current" maps - mCurrentIDMaps = mNewIDMaps; - - // Clear the new ID maps vector (not delete them!) - mNewIDMaps.clear(); - -#else - // Get rid of the maps in memory (leaving them on disc of course) DeleteIDMapVector(mCurrentIDMaps); DeleteIDMapVector(mNewIDMaps); @@ -1973,8 +1938,6 @@ THROW_EXCEPTION(CommonException, OSFileError) } } - -#endif } @@ -1996,8 +1959,7 @@ rVector.pop_back(); // Close and delete - toDel->Close(); - delete toDel; +win32 rename delete toDel; } ASSERT(rVector.size() == 0); } From subversion at boxbackup.org Wed Feb 24 19:02:47 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Wed, 24 Feb 2010 19:02:47 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2632 - box/trunk/bin/bbackupd Message-ID: <20100224190247.8FD64325044@www.boxbackup.org> Author: chris Date: 2010-02-24 19:02:46 +0000 (Wed, 24 Feb 2010) New Revision: 2632 Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp Log: Undo compile breakage due to bad paste. Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.cpp 2010-02-22 22:10:04 UTC (rev 2631) +++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2010-02-24 19:02:46 UTC (rev 2632) @@ -1959,7 +1959,7 @@ rVector.pop_back(); // Close and delete -win32 rename delete toDel; + delete toDel; } ASSERT(rVector.size() == 0); } From subversion at boxbackup.org Wed Feb 24 19:23:14 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Wed, 24 Feb 2010 19:23:14 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2633 - in box/trunk: bin/bbackupd lib/backupclient Message-ID: <20100224192314.B48D7325044@www.boxbackup.org> Author: chris Date: 2010-02-24 19:23:14 +0000 (Wed, 24 Feb 2010) New Revision: 2633 Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp box/trunk/bin/bbackupd/BackupDaemon.h box/trunk/bin/bbackupd/BackupDaemonInterface.h box/trunk/lib/backupclient/BackupClientFileAttributes.cpp Log: Add notification about uploading new file attributes. Add check for changing file creation times on Windows, to cause the attributes to be uploaded again. Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2010-02-24 19:02:46 UTC (rev 2632) +++ box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2010-02-24 19:23:14 UTC (rev 2633) @@ -613,8 +613,10 @@ const StreamableMemBlock &storeAttrEnc(pDirOnStore->GetAttributes()); // Explict decryption BackupClientFileAttributes storeAttr(storeAttrEnc); + // Compare the attributes - if(attr.Compare(storeAttr, true, true /* ignore both modification times */)) + if(attr.Compare(storeAttr, true, + true /* ignore both modification times */)) { // No update necessary updateAttr = false; Modified: box/trunk/bin/bbackupd/BackupDaemon.h =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.h 2010-02-24 19:02:46 UTC (rev 2632) +++ box/trunk/bin/bbackupd/BackupDaemon.h 2010-02-24 19:23:14 UTC (rev 2633) @@ -444,6 +444,16 @@ BOX_NOTICE("Uploading patch to file: " << rLocalPath); } } + virtual void NotifyFileUploadingAttributes( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) + { + if (mLogAllFileAccess) + { + BOX_NOTICE("Uploading new file attributes: " << + rLocalPath); + } + } virtual void NotifyFileUploaded( const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath, Modified: box/trunk/bin/bbackupd/BackupDaemonInterface.h =================================================================== --- box/trunk/bin/bbackupd/BackupDaemonInterface.h 2010-02-24 19:02:46 UTC (rev 2632) +++ box/trunk/bin/bbackupd/BackupDaemonInterface.h 2010-02-24 19:23:14 UTC (rev 2633) @@ -123,6 +123,9 @@ virtual void NotifyFileUploadingPatch( const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath) = 0; + virtual void NotifyFileUploadingAttributes( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; virtual void NotifyFileUploaded( const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath, Modified: box/trunk/lib/backupclient/BackupClientFileAttributes.cpp =================================================================== --- box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-24 19:02:46 UTC (rev 2632) +++ box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-24 19:23:14 UTC (rev 2633) @@ -78,6 +78,9 @@ typedef struct { int32_t uid, gid, mode; + #ifdef WIN32 + int64_t fileCreationTime; + #endif } attributeHashData; // Use default packing @@ -221,12 +224,15 @@ // // Function // Name: BackupClientFileAttributes::Compare(const BackupClientFileAttributes &, bool) -// Purpose: Compare, optionally ignoring the attribute modification time and/or modification time, and some data which is -// irrelevant in practise (eg file generation number) +// Purpose: Compare, optionally ignoring the attribute +// modification time and/or modification time, and some +// data which is irrelevant in practise (eg file +// generation number) // Created: 10/12/03 // // -------------------------------------------------------------------------- -bool BackupClientFileAttributes::Compare(const BackupClientFileAttributes &rAttr, bool IgnoreAttrModTime, bool IgnoreModTime) const +bool BackupClientFileAttributes::Compare(const BackupClientFileAttributes &rAttr, + bool IgnoreAttrModTime, bool IgnoreModTime) const { EnsureClearAvailable(); rAttr.EnsureClearAvailable(); @@ -1070,14 +1076,18 @@ // -------------------------------------------------------------------------- // // Function -// Name: BackupClientFileAttributes::GenerateAttributeHash(struct stat &, const std::string &, const std::string &) -// Purpose: Generate a 64 bit hash from the attributes, used to detect changes. -// Include filename in the hash, so that it changes from one file to another, -// so don't reveal identical attributes. +// Name: BackupClientFileAttributes::GenerateAttributeHash( +// struct stat &, const std::string &, +// const std::string &) +// Purpose: Generate a 64 bit hash from the attributes, used to +// detect changes. Include filename in the hash, so +// that it changes from one file to another, so don't +// reveal identical attributes. // Created: 25/4/04 // // -------------------------------------------------------------------------- -uint64_t BackupClientFileAttributes::GenerateAttributeHash(EMU_STRUCT_STAT &st, const std::string &filename, const std::string &leafname) +uint64_t BackupClientFileAttributes::GenerateAttributeHash(EMU_STRUCT_STAT &st, + const std::string &filename, const std::string &leafname) { if(sAttributeHashSecretLength == 0) { @@ -1092,6 +1102,16 @@ hashData.gid = htonl(st.st_gid); hashData.mode = htonl(st.st_mode); + #ifdef WIN32 + // On Windows, the "file attribute modification time" is the + // file creation time, and we want to back this up, restore + // it and compare it. + // + // On other platforms, it's not very important and can't + // reliably be set to anything other than the current time. + hashData.fileCreationTime = box_hton64(st.st_ctime); + #endif + StreamableMemBlock xattr; FillExtendedAttr(xattr, filename.c_str()); @@ -1100,7 +1120,7 @@ digest.Add(&hashData, sizeof(hashData)); digest.Add(xattr.GetBuffer(), xattr.GetSize()); digest.Add(leafname.c_str(), leafname.size()); - digest.Add(sAttributeHashSecret, sAttributeHashSecretLength); + digest.Add(sAttributeHashSecret, sAttributeHashSecretLength); digest.Finish(); // Return the first 64 bits of the hash From subversion at boxbackup.org Wed Feb 24 19:39:40 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Wed, 24 Feb 2010 19:39:40 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2634 - box/trunk/bin/bbackupd Message-ID: <20100224193940.B0E70325044@www.boxbackup.org> Author: chris Date: 2010-02-24 19:39:39 +0000 (Wed, 24 Feb 2010) New Revision: 2634 Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: Notify about uploading changed attributes for files as well as directories. Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2010-02-24 19:23:14 UTC (rev 2633) +++ box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2010-02-24 19:39:39 UTC (rev 2634) @@ -1050,6 +1050,9 @@ { try { + rNotifier.NotifyFileUploadingAttributes( + this, filename); + // Update store BackupClientFileAttributes attr; attr.ReadAttributes(filename.c_str(), false /* put mod times in the attributes, please */); From subversion at boxbackup.org Wed Feb 24 20:12:01 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Wed, 24 Feb 2010 20:12:01 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2635 - in box/trunk: bin/bbackupquery lib/backupclient Message-ID: <20100224201201.120E1325044@www.boxbackup.org> Author: chris Date: 2010-02-24 20:12:00 +0000 (Wed, 24 Feb 2010) New Revision: 2635 Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp box/trunk/lib/backupclient/BackupClientFileAttributes.cpp box/trunk/lib/backupclient/BackupClientFileAttributes.h Log: Add method to get updated modification time of BackupClientFileAttributes. Add listing of attribute modification time to bbackupquery "list -t" command. Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/trunk/bin/bbackupquery/BackupQueries.cpp 2010-02-24 19:39:39 UTC (rev 2634) +++ box/trunk/bin/bbackupquery/BackupQueries.cpp 2010-02-24 20:12:00 UTC (rev 2635) @@ -435,7 +435,23 @@ List(rootDir, listRoot, opts, true /* first level to list */); } +static std::string GetTimeString(BackupStoreDirectory::Entry& en, + bool useLocalTime) +{ + std::ostringstream out; + out << BoxTimeToISO8601String(en.GetModificationTime(), useLocalTime); + if(en.HasAttributes()) + { + const StreamableMemBlock &storeAttr(en.GetAttributes()); + BackupClientFileAttributes attr(storeAttr); + out << "~" << BoxTimeToISO8601String(attr.GetModificationTime(), + useLocalTime); + } + + return out.str(); +} + // -------------------------------------------------------------------------- // // Function @@ -534,17 +550,13 @@ if(opts[LIST_OPTION_TIMES_UTC]) { // Show UTC times... - std::string time = BoxTimeToISO8601String( - en->GetModificationTime(), false); - printf("%s ", time.c_str()); + printf("%s ", GetTimeString(*en, false).c_str()); } if(opts[LIST_OPTION_TIMES_LOCAL]) { // Show local times... - std::string time = BoxTimeToISO8601String( - en->GetModificationTime(), true); - printf("%s ", time.c_str()); + printf("%s ", GetTimeString(*en, true).c_str()); } if(opts[LIST_OPTION_DISPLAY_HASH]) Modified: box/trunk/lib/backupclient/BackupClientFileAttributes.cpp =================================================================== --- box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-24 19:39:39 UTC (rev 2634) +++ box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-24 20:12:00 UTC (rev 2635) @@ -647,7 +647,53 @@ #endif } +// -------------------------------------------------------------------------- +// +// Function +// Name: BackupClientFileAttributes::GetModificationTime() +// Purpose: Returns the modification time embedded in the +// attributes. +// Created: 2010/02/24 +// +// -------------------------------------------------------------------------- +box_time_t BackupClientFileAttributes::GetModificationTime() const +{ + // Got something loaded + if(GetSize() <= 0) + { + THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); + } + + // Make sure there are clear attributes to use + EnsureClearAvailable(); + ASSERT(mpClearAttributes != 0); + // Check if the decrypted attributes are small enough, and the type of attributes stored + if(mpClearAttributes->GetSize() < (int)sizeof(int32_t)) + { + THROW_EXCEPTION(BackupStoreException, AttributesNotUnderstood); + } + int32_t *type = (int32_t*)mpClearAttributes->GetBuffer(); + ASSERT(type != 0); + if(ntohl(*type) != ATTRIBUTETYPE_GENERIC_UNIX) + { + // Don't know what to do with these + THROW_EXCEPTION(BackupStoreException, AttributesNotUnderstood); + } + + // Check there is enough space for an attributes block + if(mpClearAttributes->GetSize() < (int)sizeof(attr_StreamFormat)) + { + // Too small + THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); + } + + // Get pointer to structure + attr_StreamFormat *pattr = (attr_StreamFormat*)mpClearAttributes->GetBuffer(); + + return box_ntoh64(pattr->ModificationTime); +} + // -------------------------------------------------------------------------- // // Function Modified: box/trunk/lib/backupclient/BackupClientFileAttributes.h =================================================================== --- box/trunk/lib/backupclient/BackupClientFileAttributes.h 2010-02-24 19:39:39 UTC (rev 2634) +++ box/trunk/lib/backupclient/BackupClientFileAttributes.h 2010-02-24 20:12:00 UTC (rev 2635) @@ -47,7 +47,8 @@ InodeRefType *pInodeNumber = 0, bool *pHasMultipleLinks = 0); void WriteAttributes(const char *Filename, bool MakeUserWritable = false) const; - + box_time_t GetModificationTime() const; + bool IsSymLink() const; static void SetBlowfishKey(const void *pKey, int KeyLength); From subversion at boxbackup.org Wed Feb 24 20:28:33 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Wed, 24 Feb 2010 20:28:33 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2636 - in box/trunk: bin/bbackupquery lib/backupclient Message-ID: <20100224202833.D098A325044@www.boxbackup.org> Author: chris Date: 2010-02-24 20:28:33 +0000 (Wed, 24 Feb 2010) New Revision: 2636 Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp box/trunk/lib/backupclient/BackupClientFileAttributes.cpp box/trunk/lib/backupclient/BackupClientFileAttributes.h Log: Add option to display attribute modification times from additional attributes if available in bbackupquery. Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/trunk/bin/bbackupquery/BackupQueries.cpp 2010-02-24 20:12:00 UTC (rev 2635) +++ box/trunk/bin/bbackupquery/BackupQueries.cpp 2010-02-24 20:28:33 UTC (rev 2636) @@ -212,7 +212,7 @@ { { "quit", "" }, { "exit", "" }, - { "list", "rodIFtTsh", }, + { "list", "rodIFtTash", }, { "pwd", "" }, { "cd", "od" }, { "lcd", "" }, @@ -397,6 +397,7 @@ #define LIST_OPTION_NOFLAGS 'F' #define LIST_OPTION_TIMES_LOCAL 't' #define LIST_OPTION_TIMES_UTC 'T' + #define LIST_OPTION_TIMES_ATTRIBS 'a' #define LIST_OPTION_SIZEINBLOCKS 's' #define LIST_OPTION_DISPLAY_HASH 'h' @@ -436,18 +437,48 @@ } static std::string GetTimeString(BackupStoreDirectory::Entry& en, - bool useLocalTime) + bool useLocalTime, bool showAttrModificationTimes) { std::ostringstream out; - out << BoxTimeToISO8601String(en.GetModificationTime(), useLocalTime); + box_time_t originalTime, newAttributesTime; + // there is no attribute modification time in the directory + // entry, unfortunately, so we can't display it. + originalTime = en.GetModificationTime(); + out << BoxTimeToISO8601String(originalTime, useLocalTime); + if(en.HasAttributes()) { const StreamableMemBlock &storeAttr(en.GetAttributes()); BackupClientFileAttributes attr(storeAttr); - out << "~" << BoxTimeToISO8601String(attr.GetModificationTime(), - useLocalTime); + + box_time_t NewModificationTime, NewAttrModificationTime; + attr.GetModificationTimes(&NewModificationTime, + &NewAttrModificationTime); + + if (showAttrModificationTimes) + { + newAttributesTime = NewAttrModificationTime; + } + else + { + newAttributesTime = NewModificationTime; + } + + if (newAttributesTime == originalTime) + { + out << "*"; + } + else + { + out << "~" << BoxTimeToISO8601String(newAttributesTime, + useLocalTime); + } } + else + { + out << " "; + } return out.str(); } @@ -550,13 +581,15 @@ if(opts[LIST_OPTION_TIMES_UTC]) { // Show UTC times... - printf("%s ", GetTimeString(*en, false).c_str()); + printf("%s ", GetTimeString(*en, false, + opts[LIST_OPTION_TIMES_ATTRIBS]).c_str()); } if(opts[LIST_OPTION_TIMES_LOCAL]) { // Show local times... - printf("%s ", GetTimeString(*en, true).c_str()); + printf("%s ", GetTimeString(*en, true, + opts[LIST_OPTION_TIMES_ATTRIBS]).c_str()); } if(opts[LIST_OPTION_DISPLAY_HASH]) Modified: box/trunk/lib/backupclient/BackupClientFileAttributes.cpp =================================================================== --- box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-24 20:12:00 UTC (rev 2635) +++ box/trunk/lib/backupclient/BackupClientFileAttributes.cpp 2010-02-24 20:28:33 UTC (rev 2636) @@ -650,13 +650,15 @@ // -------------------------------------------------------------------------- // // Function -// Name: BackupClientFileAttributes::GetModificationTime() +// Name: BackupClientFileAttributes::GetModificationTimes() // Purpose: Returns the modification time embedded in the // attributes. // Created: 2010/02/24 // // -------------------------------------------------------------------------- -box_time_t BackupClientFileAttributes::GetModificationTime() const +void BackupClientFileAttributes::GetModificationTimes( + box_time_t *pModificationTime, + box_time_t *pAttrModificationTime) const { // Got something loaded if(GetSize() <= 0) @@ -691,7 +693,15 @@ // Get pointer to structure attr_StreamFormat *pattr = (attr_StreamFormat*)mpClearAttributes->GetBuffer(); - return box_ntoh64(pattr->ModificationTime); + if(pModificationTime) + { + *pModificationTime = box_ntoh64(pattr->ModificationTime); + } + + if(pAttrModificationTime) + { + *pAttrModificationTime = box_ntoh64(pattr->AttrModificationTime); + } } // -------------------------------------------------------------------------- Modified: box/trunk/lib/backupclient/BackupClientFileAttributes.h =================================================================== --- box/trunk/lib/backupclient/BackupClientFileAttributes.h 2010-02-24 20:12:00 UTC (rev 2635) +++ box/trunk/lib/backupclient/BackupClientFileAttributes.h 2010-02-24 20:28:33 UTC (rev 2636) @@ -47,7 +47,8 @@ InodeRefType *pInodeNumber = 0, bool *pHasMultipleLinks = 0); void WriteAttributes(const char *Filename, bool MakeUserWritable = false) const; - box_time_t GetModificationTime() const; + void GetModificationTimes(box_time_t *pModificationTime, + box_time_t *pAttrModificationTime) const; bool IsSymLink() const; From subversion at boxbackup.org Wed Feb 24 21:42:20 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Wed, 24 Feb 2010 21:42:20 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2637 - box/trunk/bin/bbackupquery Message-ID: <20100224214220.99204325044@www.boxbackup.org> Author: chris Date: 2010-02-24 21:42:19 +0000 (Wed, 24 Feb 2010) New Revision: 2637 Modified: box/trunk/bin/bbackupquery/documentation.txt Log: Updated bbackupquery help to list some undocumented options. Modified: box/trunk/bin/bbackupquery/documentation.txt =================================================================== --- box/trunk/bin/bbackupquery/documentation.txt 2010-02-24 20:28:33 UTC (rev 2636) +++ box/trunk/bin/bbackupquery/documentation.txt 2010-02-24 21:42:19 UTC (rev 2637) @@ -38,10 +38,13 @@ -o -- list old versions of files/directories -I -- don't display object ID -F -- don't display flags - -t -- show file modification time - (and attr mod time if has the object has attributes, ~ separated) + -t -- show file modification time in local time + (and attr mod time if has the object has attributes, ~ separated) + -T -- show file modification time in GMT + -a -- show updated attribute instead of file modification time -s -- show file size in blocks used on server - (only very approximate indication of size locally) + (only very approximate indication of size locally) + -h -- show file attributes hash ls can be used as an alias. < From subversion at boxbackup.org Wed Feb 24 21:44:21 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Wed, 24 Feb 2010 21:44:21 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2638 - box/chris/win32/releases Message-ID: <20100224214421.143EC325044@www.boxbackup.org> Author: chris Date: 2010-02-24 21:44:20 +0000 (Wed, 24 Feb 2010) New Revision: 2638 Added: box/chris/win32/releases/boxbackup-trunk_2631-backup-client-mingw32.zip Log: New release of the Windows client, with file creation time included in the attributes hash so that files whose creation time has changed will have new attributes uploaded. Thanks to Roy for reporting the issue and helping to debug and test it. Added: box/chris/win32/releases/boxbackup-trunk_2631-backup-client-mingw32.zip =================================================================== (Binary files differ) Property changes on: box/chris/win32/releases/boxbackup-trunk_2631-backup-client-mingw32.zip ___________________________________________________________________ Added: svn:mime-type + application/octet-stream From subversion at boxbackup.org Thu Feb 25 21:48:51 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Thu, 25 Feb 2010 21:48:51 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2639 - in box/trunk: . infrastructure Message-ID: <20100225214851.265B4325044@www.boxbackup.org> Author: chris Date: 2010-02-25 21:48:49 +0000 (Thu, 25 Feb 2010) New Revision: 2639 Modified: box/trunk/infrastructure/makeparcels.pl.in box/trunk/parcels.txt Log: Only build the static library part of QDBM, as the default dynamic build doesn't work on OSX and we don't care about the binary tools. Thanks to Melissa for the bug report. Modified: box/trunk/infrastructure/makeparcels.pl.in =================================================================== --- box/trunk/infrastructure/makeparcels.pl.in 2010-02-24 21:44:20 UTC (rev 2638) +++ box/trunk/infrastructure/makeparcels.pl.in 2010-02-25 21:48:49 UTC (rev 2639) @@ -244,11 +244,12 @@ } elsif ($type eq 'subdir') { + shift @args; print MAKE < Author: chris Date: 2010-02-25 21:52:04 +0000 (Thu, 25 Feb 2010) New Revision: 2640 Modified: box/trunk/infrastructure/makebuildenv.pl.in Log: Quieten the Perl scripts that generate autogen exceptions when building in the default quiet mode. Modified: box/trunk/infrastructure/makebuildenv.pl.in =================================================================== --- box/trunk/infrastructure/makebuildenv.pl.in 2010-02-25 21:48:49 UTC (rev 2639) +++ box/trunk/infrastructure/makebuildenv.pl.in 2010-02-25 21:52:04 UTC (rev 2640) @@ -599,7 +599,7 @@ _WINDRES = @ echo " [WINDRES]" \$(*F) && \$(WINDRES) _AR = @ echo " [AR] " \$(*F) && \$(AR) _RANLIB = @ echo " [RANLIB] " \$(*F) && \$(RANLIB) -_PERL = @ echo " [PERL] " \$(*F) && \$(PERL) +_PERL = @ echo " [PERL] " \$(*F) && \$(PERL) >/dev/null .endif __E @@ -613,7 +613,7 @@ _WINDRES = \$(if \$(V),\$(WINDRES), @ echo " [WINDRES] \$<" && \$(WINDRES)) _AR = \$(if \$(V),\$(AR), @ echo " [AR] \$@" && \$(AR)) _RANLIB = \$(if \$(V),\$(RANLIB), @ echo " [RANLIB] \$@" && \$(RANLIB)) -_PERL = \$(if \$(V),\$(PERL), @ echo " [PERL] \$@" && \$(PERL)) +_PERL = \$(if \$(V),\$(PERL), @ echo " [PERL] \$@" && \$(PERL) >/dev/null) __E } From subversion at boxbackup.org Thu Feb 25 23:20:28 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Thu, 25 Feb 2010 23:20:28 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2641 - box/trunk/bin/bbackupquery Message-ID: <20100225232028.F05DF325044@www.boxbackup.org> Author: chris Date: 2010-02-25 23:20:27 +0000 (Thu, 25 Feb 2010) New Revision: 2641 Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp box/trunk/bin/bbackupquery/BackupQueries.h box/trunk/bin/bbackupquery/bbackupquery.cpp Log: First attempt at tab completion for readline/libedit in bbackupquery, with commands and local file names, because it's easy and will help to find compatibility problems. Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/trunk/bin/bbackupquery/BackupQueries.cpp 2010-02-25 21:52:04 UTC (rev 2640) +++ box/trunk/bin/bbackupquery/BackupQueries.cpp 2010-02-25 23:20:27 UTC (rev 2641) @@ -63,6 +63,30 @@ #define COMPARE_RETURN_ERROR 3 #define COMMAND_RETURN_ERROR 4 +// Data about commands +QueryCommandSpecification commands[] = +{ + { "quit", "" }, + { "exit", "" }, + { "list", "rodIFtTash", }, + { "pwd", "" }, + { "cd", "od" }, + { "lcd", "" }, + { "sh", "" }, + { "getobject", "" }, + { "get", "i" }, + { "compare", "alcqAEQ" }, + { "restore", "drif" }, + { "help", "" }, + { "usage", "m" }, + { "undelete", "" }, + { "delete", "" }, + { NULL, NULL } +}; + +const char *alias[] = {"ls", 0}; +const int aliasIs[] = {Command_List, 0}; + // -------------------------------------------------------------------------- // // Function @@ -100,12 +124,6 @@ { } -typedef struct -{ - const char* name; - const char* opts; -} QueryCommandSpecification; - // -------------------------------------------------------------------------- // // Function @@ -206,51 +224,7 @@ // blank command return; } - - // Data about commands - static QueryCommandSpecification commands[] = - { - { "quit", "" }, - { "exit", "" }, - { "list", "rodIFtTash", }, - { "pwd", "" }, - { "cd", "od" }, - { "lcd", "" }, - { "sh", "" }, - { "getobject", "" }, - { "get", "i" }, - { "compare", "alcqAEQ" }, - { "restore", "drif" }, - { "help", "" }, - { "usage", "m" }, - { "undelete", "" }, - { "delete", "" }, - { NULL, NULL } - }; - typedef enum - { - Command_Quit = 0, - Command_Exit, - Command_List, - Command_pwd, - Command_cd, - Command_lcd, - Command_sh, - Command_GetObject, - Command_Get, - Command_Compare, - Command_Restore, - Command_Help, - Command_Usage, - Command_Undelete, - Command_Delete, - } - CommandType; - - static const char *alias[] = {"ls", 0}; - static const int aliasIs[] = {Command_List, 0}; - // Work out which command it is... int cmd = 0; while(commands[cmd].name != 0 && ::strcmp(cmdElements[0].c_str(), commands[cmd].name) != 0) Modified: box/trunk/bin/bbackupquery/BackupQueries.h =================================================================== --- box/trunk/bin/bbackupquery/BackupQueries.h 2010-02-25 21:52:04 UTC (rev 2640) +++ box/trunk/bin/bbackupquery/BackupQueries.h 2010-02-25 23:20:27 UTC (rev 2641) @@ -20,6 +20,39 @@ class Configuration; class ExcludeList; +typedef struct +{ + const char* name; + const char* opts; +} +QueryCommandSpecification; + +// Data about commands +extern QueryCommandSpecification commands[]; + +typedef enum +{ + Command_Quit = 0, + Command_Exit, + Command_List, + Command_pwd, + Command_cd, + Command_lcd, + Command_sh, + Command_GetObject, + Command_Get, + Command_Compare, + Command_Restore, + Command_Help, + Command_Usage, + Command_Undelete, + Command_Delete, +} +CommandType; + +extern const char *alias[]; +extern const int aliasIs[]; + // -------------------------------------------------------------------------- // // Class Modified: box/trunk/bin/bbackupquery/bbackupquery.cpp =================================================================== --- box/trunk/bin/bbackupquery/bbackupquery.cpp 2010-02-25 21:52:04 UTC (rev 2640) +++ box/trunk/bin/bbackupquery/bbackupquery.cpp 2010-02-25 23:20:27 UTC (rev 2641) @@ -74,6 +74,72 @@ exit(1); } +#ifdef HAVE_LIBREADLINE +// copied from: http://tiswww.case.edu/php/chet/readline/readline.html#SEC44 + +char * command_generator(const char *text, int state) +{ + static int list_index, len; + const char *name; + + /* + * If this is a new word to complete, initialize now. This includes + * saving the length of TEXT for efficiency, and initializing the index + * variable to 0. + */ + if(!state) + { + list_index = 0; + len = strlen(text); + } + + /* Return the next name which partially matches from the command list. */ + while((name = commands[list_index].name)) + { + list_index++; + + if(::strncmp(name, text, len) == 0 && !(state--)) + { + return ::strdup(name); + } + } + + list_index = 0; + + while((name = alias[list_index])) + { + list_index++; + + if(::strncmp(name, text, len) == 0 && !(state--)) + { + return ::strdup(name); + } + } + + /* If no names matched, then return NULL. */ + return (char *) NULL; +} + +char ** bbackupquery_completion(const char *text, int start, int end) +{ + char **matches; + + matches = (char **)NULL; + + /* If this word is at the start of the line, then it is a command + * to complete. Otherwise it is the name of a file in the current + * directory. + */ + if (start == 0) + { + matches = rl_completion_matches(text, command_generator); + } + + return matches; +} + +#endif // HAVE_LIBREADLINE + int main(int argc, const char *argv[]) { int returnCode = 0; @@ -369,6 +435,12 @@ #ifdef HAVE_READLINE_HISTORY using_history(); #endif + /* Allow conditional parsing of the ~/.inputrc file. */ + rl_readline_name = "bbackupquery"; + + /* Tell the completer that we want a crack first. */ + rl_attempted_completion_function = bbackupquery_completion; + char *last_cmd = 0; while(!context.Stop()) { From subversion at boxbackup.org Fri Feb 26 06:50:56 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 26 Feb 2010 06:50:56 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2642 - in box/trunk: docs/api-notes infrastructure/mingw Message-ID: <20100226065056.EBD36325044@www.boxbackup.org> Author: chris Date: 2010-02-26 06:50:55 +0000 (Fri, 26 Feb 2010) New Revision: 2642 Modified: box/trunk/docs/api-notes/win32_build_on_cygwin_using_mingw.txt box/trunk/infrastructure/mingw/configure.sh Log: Add instructions and support for building with readline on Windows. Modified: box/trunk/docs/api-notes/win32_build_on_cygwin_using_mingw.txt =================================================================== --- box/trunk/docs/api-notes/win32_build_on_cygwin_using_mingw.txt 2010-02-25 23:20:27 UTC (rev 2641) +++ box/trunk/docs/api-notes/win32_build_on_cygwin_using_mingw.txt 2010-02-26 06:50:55 UTC (rev 2642) @@ -68,6 +68,19 @@ cp .libs/libpcre.a .libs/libpcreposix.a /lib/mingw cp pcreposix.h /usr/include/mingw +== Readline (Optional) == + +If you want Readline support, download Readline version 6.1, unpack +and install thus: + + tar xzvf readline-6.1.tar.gz + ./configure --prefix=/usr/i686-pc-mingw32 \ + CFLAGS="-mno-cygwin" \ + CPPFLAGS="-mno-cygwin" \ + LDFLAGS="-mno-cygwin" + make + make install + == Download Box Backup == Go back to the base directory, and download the latest Box Backup sources: @@ -83,7 +96,7 @@ Enter the source directory and configure like this: cd trunk - ./infrastructure/mingw/configure.sh + ./infrastructure/mingw/configure.sh [--enable-gnu-readline] make == Installation == Modified: box/trunk/infrastructure/mingw/configure.sh =================================================================== --- box/trunk/infrastructure/mingw/configure.sh 2010-02-25 23:20:27 UTC (rev 2641) +++ box/trunk/infrastructure/mingw/configure.sh 2010-02-26 06:50:55 UTC (rev 2642) @@ -29,7 +29,7 @@ fi fi -if ! ./configure --target=i686-pc-mingw32; then +if ! ./configure --target=i686-pc-mingw32 "$@"; then echo "Error: configure failed, aborting." >&2 exit 1 fi From subversion at boxbackup.org Fri Feb 26 14:11:34 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 26 Feb 2010 14:11:34 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2643 - in box/trunk: bin/bbackupquery infrastructure/m4 Message-ID: <20100226141134.3318B325044@www.boxbackup.org> Author: chris Date: 2010-02-26 14:11:33 +0000 (Fri, 26 Feb 2010) New Revision: 2643 Modified: box/trunk/bin/bbackupquery/bbackupquery.cpp box/trunk/infrastructure/m4/vl_lib_readline.m4 Log: Detect whether rl_completion_matches or completion_matches is declared by readline headers at configure time, and use the appropriate one in bbackupquery. Thanks to Melissa Jenkins for reporting the compilation failure on OSX and providing additional details. Modified: box/trunk/bin/bbackupquery/bbackupquery.cpp =================================================================== --- box/trunk/bin/bbackupquery/bbackupquery.cpp 2010-02-26 06:50:55 UTC (rev 2642) +++ box/trunk/bin/bbackupquery/bbackupquery.cpp 2010-02-26 14:11:33 UTC (rev 2643) @@ -132,7 +132,12 @@ */ if (start == 0) { - matches = rl_completion_matches(text, command_generator); + #ifdef HAVE_RL_COMPLETION_MATCHES + matches = rl_completion_matches(text, + command_generator); + #elif defined HAVE_COMPLETION_MATCHES + matches = completion_matches(text, command_generator); + #endif } return matches; Modified: box/trunk/infrastructure/m4/vl_lib_readline.m4 =================================================================== --- box/trunk/infrastructure/m4/vl_lib_readline.m4 2010-02-26 06:50:55 UTC (rev 2642) +++ box/trunk/infrastructure/m4/vl_lib_readline.m4 2010-02-26 14:11:33 UTC (rev 2643) @@ -79,6 +79,16 @@ fi ]) +dnl BOX_CHECK_VAR(name, where, headers) +AC_DEFUN([BOX_CHECK_VAR], [ + AC_CACHE_CHECK([for $1 $2], [vl_cv_var_$1], + [AC_TRY_LINK([$3], [(void) $1], [vl_cv_var_$1=yes], [vl_cv_var_$1=no]) + ]) + if test "${vl_cv_var_$1}" = "yes"; then + AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$1), 1, [Define if you have $1 $2]) + fi + ]) + dnl VL_LIB_READLINE_CHECK(name, libraries, headers, history headers) AC_DEFUN([VL_LIB_READLINE_CHECK], [ AC_CACHE_CHECK([for $1 library], @@ -108,12 +118,23 @@ fi ]) + vl_cv_lib_includes="" + vl_cv_lib_readline_compat_found=no if test "x$vl_cv_lib_$1" != "xno"; then - AC_CHECK_HEADERS([$3], [vl_cv_lib_readline_compat_found=yes]) + AC_CHECK_HEADERS([$3], [ + vl_cv_lib_readline_compat_found=yes + vl_cv_lib_includes="$vl_cv_lib_headers #include <$ac_header>" + ]) fi if test "x$vl_cv_lib_readline_compat_found" = "xyes"; then + BOX_CHECK_VAR([rl_completion_matches], [in readline headers], + [$vl_cv_lib_includes]) + + BOX_CHECK_VAR([completion_matches], [in readline headers], + [$vl_cv_lib_includes]) + AC_DEFINE([HAVE_LIBREADLINE], 1, [Define if you have a readline compatible library]) From subversion at boxbackup.org Fri Feb 26 14:36:53 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 26 Feb 2010 14:36:53 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2644 - box/trunk Message-ID: <20100226143653.B33A5325044@www.boxbackup.org> Author: chris Date: 2010-02-26 14:36:53 +0000 (Fri, 26 Feb 2010) New Revision: 2644 Modified: box/trunk/parcels.txt Log: Try again to fix QDBM build on OSX. Modified: box/trunk/parcels.txt =================================================================== --- box/trunk/parcels.txt 2010-02-26 14:11:33 UTC (rev 2643) +++ box/trunk/parcels.txt 2010-02-26 14:36:53 UTC (rev 2644) @@ -18,7 +18,7 @@ html bbackupd-config html bbackupd.conf - subdir qdbm static + subdir qdbm libqdbm.a EXCEPT:mingw32,mingw32msvc man bbackupd.8 From subversion at boxbackup.org Sun Feb 28 15:34:48 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sun, 28 Feb 2010 15:34:48 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2645 - box/trunk/bin/bbstored Message-ID: <20100228153448.C5D6B32503B@www.boxbackup.org> Author: chris Date: 2010-02-28 15:34:47 +0000 (Sun, 28 Feb 2010) New Revision: 2645 Modified: box/trunk/bin/bbstored/HousekeepStoreAccount.cpp Log: Log keeping referenced files and deleting unreferenced ones on the store. Modified: box/trunk/bin/bbstored/HousekeepStoreAccount.cpp =================================================================== --- box/trunk/bin/bbstored/HousekeepStoreAccount.cpp 2010-02-26 14:36:53 UTC (rev 2644) +++ box/trunk/bin/bbstored/HousekeepStoreAccount.cpp 2010-02-28 15:34:47 UTC (rev 2645) @@ -889,15 +889,23 @@ } // Drop reference count by one. If it reaches zero, delete the file. - if (--mNewRefCounts[ObjectID] == 0) + if(--mNewRefCounts[ObjectID] == 0) { // Delete from disc + BOX_TRACE("Removing unreferenced object " << + BOX_FORMAT_OBJECTID(ObjectID)); std::string objFilename; MakeObjectFilename(ObjectID, objFilename); RaidFileWrite del(mStoreDiscSet, objFilename, mNewRefCounts[ObjectID]); del.Delete(); } + else + { + BOX_TRACE("Preserving object " << + BOX_FORMAT_OBJECTID(ObjectID) << " with " << + mNewRefCounts[ObjectID] << " references"); + } // Adjust counts for the file ++mFilesDeleted; From subversion at boxbackup.org Sun Feb 28 16:28:39 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sun, 28 Feb 2010 16:28:39 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2646 - box/trunk/test/backupstorepatch Message-ID: <20100228162839.0727C32503B@www.boxbackup.org> Author: chris Date: 2010-02-28 16:28:38 +0000 (Sun, 28 Feb 2010) New Revision: 2646 Modified: box/trunk/test/backupstorepatch/testbackupstorepatch.cpp Log: Add test for failure to remove an unreferenced object as expected during housekeeping. Modified: box/trunk/test/backupstorepatch/testbackupstorepatch.cpp =================================================================== --- box/trunk/test/backupstorepatch/testbackupstorepatch.cpp 2010-02-28 15:34:47 UTC (rev 2645) +++ box/trunk/test/backupstorepatch/testbackupstorepatch.cpp 2010-02-28 16:28:38 UTC (rev 2646) @@ -13,29 +13,33 @@ #include #include -#include "Test.h" #include "autogen_BackupProtocolClient.h" -#include "SSLLib.h" -#include "TLSContext.h" -#include "SocketStreamTLS.h" -#include "BoxPortsAndFiles.h" +#include "BackupClientCryptoKeys.h" +#include "BackupClientFileAttributes.h" +#include "BackupStoreAccountDatabase.h" +#include "BackupStoreAccounts.h" #include "BackupStoreConstants.h" -#include "Socket.h" +#include "BackupStoreDirectory.h" +#include "BackupStoreException.h" +#include "BackupStoreFile.h" #include "BackupStoreFilenameClear.h" +#include "BackupStoreInfo.h" +#include "BoxPortsAndFiles.h" #include "CollectInBufferStream.h" -#include "BackupStoreDirectory.h" -#include "BackupStoreFile.h" #include "FileStream.h" +#include "MemBlockStream.h" #include "RaidFileController.h" +#include "RaidFileException.h" #include "RaidFileRead.h" +#include "RaidFileUtil.h" #include "RaidFileWrite.h" -#include "BackupStoreInfo.h" -#include "BackupStoreException.h" -#include "RaidFileException.h" -#include "MemBlockStream.h" -#include "BackupClientFileAttributes.h" -#include "BackupClientCryptoKeys.h" +#include "SSLLib.h" #include "ServerControl.h" +#include "Socket.h" +#include "SocketStreamTLS.h" +#include "StoreStructure.h" +#include "TLSContext.h" +#include "Test.h" #include "MemLeakFindOn.h" @@ -320,8 +324,17 @@ // Check the basic directory stuff works test_depends_in_dirs(); + + std::string storeRootDir; + int discSet = 0; + { + std::auto_ptr apDatabase( + BackupStoreAccountDatabase::Read("testfiles/accounts.txt")); + BackupStoreAccounts accounts(*apDatabase); + accounts.GetAccountRoot(0x1234567, storeRootDir, discSet); + } + RaidFileDiscSet rfd(rcontroller.GetDiscSet(discSet)); - // First, try logging in without an account having been created... just make sure login fails. int pid = LaunchServer(BBSTORED " testfiles/bbstored.conf", "testfiles/bbstored.pid"); TEST_THAT(pid != -1 && pid != 0); @@ -478,6 +491,19 @@ if(en == 0) { TEST_THAT(test_files[f].HasBeenDeleted); + // check that unreferenced + // object was removed by + // housekeeping + std::string filenameOut; + int startDisc = 0; + StoreStructure::MakeObjectFilename( + test_files[f].IDOnServer, + storeRootDir, discSet, + filenameOut, + false /* don't bother ensuring the directory exists */); + TEST_EQUAL(RaidFileUtil::NoFile, + RaidFileUtil::RaidFileExists( + rfd, filenameOut)); } else { From subversion at boxbackup.org Sun Feb 28 16:31:27 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sun, 28 Feb 2010 16:31:27 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2647 - box/trunk/bin/bbstored Message-ID: <20100228163127.C2B4732503B@www.boxbackup.org> Author: chris Date: 2010-02-28 16:31:27 +0000 (Sun, 28 Feb 2010) New Revision: 2647 Modified: box/trunk/bin/bbstored/HousekeepStoreAccount.cpp Log: Build the reference counts for a directory before we start deleting files, to ensure that it's initialized and memory allocated for it. Modified: box/trunk/bin/bbstored/HousekeepStoreAccount.cpp =================================================================== --- box/trunk/bin/bbstored/HousekeepStoreAccount.cpp 2010-02-28 16:28:38 UTC (rev 2646) +++ box/trunk/bin/bbstored/HousekeepStoreAccount.cpp 2010-02-28 16:31:27 UTC (rev 2647) @@ -420,9 +420,27 @@ // Add it to the list of directories to potentially delete mEmptyDirectories.push_back(dir.GetObjectID()); } - + + // Calculate reference counts first, before we start requesting + // files to be deleted. // BLOCK { + BackupStoreDirectory::Iterator i(dir); + BackupStoreDirectory::Entry *en = 0; + + while((en = i.Next()) != 0) + { + // This directory references this object + if (mNewRefCounts.size() <= en->GetObjectID()) + { + mNewRefCounts.resize(en->GetObjectID() + 1, 0); + } + mNewRefCounts[en->GetObjectID()]++; + } + } + + // BLOCK + { // Remove any files which are marked for removal as soon // as they become old or deleted. bool deletedSomething = false; @@ -467,13 +485,6 @@ while((en = i.Next(BackupStoreDirectory::Entry::Flags_File)) != 0) { - // This directory references this object - if (mNewRefCounts.size() <= en->GetObjectID()) - { - mNewRefCounts.resize(en->GetObjectID() + 1, 0); - } - mNewRefCounts[en->GetObjectID()]++; - // Update recalculated usage sizes int16_t enFlags = en->GetFlags(); int64_t enSizeInBlocks = en->GetSizeInBlocks(); @@ -582,13 +593,6 @@ BackupStoreDirectory::Entry *en = 0; while((en = i.Next(BackupStoreDirectory::Entry::Flags_Dir)) != 0) { - // This parent directory references this child - if (mNewRefCounts.size() <= en->GetObjectID()) - { - mNewRefCounts.resize(en->GetObjectID() + 1, 0); - } - mNewRefCounts[en->GetObjectID()]++; - // Next level ASSERT((en->GetFlags() & BackupStoreDirectory::Entry::Flags_Dir) == BackupStoreDirectory::Entry::Flags_Dir); From subversion at boxbackup.org Sun Feb 28 19:51:28 2010 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sun, 28 Feb 2010 19:51:28 +0000 (GMT) Subject: [Box Backup-commit] COMMIT r2648 - box/trunk/lib/common Message-ID: <20100228195128.4F8FC32503B@www.boxbackup.org> Author: chris Date: 2010-02-28 19:51:26 +0000 (Sun, 28 Feb 2010) New Revision: 2648 Modified: box/trunk/lib/common/Test.cpp Log: Workaround for problem with nanosleep() return values on OSX causing test to hang. Modified: box/trunk/lib/common/Test.cpp =================================================================== --- box/trunk/lib/common/Test.cpp 2010-02-28 16:31:27 UTC (rev 2647) +++ box/trunk/lib/common/Test.cpp 2010-02-28 19:51:26 UTC (rev 2648) @@ -462,10 +462,24 @@ ts.tv_nsec = 0; while (nanosleep(&ts, &ts) == -1 && errno == EINTR) { - BOX_TRACE("safe_sleep interrupted with " << - ts.tv_sec << "." << ts.tv_nsec << - " secs remaining, sleeping again"); - /* sleep again */ + // FIME evil hack for OSX, where ts.tv_sec contains + // a negative number interpreted as unsigned 32-bit + // when nanosleep() returns later than expected. + + int32_t secs = (int32_t) ts.tv_sec; + int64_t remain_ns = (secs * 1000000000) + ts.tv_nsec; + + if (remain_ns < 0) + { + BOX_WARNING("nanosleep interrupted " << + ((float)(0 - remain_ns) / 1000000000) << + " secs late"); + return; + } + + BOX_TRACE("nanosleep interrupted with " << + (remain_ns / 1000000000) << " secs remaining, " + "sleeping again"); } #endif }