From subversion at boxbackup.org Mon May 4 19:56:30 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 4 May 2015 18:56:30 GMT Subject: [Box Backup-commit] COMMIT r3555 - in box/trunk: infrastructure test/backupstore test/bbackupd Message-ID: <201505041856.t44IuUUF000231@web1.boxbackup.org> Author: chris Date: 2015-05-04 18:56:29 +0000 (Mon, 04 May 2015) New Revision: 3555 Modified: box/trunk/infrastructure/makebuildenv.pl.in box/trunk/test/backupstore/testbackupstore.cpp box/trunk/test/bbackupd/testbbackupd.cpp Log: Fix system exit codes from tests, so we can use them in the shell. I needed reliable exit codes to run the tests in a loop to catch an intermittent failure. Modified: box/trunk/infrastructure/makebuildenv.pl.in =================================================================== --- box/trunk/infrastructure/makebuildenv.pl.in 2015-04-15 22:03:00 UTC (rev 3554) +++ box/trunk/infrastructure/makebuildenv.pl.in 2015-05-04 18:56:29 UTC (rev 3555) @@ -465,7 +465,7 @@ close FL; } - print TESTFILE "$runcmd\n"; + print TESTFILE "$runcmd\nexit_status=\$?\n"; if (-d "$module/testfiles") { @@ -474,6 +474,7 @@ __E } + print TESTFILE "exit \$exit_status\n"; close TESTFILE; } Modified: box/trunk/test/backupstore/testbackupstore.cpp =================================================================== --- box/trunk/test/backupstore/testbackupstore.cpp 2015-04-15 22:03:00 UTC (rev 3554) +++ box/trunk/test/backupstore/testbackupstore.cpp 2015-05-04 18:56:29 UTC (rev 3555) @@ -239,8 +239,12 @@ TEST_THAT(DIR_NUM == SkipEntries(e, FlagsMustBeSet, FlagsNotToBeSet)); } +int num_tests_selected = 0; + //! Simplifies calling setUp() with the current function name in each test. -#define SETUP() if (!setUp(__FUNCTION__)) return true; // skip this test +#define SETUP() \ + if (!setUp(__FUNCTION__)) return true; \ + num_tests_selected++; //! Checks account for errors and shuts down daemons at end of every test. bool teardown_test_backupstore() @@ -3111,6 +3115,9 @@ TEST_THAT(test_multiple_uploads()); TEST_THAT(test_housekeeping_deletes_files()); - return (failures == 0); + TEST_LINE(num_tests_selected > 0, "No tests matched the patterns " + "specified on the command line"); + + return (failures == 0 && num_tests_selected > 0) ? 0 : 1; } Modified: box/trunk/test/bbackupd/testbbackupd.cpp =================================================================== --- box/trunk/test/bbackupd/testbbackupd.cpp 2015-04-15 22:03:00 UTC (rev 3554) +++ box/trunk/test/bbackupd/testbbackupd.cpp 2015-05-04 18:56:29 UTC (rev 3555) @@ -4295,5 +4295,5 @@ "specified on the command line"); TEST_THAT(kill_running_daemons()); - return (failures == 0 && num_tests_selected > 0); + return (failures == 0 && num_tests_selected > 0) ? 0 : 1; } From subversion at boxbackup.org Mon May 4 19:56:35 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 4 May 2015 18:56:35 GMT Subject: [Box Backup-commit] COMMIT r3556 - box/trunk/lib/backupstore Message-ID: <201505041856.t44IuZop000255@web1.boxbackup.org> Author: chris Date: 2015-05-04 18:56:34 +0000 (Mon, 04 May 2015) New Revision: 3556 Modified: box/trunk/lib/backupstore/BackupStoreAccounts.cpp Log: Fix tests failing because they can't delete the lock file. Deleting the account deletes the lockfile, so unlocking fails. Modified: box/trunk/lib/backupstore/BackupStoreAccounts.cpp =================================================================== --- box/trunk/lib/backupstore/BackupStoreAccounts.cpp 2015-05-04 18:56:29 UTC (rev 3555) +++ box/trunk/lib/backupstore/BackupStoreAccounts.cpp 2015-05-04 18:56:34 UTC (rev 3556) @@ -519,10 +519,10 @@ } } -#ifdef WIN32 - // Cannot remove files while holding a lock on them + // NamedLock will throw an exception if it can't delete the lockfile, + // which it can't if it doesn't exist. Now that we've deleted the account, + // nobody can open it anyway, so it's safe to unlock. writeLock.ReleaseLock(); -#endif int retcode = 0; From subversion at boxbackup.org Mon May 4 19:56:39 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 4 May 2015 18:56:39 GMT Subject: [Box Backup-commit] COMMIT r3557 - box/trunk/lib/backupstore Message-ID: <201505041856.t44IudX1000273@web1.boxbackup.org> Author: chris Date: 2015-05-04 18:56:39 +0000 (Mon, 04 May 2015) New Revision: 3557 Modified: box/trunk/lib/backupstore/StoreTestUtils.cpp Log: Fix minor test problem caused by not deleting a file between tests. Modified: box/trunk/lib/backupstore/StoreTestUtils.cpp =================================================================== --- box/trunk/lib/backupstore/StoreTestUtils.cpp 2015-05-04 18:56:34 UTC (rev 3556) +++ box/trunk/lib/backupstore/StoreTestUtils.cpp 2015-05-04 18:56:39 UTC (rev 3557) @@ -112,7 +112,9 @@ "testfiles/notifyscript.tag* " "testfiles/restore* testfiles/bbackupd-data " "testfiles/syncallowscript.control " - "testfiles/syncallowscript.notifyran.*") == 0); + "testfiles/syncallowscript.notifyran.* " + "testfiles/test2.downloaded" + ) == 0); TEST_THAT_THROWONFAIL(mkdir("testfiles/0_0", 0755) == 0); TEST_THAT_THROWONFAIL(mkdir("testfiles/0_1", 0755) == 0); TEST_THAT_THROWONFAIL(mkdir("testfiles/0_2", 0755) == 0); From subversion at boxbackup.org Mon May 4 19:56:44 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 4 May 2015 18:56:44 GMT Subject: [Box Backup-commit] COMMIT r3558 - box/trunk/lib/common Message-ID: <201505041856.t44Iuirs000300@web1.boxbackup.org> Author: chris Date: 2015-05-04 18:56:43 +0000 (Mon, 04 May 2015) New Revision: 3558 Modified: box/trunk/lib/common/Logging.cpp box/trunk/lib/common/Logging.h Log: Add command-line option to limit log messages to certain file(s). E.g. you can run with -L NamedLock.cpp to only show messages logged in that file. You can also repeat it to only show messages from certain files. Modified: box/trunk/lib/common/Logging.cpp =================================================================== --- box/trunk/lib/common/Logging.cpp 2015-05-04 18:56:39 UTC (rev 3557) +++ box/trunk/lib/common/Logging.cpp 2015-05-04 18:56:43 UTC (rev 3558) @@ -45,6 +45,7 @@ Logging Logging::sGlobalLogging; // automatic initialisation std::string Logging::sProgramName; const Log::Category Logging::UNCATEGORISED("Uncategorised"); +std::auto_ptr Logging::sapHideFileGuard; HideSpecificExceptionGuard::SuppressedExceptions_t HideSpecificExceptionGuard::sSuppressedExceptions; @@ -566,7 +567,7 @@ // -------------------------------------------------------------------------- std::string Logging::OptionParser::GetOptionString() { - return "NPqQt:TUvVW:"; + return "L:NPqQt:TUvVW:"; } // -------------------------------------------------------------------------- @@ -584,6 +585,20 @@ { switch(option) { + case 'L': + { + if(sapHideFileGuard.get()) + { + sapHideFileGuard->Add(optarg); + } + else + { + sapHideFileGuard.reset(new HideFileGuard( + optarg, true)); // HideAllButSelected + } + } + break; + case 'N': { mTruncateLogFile = true; @@ -698,7 +713,8 @@ // -------------------------------------------------------------------------- std::string Logging::OptionParser::GetUsageString() { - return + return + " -L Filter out log messages except from specified file, can repeat\n" " -N Truncate log file at startup and on backup start\n" " -P Show process ID (PID) in console output\n" " -q Run more quietly, reduce verbosity level by one, can repeat\n" @@ -715,11 +731,35 @@ const std::string& function, const Log::Category& category, const std::string& message) { + std::list::iterator i = std::find(mCategories.begin(), + mCategories.end(), category); // Return false if category is in our list, to suppress further // logging (thus, return true if it's not in our list, i.e. we - // found nothing). - std::list::iterator i = std::find(mCategories.begin(), - mCategories.end(), category); - return i == mCategories.end(); + // found nothing, to allow it). + return (i == mCategories.end()); } +bool HideFileGuard::Log(Log::Level level, const std::string& file, int line, + const std::string& function, const Log::Category& category, + const std::string& message) +{ + std::list::iterator i = std::find(mFileNames.begin(), + mFileNames.end(), file); + bool allow_log_message; + if(mHideAllButSelected) + { + // Return true if filename is in our list, to allow further + // logging (thus, return false if it's not in our list, i.e. we + // found nothing, to suppress it). + allow_log_message = (i != mFileNames.end()); + } + else + { + // Return false if filename is in our list, to suppress further + // logging (thus, return true if it's not in our list, i.e. we + // found nothing, to allow it). + allow_log_message = (i == mFileNames.end()); + } + return allow_log_message; +} + Modified: box/trunk/lib/common/Logging.h =================================================================== --- box/trunk/lib/common/Logging.h 2015-05-04 18:56:39 UTC (rev 3557) +++ box/trunk/lib/common/Logging.h 2015-05-04 18:56:43 UTC (rev 3558) @@ -385,6 +385,9 @@ } }; +// Forward declaration +class HideFileGuard; + // -------------------------------------------------------------------------- // // Class @@ -406,7 +409,8 @@ static Syslog* spSyslog; static Logging sGlobalLogging; static std::string sProgramName; - + static std::auto_ptr sapHideFileGuard; + public: Logging (); ~Logging(); @@ -501,11 +505,16 @@ } }; + // Process global options + static std::string GetOptionString(); + static int ProcessOption(signed int option); + static std::string GetUsageString(); + // -------------------------------------------------------------------------- // // Class // Name: Logging::OptionParser - // Purpose: Process command-line options + // Purpose: Process command-line options, some global, some local // Created: 2014/04/09 // // -------------------------------------------------------------------------- @@ -629,6 +638,36 @@ virtual void SetProgramName(const std::string& rProgramName) { } }; +class HideFileGuard : public Logger +{ + private: + std::list mFileNames; + HideFileGuard(const HideFileGuard& other); // no copying + HideFileGuard& operator=(const HideFileGuard& other); // no assignment + bool mHideAllButSelected; + + public: + HideFileGuard(const std::string& rFileName, bool HideAllButSelected = false) + : mHideAllButSelected(HideAllButSelected) + { + mFileNames.push_back(rFileName); + Logging::Add(this); + } + ~HideFileGuard() + { + Logging::Remove(this); + } + void Add(const std::string& rFileName) + { + mFileNames.push_back(rFileName); + } + virtual bool Log(Log::Level level, const std::string& file, int line, + const std::string& function, const Log::Category& category, + const std::string& message); + virtual const char* GetType() { return "HideFileGuard"; } + virtual void SetProgramName(const std::string& rProgramName) { } +}; + std::string PrintEscapedBinaryData(const std::string& rInput); #endif // LOGGING__H From subversion at boxbackup.org Mon May 4 19:56:48 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 4 May 2015 18:56:48 GMT Subject: [Box Backup-commit] COMMIT r3559 - box/trunk/lib/common Message-ID: <201505041856.t44IumLk000320@web1.boxbackup.org> Author: chris Date: 2015-05-04 18:56:48 +0000 (Mon, 04 May 2015) New Revision: 3559 Modified: box/trunk/lib/common/NamedLock.cpp Log: Add extra logging for acquiring and releasing NamedLocks. Modified: box/trunk/lib/common/NamedLock.cpp =================================================================== --- box/trunk/lib/common/NamedLock.cpp 2015-05-04 18:56:43 UTC (rev 3558) +++ box/trunk/lib/common/NamedLock.cpp 2015-05-04 18:56:48 UTC (rev 3559) @@ -77,6 +77,7 @@ // See if the lock can be got #if HAVE_DECL_O_EXLOCK + BOX_TRACE("Trying to create lockfile " << rFilename << " using O_EXLOCK"); int fd = ::open(rFilename.c_str(), O_WRONLY | O_NONBLOCK | O_CREAT | O_TRUNC | O_EXLOCK, mode); if(fd != -1) @@ -102,6 +103,9 @@ // We have no other way to get a lock, so all we can do is fail if // the file already exists, and take the risk of stale locks. flags |= O_EXCL; + BOX_TRACE("Trying to create lockfile " << rFilename << " using O_EXCL"); +# else + BOX_TRACE("Trying to create lockfile " << rFilename << " without special flags"); # endif int fd = ::open(rFilename.c_str(), flags, mode); @@ -111,6 +115,8 @@ { // Lockfile already exists, and we tried to open it // exclusively, which means we failed to lock it. + BOX_NOTICE("Failed to lock lockfile with O_EXCL: " << rFilename + << ": already locked by another process?"); return false; } else @@ -120,12 +126,17 @@ } } + try + { #ifdef HAVE_FLOCK + BOX_TRACE("Trying to lock lockfile " << rFilename << " using flock()"); if(::flock(fd, LOCK_EX | LOCK_NB) != 0) { - ::close(fd); if(errno == EWOULDBLOCK) { + ::close(fd); + BOX_NOTICE("Failed to lock lockfile with flock(): " << rFilename + << ": already locked by another process"); return false; } else @@ -140,11 +151,14 @@ desc.l_whence = SEEK_SET; desc.l_start = 0; desc.l_len = 0; + BOX_TRACE("Trying to lock lockfile " << rFilename << " using fcntl()"); if(::fcntl(fd, F_SETLK, &desc) != 0) { - ::close(fd); if(errno == EAGAIN) { + ::close(fd); + BOX_NOTICE("Failed to lock lockfile with fcntl(): " << rFilename + << ": already locked by another process"); return false; } else @@ -154,9 +168,25 @@ } } #endif + } + catch(BoxException &e) + { + ::close(fd); + BOX_NOTICE("Failed to lock lockfile " << rFilename << ": " << e.what()); + throw; + } + if(!FileExists(rFilename)) + { + BOX_ERROR("Locked lockfile " << rFilename << ", but lockfile no longer " + "exists, bailing out"); + ::close(fd); + return false; + } + // Success mFileDescriptor = fd; + BOX_TRACE("Successfully locked lockfile " << rFilename); return true; #endif @@ -195,10 +225,12 @@ CommonException, OSFileError); } - // Mark as unlocked + // Mark as unlocked, so we don't try to close it again if the unlink() fails. mFileDescriptor = -1; } + BOX_TRACE("Released lock and deleted lockfile " << mFileName); +} From subversion at boxbackup.org Mon May 4 19:56:53 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Mon, 4 May 2015 18:56:53 GMT Subject: [Box Backup-commit] COMMIT r3560 - box/trunk/lib/common Message-ID: <201505041856.t44IurdD000342@web1.boxbackup.org> Author: chris Date: 2015-05-04 18:56:53 +0000 (Mon, 04 May 2015) New Revision: 3560 Modified: box/trunk/lib/common/NamedLock.cpp Log: Fix lock race condition by unlinking before closing the file handle. Modified: box/trunk/lib/common/NamedLock.cpp =================================================================== --- box/trunk/lib/common/NamedLock.cpp 2015-05-04 18:56:48 UTC (rev 3559) +++ box/trunk/lib/common/NamedLock.cpp 2015-05-04 18:56:53 UTC (rev 3560) @@ -207,30 +207,30 @@ { THROW_EXCEPTION(CommonException, NamedLockNotHeld) } - - // Close the file - if(::close(mFileDescriptor) != 0) + + // Delete the file. We need to do this before closing the filehandle, otherwise + // someone could acquire the lock, release and delete it between us closing (and + // hence releasing) and deleting it, and we'd fail when it came to deleting the + // file. This happens in tests much more often than you'd expect! + + if(::unlink(mFileName.c_str()) != 0) { THROW_EMU_ERROR( - BOX_FILE_MESSAGE(mFileName, "Failed to close lockfile"), + BOX_FILE_MESSAGE(mFileName, "Failed to delete lockfile"), CommonException, OSFileError); } - // Delete the file - if(::unlink(mFileName.c_str()) != 0) + // Close the file + if(::close(mFileDescriptor) != 0) { THROW_EMU_ERROR( - BOX_FILE_MESSAGE(mFileName, - "Failed to delete lockfile"), + BOX_FILE_MESSAGE(mFileName, "Failed to close lockfile"), CommonException, OSFileError); } // Mark as unlocked, so we don't try to close it again if the unlink() fails. mFileDescriptor = -1; -} - - BOX_TRACE("Released lock and deleted lockfile " << mFileName); } From subversion at boxbackup.org Wed May 6 22:29:40 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Wed, 6 May 2015 21:29:40 GMT Subject: [Box Backup-commit] COMMIT r3561 - in box/trunk: lib/backupstore test/backupstorefix Message-ID: <201505062129.t46LTeNA026267@web1.boxbackup.org> Author: chris Date: 2015-05-06 21:29:39 +0000 (Wed, 06 May 2015) New Revision: 3561 Modified: box/trunk/lib/backupstore/BackupStoreAccounts.cpp box/trunk/lib/backupstore/BackupStoreAccounts.h box/trunk/lib/backupstore/StoreTestUtils.cpp box/trunk/test/backupstorefix/testbackupstorefix.cpp Log: Fix missing account lock while checking for errors. The old assertion, that the write lock file exists before starting checking, was erroneously passing before when no lock was held, because the lockfile was never deleted. Now that we delete it when unlocking the account, this started causing test failures. Changed the way that accounts are checked for errors to use a function that acquires a write lock first, and modified test to disconnect open clients before starting checking the account, to fix it. Modified: box/trunk/lib/backupstore/BackupStoreAccounts.cpp =================================================================== --- box/trunk/lib/backupstore/BackupStoreAccounts.cpp 2015-05-04 18:56:53 UTC (rev 3560) +++ box/trunk/lib/backupstore/BackupStoreAccounts.cpp 2015-05-06 21:29:39 UTC (rev 3561) @@ -594,7 +594,8 @@ return true; } -int BackupStoreAccountsControl::CheckAccount(int32_t ID, bool FixErrors, bool Quiet) +int BackupStoreAccountsControl::CheckAccount(int32_t ID, bool FixErrors, bool Quiet, + bool ReturnNumErrorsFound) { std::string rootDir; int discSetNum; @@ -612,8 +613,15 @@ // Check it BackupStoreCheck check(rootDir, discSetNum, ID, FixErrors, Quiet); check.Check(); - - return check.ErrorsFound()?1:0; + + if(ReturnNumErrorsFound) + { + return check.GetNumErrorsFound(); + } + else + { + return check.ErrorsFound() ? 1 : 0; + } } int BackupStoreAccountsControl::CreateAccount(int32_t ID, int32_t DiscNumber, Modified: box/trunk/lib/backupstore/BackupStoreAccounts.h =================================================================== --- box/trunk/lib/backupstore/BackupStoreAccounts.h 2015-05-04 18:56:53 UTC (rev 3560) +++ box/trunk/lib/backupstore/BackupStoreAccounts.h 2015-05-06 21:29:39 UTC (rev 3561) @@ -76,7 +76,8 @@ int PrintAccountInfo(int32_t ID); int SetAccountEnabled(int32_t ID, bool enabled); int DeleteAccount(int32_t ID, bool AskForConfirmation); - int CheckAccount(int32_t ID, bool FixErrors, bool Quiet); + int CheckAccount(int32_t ID, bool FixErrors, bool Quiet, + bool ReturnNumErrorsFound = false); int CreateAccount(int32_t ID, int32_t DiscNumber, int32_t SoftLimit, int32_t HardLimit); int HousekeepAccountNow(int32_t ID); Modified: box/trunk/lib/backupstore/StoreTestUtils.cpp =================================================================== --- box/trunk/lib/backupstore/StoreTestUtils.cpp 2015-05-04 18:56:53 UTC (rev 3560) +++ box/trunk/lib/backupstore/StoreTestUtils.cpp 2015-05-06 21:29:39 UTC (rev 3561) @@ -276,7 +276,8 @@ BackupStoreAccountsControl control(*config); int errors_fixed = control.CheckAccount(0x01234567, true, // FixErrors - false); // Quiet + false, // Quiet + true); // ReturnNumErrorsFound return errors_fixed; } Modified: box/trunk/test/backupstorefix/testbackupstorefix.cpp =================================================================== --- box/trunk/test/backupstorefix/testbackupstorefix.cpp 2015-05-04 18:56:53 UTC (rev 3560) +++ box/trunk/test/backupstorefix/testbackupstorefix.cpp 2015-05-06 21:29:39 UTC (rev 3561) @@ -77,26 +77,6 @@ ::system(BBSTOREACCOUNTS " -c testfiles/bbstored.conf check 01234567"); \ ::system(BBSTOREACCOUNTS " -c testfiles/bbstored.conf check 01234567 fix"); -bool check_fix_internal(int expected_num_errors) -{ - BackupStoreCheck checker(accountRootDir, discSetNum, - 0x01234567, true /* FixErrors */, false /* Quiet */); - checker.Check(); - if (expected_num_errors == -1) - { - TEST_THAT(checker.ErrorsFound()); - return checker.ErrorsFound(); - } - else - { - TEST_EQUAL(expected_num_errors, checker.GetNumErrorsFound()); - return checker.GetNumErrorsFound() == expected_num_errors; - } -} - -#define RUN_CHECK_INTERNAL(expected_num_errors) \ - TEST_THAT(check_fix_internal(expected_num_errors)) - // Get ID of an object given a filename int32_t getID(const char *name) { @@ -435,7 +415,7 @@ { // Check the store, check that the error is detected and // repaired, by removing x1 from the directory. - RUN_CHECK_INTERNAL(0); + TEST_EQUAL(0, check_account_for_errors()); // Read the directory back in, check that it's empty BackupStoreDirectory dir; @@ -450,7 +430,7 @@ { // Check the store, check that the error is detected and // repaired. - RUN_CHECK_INTERNAL(-1); + TEST_THAT(check_account_for_errors() > 0); check_root_dir_ok(after_entries, after_deps); } @@ -491,6 +471,7 @@ std::string file_path = "testfiles/TestDir1/cannes/ict/metegoguered/oats"; int x1id = fake_upload(client, file_path, 0); + client.QueryFinished(); // Now break the reverse dependency by deleting x1 (the file, // not the directory entry) @@ -523,6 +504,7 @@ fs.Close(); int x1aid = fake_upload(client, file_path, x1id); + client.QueryFinished(); // Check that we've ended up with the right preconditions // for the tests below. @@ -590,16 +572,11 @@ read_bb_dir(1 /* root */, dir); TEST_THAT(dir.FindEntryByID(0x1234567890123456LL) != 0); - // Check it - BackupStoreCheck checker(accountRootDir, discSetNum, - 0x01234567, true /* FixErrors */, false /* Quiet */); - checker.Check(); - // Should just be greater than 1 really, we don't know quite // how good the checker is (or will become) at spotting errors! // But this will help us catch changes in checker behaviour, // so it's not a bad thing to test. - TEST_EQUAL(2, checker.GetNumErrorsFound()); + TEST_EQUAL(2, check_account_for_errors()); file = RaidFileRead::Open(discSetNum, fn); dir.ReadFromStream(*file, IOStream::TimeOutInfinite); @@ -754,7 +731,7 @@ // ERROR: BlocksInCurrentFiles changed from 228 to 226 // ERROR: NumCurrentFiles changed from 114 to 113 // WARNING: Reference count of object 0x44 changed from 1 to 0 - RUN_CHECK_INTERNAL(5); + TEST_EQUAL(5, check_account_for_errors()); { std::auto_ptr usage = BackupProtocolLocal2(0x01234567, "test", @@ -862,7 +839,7 @@ // ERROR: NumFiles changed from 113 to 110 // WARNING: Reference count of object 0x3e changed from 1 to 0 - RUN_CHECK_INTERNAL(12); + TEST_EQUAL(12, check_account_for_errors()); { std::auto_ptr usage = From subversion at boxbackup.org Sat May 16 10:17:18 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sat, 16 May 2015 09:17:18 GMT Subject: [Box Backup-commit] COMMIT r3565 - in box/trunk: lib/backupstore test/backupstore Message-ID: <201505160917.t4G9HI42079627@web1.boxbackup.org> Author: chris Date: 2015-05-16 09:17:18 +0000 (Sat, 16 May 2015) New Revision: 3565 Modified: box/trunk/lib/backupstore/HousekeepStoreAccount.cpp box/trunk/test/backupstore/testbackupstore.cpp Log: Fix test failures on Windows caused by keeping files open too long. Once again, the Windows issue of being unable to delete or overwrite an open file causes issues. In this case it's only test failures. We need to be diligent about closing open file handles and protocol sessions in tests. Modified: box/trunk/lib/backupstore/HousekeepStoreAccount.cpp =================================================================== --- box/trunk/lib/backupstore/HousekeepStoreAccount.cpp 2015-05-16 09:17:14 UTC (rev 3564) +++ box/trunk/lib/backupstore/HousekeepStoreAccount.cpp 2015-05-16 09:17:18 UTC (rev 3565) @@ -716,7 +716,7 @@ // Check this should be deleted if(!wasDeleted && !wasOldVersion) { - // Things changed size we were last around + // Things changed since we were last around return refs; } @@ -952,6 +952,8 @@ std::auto_ptr parentStream( RaidFileRead::Open(mStoreDiscSet, parentFilename)); BackupStoreDirectory parent(*parentStream); + parentStream.reset(); + BackupStoreDirectory::Entry* en = parent.FindEntryByID(rDirectory.GetObjectID()); ASSERT(en); Modified: box/trunk/test/backupstore/testbackupstore.cpp =================================================================== --- box/trunk/test/backupstore/testbackupstore.cpp 2015-05-16 09:17:14 UTC (rev 3564) +++ box/trunk/test/backupstore/testbackupstore.cpp 2015-05-16 09:17:18 UTC (rev 3565) @@ -808,7 +808,7 @@ std::auto_ptr perm( BackupStoreRefCountDatabase::Load( apAccounts->GetEntry(0x1234567), - false // readonly + true // ReadOnly )); TEST_CHECK_THROWS(temp->GetRefCount(2), @@ -1245,16 +1245,9 @@ std::auto_ptr apProtocol = connect_and_login(context); -#ifndef WIN32 - // Open a new connection which is read only // TODO FIXME replace protocolReadOnly with apProtocolReadOnly. - std::auto_ptr apProtocolReadOnly = - connect_and_login(context, - BackupProtocolLogin::Flags_ReadOnly); - BackupProtocolCallable& protocolReadOnly(*apProtocolReadOnly); -#else // WIN32 - BackupProtocolCallable& protocolReadOnly(*apProtocol); -#endif + BackupProtocolLocal2 protocolReadOnly(0x01234567, "test", + "backup/01234567/", 0, true); // ReadOnly // Read the root directory a few times (as it's cached, so make sure it doesn't hurt anything) for(int l = 0; l < 3; ++l) @@ -1329,8 +1322,10 @@ expected_num_old_files, 0, 1)); apProtocol->QueryFinished(); + protocolReadOnly.QueryFinished(); TEST_THAT(run_housekeeping_and_check_account()); apProtocol = connect_and_login(context); + protocolReadOnly.Reopen(); TEST_THAT(check_num_files(expected_num_current_files, expected_num_old_files, 0, 1)); @@ -1351,8 +1346,10 @@ } apProtocol->QueryFinished(); + protocolReadOnly.QueryFinished(); TEST_THAT(run_housekeeping_and_check_account()); apProtocol = connect_and_login(context); + protocolReadOnly.Reopen(); // Delete one of them (will implicitly delete an old version) { @@ -1364,8 +1361,10 @@ } apProtocol->QueryFinished(); + protocolReadOnly.QueryFinished(); TEST_THAT(run_housekeeping_and_check_account()); apProtocol = connect_and_login(context); + protocolReadOnly.Reopen(); // Check that the block index can be obtained by name even though it's been deleted { @@ -1430,7 +1429,10 @@ // Run housekeeping (for which we need to disconnect // ourselves) and check that it doesn't change the numbers // of files + apProtocol->QueryFinished(); + protocolReadOnly.QueryFinished(); + std::auto_ptr apAccounts( BackupStoreAccountDatabase::Read("testfiles/accounts.txt")); BackupStoreAccountDatabase::Entry account = @@ -1445,6 +1447,7 @@ TestRemoteProcessMemLeaks("bbstoreaccounts.memleaks"); apProtocol = connect_and_login(context); + protocolReadOnly.Reopen(); TEST_THAT(check_num_files(UPLOAD_NUM - 4, 3, 2, 1)); @@ -1506,10 +1509,8 @@ } } -#ifndef WIN32 - apProtocolReadOnly->QueryFinished(); -#endif apProtocol->QueryFinished(); + protocolReadOnly.QueryFinished(); return teardown_test_backupstore(); } @@ -1673,7 +1674,6 @@ // Upload a new version of the file as well, to ensure that the // old version is moved along with the current version. - int64_t old_root_file_id = root_file_id; root_file_id = BackupStoreFile::QueryStoreFileDiff(*apProtocol, "testfiles/test0", BACKUPSTORE_ROOT_DIRECTORY_ID, 0, // DiffFromFileID @@ -1827,8 +1827,10 @@ TEST_THAT(check_num_files(3, 1, 0, 3)); apProtocol->QueryFinished(); + protocolReadOnly.QueryFinished(); TEST_THAT(run_housekeeping_and_check_account()); apProtocol->Reopen(); + protocolReadOnly.Reopen(); // Query names -- test that invalid stuff returns not found OK { @@ -1884,27 +1886,35 @@ //} skip: - std::auto_ptr apAccounts( - BackupStoreAccountDatabase::Read("testfiles/accounts.txt")); - std::auto_ptr apRefCount( - BackupStoreRefCountDatabase::Load( - apAccounts->GetEntry(0x1234567), true)); - // Create some nice recursive directories TEST_THAT(check_reference_counts()); write_test_file(1); - int64_t dirtodelete = create_test_data_subdirs(*apProtocol, - BACKUPSTORE_ROOT_DIRECTORY_ID, - "test_delete", 6 /* depth */, apRefCount.get()); + int64_t dirtodelete; + + { + std::auto_ptr apAccounts( + BackupStoreAccountDatabase::Read("testfiles/accounts.txt")); + std::auto_ptr apRefCount( + BackupStoreRefCountDatabase::Load( + apAccounts->GetEntry(0x1234567), true)); + + + dirtodelete = create_test_data_subdirs(*apProtocol, + BACKUPSTORE_ROOT_DIRECTORY_ID, + "test_delete", 6 /* depth */, apRefCount.get()); + } + TEST_THAT(check_reference_counts()); apProtocol->QueryFinished(); + protocolReadOnly.QueryFinished(); TEST_THAT(run_housekeeping_and_check_account()); TEST_THAT(check_reference_counts()); // And delete them apProtocol->Reopen(); + protocolReadOnly.Reopen(); { std::auto_ptr dirdel(apProtocol->QueryDeleteDirectory( @@ -1913,8 +1923,10 @@ } apProtocol->QueryFinished(); + protocolReadOnly.QueryFinished(); TEST_THAT(run_housekeeping_and_check_account()); TEST_THAT(check_reference_counts()); + protocolReadOnly.Reopen(); // Get the root dir, checking for deleted items { @@ -1953,6 +1965,7 @@ // Finish the connections apProtocol->QueryFinished(); + protocolReadOnly.QueryFinished(); TEST_THAT(run_housekeeping_and_check_account()); TEST_THAT(check_reference_counts()); @@ -2059,8 +2072,8 @@ protocolReadOnly.Reopen(); // Now modify the root directory to remove its entry for this one - std::auto_ptr root_read(get_raid_file(BACKUPSTORE_ROOT_DIRECTORY_ID)); - BackupStoreDirectory root(static_cast >(root_read)); + BackupStoreDirectory root(*get_raid_file(BACKUPSTORE_ROOT_DIRECTORY_ID), + IOStream::TimeOutInfinite); BackupStoreDirectory::Entry *en = root.FindEntryByID(subdirid); TEST_THAT_OR(en, return false); BackupStoreDirectory::Entry enCopy(*en); @@ -2083,8 +2096,8 @@ // create_directory(), because otherwise we can't create it again. // (Perhaps it should not have been committed because we failed to // update the parent, but currently it is.) - std::auto_ptr subdir_read(get_raid_file(subdirid)); - BackupStoreDirectory subdir(static_cast >(subdir_read)); + BackupStoreDirectory subdir(*get_raid_file(subdirid), + IOStream::TimeOutInfinite); { BackupStoreDirectory::Iterator i(subdir); en = i.FindMatchingClearName( @@ -2124,8 +2137,8 @@ protocol.QueryFinished(); - root_read = get_raid_file(BACKUPSTORE_ROOT_DIRECTORY_ID); - root.ReadFromStream(*root_read, IOStream::TimeOutInfinite); + root.ReadFromStream(*get_raid_file(BACKUPSTORE_ROOT_DIRECTORY_ID), + IOStream::TimeOutInfinite); en = root.FindEntryByID(subdirid); TEST_THAT_OR(en != 0, return false); en->SetSizeInBlocks(1234); @@ -2142,10 +2155,12 @@ // the read-only connection will discard its cached copy. safe_sleep(1); + protocolReadOnly.QueryFinished(); TEST_EQUAL(1, check_account_for_errors()); + + protocolReadOnly.Reopen(); TEST_EQUAL(old_size, get_object_size(protocolReadOnly, subdirid, BACKUPSTORE_ROOT_DIRECTORY_ID)); - protocolReadOnly.QueryFinished(); return teardown_test_backupstore(); From subversion at boxbackup.org Sat May 16 10:17:07 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sat, 16 May 2015 09:17:07 GMT Subject: [Box Backup-commit] COMMIT r3562 - box/trunk/lib/common Message-ID: <201505160917.t4G9H7cc079564@web1.boxbackup.org> Author: chris Date: 2015-05-16 09:17:07 +0000 (Sat, 16 May 2015) New Revision: 3562 Modified: box/trunk/lib/common/NamedLock.cpp Log: Fix NamedLock release on Windows. On Windows we can't delete the file while it's open, and we don't need to, because we opened it for exclusive use, so another process can't lock it between us unlocking and deleting it. Modified: box/trunk/lib/common/NamedLock.cpp =================================================================== --- box/trunk/lib/common/NamedLock.cpp 2015-05-06 21:29:39 UTC (rev 3561) +++ box/trunk/lib/common/NamedLock.cpp 2015-05-16 09:17:07 UTC (rev 3562) @@ -21,8 +21,9 @@ #include #endif +#include "CommonException.h" #include "NamedLock.h" -#include "CommonException.h" +#include "Utils.h" #include "MemLeakFindOn.h" @@ -208,10 +209,17 @@ THROW_EXCEPTION(CommonException, NamedLockNotHeld) } - // Delete the file. We need to do this before closing the filehandle, otherwise - // someone could acquire the lock, release and delete it between us closing (and - // hence releasing) and deleting it, and we'd fail when it came to deleting the - // file. This happens in tests much more often than you'd expect! +#ifndef WIN32 + // Delete the file. We need to do this before closing the filehandle, + // if we used flock() or fcntl() to lock it, otherwise someone could + // acquire the lock, release and delete it between us closing (and + // hence releasing) and deleting it, and we'd fail when it came to + // deleting the file. This happens in tests much more often than + // you'd expect! + // + // This doesn't apply on systems using plain lockfile locking, such as + // Windows, and there we need to close the file before deleting it, + // otherwise the system won't let us delete it. if(::unlink(mFileName.c_str()) != 0) { @@ -219,6 +227,7 @@ BOX_FILE_MESSAGE(mFileName, "Failed to delete lockfile"), CommonException, OSFileError); } +#endif // !WIN32 // Close the file if(::close(mFileDescriptor) != 0) @@ -228,6 +237,18 @@ CommonException, OSFileError); } +#ifdef WIN32 + // On Windows we need to close the file before deleting it, otherwise + // the system won't let us delete it. + + if(::unlink(mFileName.c_str()) != 0) + { + THROW_EMU_ERROR( + BOX_FILE_MESSAGE(mFileName, "Failed to delete lockfile"), + CommonException, OSFileError); + } +#endif // WIN32 + // Mark as unlocked, so we don't try to close it again if the unlink() fails. mFileDescriptor = -1; From subversion at boxbackup.org Sat May 16 10:17:11 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sat, 16 May 2015 09:17:11 GMT Subject: [Box Backup-commit] COMMIT r3563 - box/trunk/lib/raidfile Message-ID: <201505160917.t4G9HBMD079584@web1.boxbackup.org> Author: chris Date: 2015-05-16 09:17:11 +0000 (Sat, 16 May 2015) New Revision: 3563 Modified: box/trunk/lib/raidfile/RaidFileUtil.cpp Log: Use FileModificationTime instead of raw stat() on Windows. Fixes test failures caused by using seconds since epoch on Windows, instead of a box_time_t, and rounding it to the nearest 10^6, which is fine for a box_time_t (all other platforms), but 10^6 seconds is a rather long time to ignore changes for on Windows. This also makes it possible to support subsecond precision on Windows via FileModificationTime() in future, and have RaidFile detect such subsecond changes. Modified: box/trunk/lib/raidfile/RaidFileUtil.cpp =================================================================== --- box/trunk/lib/raidfile/RaidFileUtil.cpp 2015-05-16 09:17:07 UTC (rev 3562) +++ box/trunk/lib/raidfile/RaidFileUtil.cpp 2015-05-16 09:17:11 UTC (rev 3563) @@ -59,8 +59,7 @@ *pExistingFiles = 0; } - // For stat call, although the results are not examined - struct stat st; + EMU_STRUCT_STAT st; // check various files int startDisc = 0; @@ -70,7 +69,7 @@ { *pStartDisc = startDisc; } - if(::stat(writeFile.c_str(), &st) == 0) + if(EMU_STAT(writeFile.c_str(), &st) == 0) { // write file exists, use that @@ -77,12 +76,7 @@ // Get unique ID if(pRevisionID != 0) { - #ifdef WIN32 - *pRevisionID = st.st_mtime; - #else - *pRevisionID = FileModificationTime(st); - #endif - + *pRevisionID = FileModificationTime(st); *pRevisionID = adjust_timestamp(*pRevisionID, st.st_size); } @@ -102,7 +96,7 @@ for(int f = 0; f < setSize; ++f) { std::string componentFile(RaidFileUtil::MakeRaidComponentName(rDiscSet, rFilename, (f + startDisc) % setSize)); - if(::stat(componentFile.c_str(), &st) == 0) + if(EMU_STAT(componentFile.c_str(), &st) == 0) { // Component file exists, add to count rfCount++; @@ -114,12 +108,7 @@ // Revision ID if(pRevisionID != 0) { - #ifdef WIN32 - int64_t rid = st.st_mtime; - #else - int64_t rid = FileModificationTime(st); - #endif - + int64_t rid = FileModificationTime(st); if(rid > revisionID) revisionID = rid; revisionIDplus += st.st_size; } From subversion at boxbackup.org Sat May 16 10:17:14 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sat, 16 May 2015 09:17:14 GMT Subject: [Box Backup-commit] COMMIT r3564 - box/trunk/lib/raidfile Message-ID: <201505160917.t4G9HEtr079605@web1.boxbackup.org> Author: chris Date: 2015-05-16 09:17:14 +0000 (Sat, 16 May 2015) New Revision: 3564 Modified: box/trunk/lib/raidfile/RaidFileWrite.cpp Log: Improve exception message when unlink() on a raidfile stripe fails Modified: box/trunk/lib/raidfile/RaidFileWrite.cpp =================================================================== --- box/trunk/lib/raidfile/RaidFileWrite.cpp 2015-05-16 09:17:11 UTC (rev 3563) +++ box/trunk/lib/raidfile/RaidFileWrite.cpp 2015-05-16 09:17:14 UTC (rev 3564) @@ -672,7 +672,9 @@ { \ if (::unlink(file) != 0 && errno != ENOENT) \ { \ - THROW_EXCEPTION(RaidFileException, OSError); \ + THROW_EMU_ERROR("Failed to unlink raidfile " \ + "stripe: " << file, RaidFileException, \ + OSError); \ } \ } CHECK_UNLINK(stripe1Filename.c_str()); From subversion at boxbackup.org Sat May 16 10:17:22 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sat, 16 May 2015 09:17:22 GMT Subject: [Box Backup-commit] COMMIT r3566 - box/trunk/infrastructure Message-ID: <201505160917.t4G9HMET079647@web1.boxbackup.org> Author: chris Date: 2015-05-16 09:17:21 +0000 (Sat, 16 May 2015) New Revision: 3566 Modified: box/trunk/infrastructure/BoxPlatform.pm.in box/trunk/infrastructure/makebuildenv.pl.in box/trunk/infrastructure/makeparcels.pl.in Log: Allow matching parcel platforms on cpu-vendor and os-cpu-vendor. Allows us to match 32/64-bit specific targets in parcels.txt. Add support for variable substitution in parcels.txt. Modified: box/trunk/infrastructure/BoxPlatform.pm.in =================================================================== --- box/trunk/infrastructure/BoxPlatform.pm.in 2015-05-16 09:17:18 UTC (rev 3565) +++ box/trunk/infrastructure/BoxPlatform.pm.in 2015-05-16 09:17:21 UTC (rev 3566) @@ -1,15 +1,18 @@ package BoxPlatform; use Exporter; @ISA = qw/Exporter/; - at EXPORT = qw/$build_os $build_os_ver $target_os $make_command $bsd_make $platform_define $platform_cpu $gcc_v3 $product_version $product_name $install_into_dir $sub_make_options $platform_compile_line_extra $platform_link_line_extra $platform_lib_files $platform_exe_ext $target_windows/; + at EXPORT = qw/$build_os $build_os_ver $ac_target $ac_target_cpu $ac_target_vendor $ac_target_os $make_command $bsd_make $platform_define $platform_cpu $gcc_v3 $product_version $product_name $install_into_dir $sub_make_options $platform_compile_line_extra $platform_link_line_extra $platform_lib_files $platform_exe_ext $target_windows/; BEGIN { # which OS are we building under? - $target_os = '@target_os@'; + $ac_target = '@target@'; + $ac_target_cpu = '@target_cpu@'; + $ac_target_vendor = '@target_vendor@'; + $ac_target_os = '@target_os@'; $target_windows = 0; - $target_windows = 1 if $target_os =~ m'^mingw32' - or $target_os eq "winnt"; + $target_windows = 1 if $ac_target_os =~ m'^mingw32' + or $ac_target_os eq "winnt"; if ($^O eq "MSWin32" and not -x "/usr/bin/uname") { @@ -155,7 +158,7 @@ sub parcel_root { - my $tos = $_[1] || $target_os; + my $tos = $_[1] || $ac_target_os; return $product_name.'-'.$product_version.'-'.$_[0].'-'.$tos; } Modified: box/trunk/infrastructure/makebuildenv.pl.in =================================================================== --- box/trunk/infrastructure/makebuildenv.pl.in 2015-05-16 09:17:18 UTC (rev 3565) +++ box/trunk/infrastructure/makebuildenv.pl.in 2015-05-16 09:17:21 UTC (rev 3566) @@ -212,7 +212,7 @@ if(m/\AOMIT:(.+)/) { - if($1 eq $build_os or $1 eq $target_os) + if($1 eq $build_os or $1 eq $ac_target_os) { $modules_omitted = 1; $modules_omitting = 1; Modified: box/trunk/infrastructure/makeparcels.pl.in =================================================================== --- box/trunk/infrastructure/makeparcels.pl.in 2015-05-16 09:17:18 UTC (rev 3565) +++ box/trunk/infrastructure/makeparcels.pl.in 2015-05-16 09:17:21 UTC (rev 3566) @@ -20,7 +20,10 @@ foreach my $prefix (@prefixes) { return 1 if starts_with($build_os, $prefix); - return 1 if starts_with($target_os, $prefix); + return 1 if starts_with($ac_target_os, $prefix); + return 1 if starts_with("$ac_target_cpu-$ac_target_os", + $prefix); + return 1 if starts_with($ac_target, $prefix); } return 0; } @@ -133,8 +136,8 @@ for my $parcel (@parcels) { my $version = BoxPlatform::parcel_root($parcel); - my $target = BoxPlatform::parcel_target($parcel); - my $dir = BoxPlatform::parcel_dir($parcel); + my $make_target = BoxPlatform::parcel_target($parcel); + my $dir = BoxPlatform::parcel_dir($parcel); my @parcel_deps; # Need to use BSD install on Solaris @@ -186,6 +189,9 @@ } elsif ($type eq 'script') { + # Replace any variables ($ac_target etc.) with their + # values. + $name =~ s|(\$[^/ ]+)|$1|eeg; my $fullpath = $name; my $filename = $name; # remove path from script name @@ -266,9 +272,9 @@ } print MAKE < Author: chris Date: 2015-05-16 09:17:25 +0000 (Sat, 16 May 2015) New Revision: 3567 Modified: box/trunk/parcels.txt Log: Use variable substitution to avoid hard-coding paths to DLLs on Windows. Add DLLs used by mingw64 gcc, used by recent Cygwin installations, and update to current name of zlib1.dll. Modified: box/trunk/parcels.txt =================================================================== --- box/trunk/parcels.txt 2015-05-16 09:17:21 UTC (rev 3566) +++ box/trunk/parcels.txt 2015-05-16 09:17:25 UTC (rev 3567) @@ -35,11 +35,14 @@ END-ONLY ONLY:mingw32 - script /usr/i686-pc-mingw32/sys-root/mingw/bin/libz-1.dll - script /usr/i686-pc-mingw32/sys-root/mingw/bin/mingwm10.dll - script /usr/i686-pc-mingw32/sys-root/mingw/bin/libgcc_s_dw2-1.dll + script /usr/$ac_target/sys-root/mingw/bin/zlib1.dll + script /usr/$ac_target/sys-root/mingw/bin/libgcc_s_seh-1.dll END-ONLY +ONLY:i686-w64-mingw32 + script /usr/$ac_target/sys-root/mingw/bin/libgcc_s_sjlj-1.dll +END-ONLY + ONLY:SunOS script contrib/solaris/bbackupd-manifest.xml lib/svc/manifest script contrib/solaris/bbackupd-smf-method lib/svc/method From subversion at boxbackup.org Sat May 16 10:17:29 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sat, 16 May 2015 09:17:29 GMT Subject: [Box Backup-commit] COMMIT r3568 - box/trunk/lib/win32 Message-ID: <201505160917.t4G9HTwG079685@web1.boxbackup.org> Author: chris Date: 2015-05-16 09:17:29 +0000 (Sat, 16 May 2015) New Revision: 3568 Modified: box/trunk/lib/win32/emu.cpp Log: Fix error reporting from Reg* functions. Unlike the rest of the Win32 API, these functions return their error code, and it's not accessible using GetLastError(). Thanks to Enrique Perez-Terron for reporting this issue. Modified: box/trunk/lib/win32/emu.cpp =================================================================== --- box/trunk/lib/win32/emu.cpp 2015-05-16 09:17:25 UTC (rev 3567) +++ box/trunk/lib/win32/emu.cpp 2015-05-16 09:17:29 UTC (rev 3568) @@ -1337,11 +1337,11 @@ HKEY hk; DWORD dwDisp; - if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, regkey.c_str(), - 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_WRITE, NULL, &hk, &dwDisp)) + winerrno = RegCreateKeyEx(HKEY_LOCAL_MACHINE, regkey.c_str(), + 0, NULL, REG_OPTION_NON_VOLATILE, + KEY_WRITE, NULL, &hk, &dwDisp); + if (winerrno != ERROR_SUCCESS) { - winerrno = GetLastError(); ::syslog(LOG_ERR, "Failed to create the registry key: %s", GetErrorMessage(winerrno).c_str()); return FALSE; @@ -1349,14 +1349,14 @@ // Set the name of the message file. - if (RegSetValueExW(hk, // subkey handle - L"EventMessageFile", // value name - 0, // must be zero - REG_EXPAND_SZ, // value type - (LPBYTE)cmd, // pointer to value data - len*sizeof(WCHAR))) // data size + winerrno = RegSetValueExW(hk, // subkey handle + L"EventMessageFile", // value name + 0, // must be zero + REG_EXPAND_SZ, // value type + (LPBYTE)cmd, // pointer to value data + len*sizeof(WCHAR)); // data size + if (winerrno != ERROR_SUCCESS) { - winerrno = GetLastError(); ::syslog(LOG_ERR, "Failed to set the event message file: %s", GetErrorMessage(winerrno).c_str()); RegCloseKey(hk); @@ -1368,14 +1368,14 @@ DWORD dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; - if (RegSetValueEx(hk, // subkey handle - "TypesSupported", // value name - 0, // must be zero - REG_DWORD, // value type - (LPBYTE) &dwData, // pointer to value data - sizeof(DWORD))) // length of value data + winerrno = RegSetValueEx(hk, // subkey handle + "TypesSupported", // value name + 0, // must be zero + REG_DWORD, // value type + (LPBYTE) &dwData, // pointer to value data + sizeof(DWORD)); // length of value data + if (winerrno != ERROR_SUCCESS) { - winerrno = GetLastError(); ::syslog(LOG_ERR, "Failed to set the supported types: %s", GetErrorMessage(winerrno).c_str()); RegCloseKey(hk); @@ -1384,14 +1384,14 @@ // Set the category message file and number of categories. - if (RegSetValueExW(hk, // subkey handle - L"CategoryMessageFile", // value name - 0, // must be zero - REG_EXPAND_SZ, // value type - (LPBYTE)cmd, // pointer to value data - len*sizeof(WCHAR))) // data size + winerrno = RegSetValueExW(hk, // subkey handle + L"CategoryMessageFile", // value name + 0, // must be zero + REG_EXPAND_SZ, // value type + (LPBYTE)cmd, // pointer to value data + len*sizeof(WCHAR)); // data size + if (winerrno != ERROR_SUCCESS) { - winerrno = GetLastError(); ::syslog(LOG_ERR, "Failed to set the category message file: " "%s", GetErrorMessage(winerrno).c_str()); RegCloseKey(hk); @@ -1398,14 +1398,14 @@ return FALSE; } - if (RegSetValueEx(hk, // subkey handle + winerrno = RegSetValueEx(hk, // subkey handle "CategoryCount", // value name 0, // must be zero REG_DWORD, // value type (LPBYTE) &dwNum, // pointer to value data - sizeof(DWORD))) // length of value data + sizeof(DWORD)); // length of value data + if (winerrno != ERROR_SUCCESS) { - winerrno = GetLastError(); ::syslog(LOG_ERR, "Failed to set the category count: %s", GetErrorMessage(winerrno).c_str()); RegCloseKey(hk); From subversion at boxbackup.org Sat May 16 11:11:52 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sat, 16 May 2015 10:11:52 GMT Subject: [Box Backup-commit] COMMIT r3569 - box/chris/win32/releases Message-ID: <201505161011.t4GABqqE081504@web1.boxbackup.org> Author: chris Date: 2015-05-16 10:11:52 +0000 (Sat, 16 May 2015) New Revision: 3569 Added: box/chris/win32/releases/boxbackup-trunk_3568-backup-client-x86_64-w64-mingw32.tgz Log: New 64-bit Windows client build. Based on SVN r3568, built with Cygwin/MinGW64 compiler, tested on Windows 7. Added: box/chris/win32/releases/boxbackup-trunk_3568-backup-client-x86_64-w64-mingw32.tgz =================================================================== (Binary files differ) Index: box/chris/win32/releases/boxbackup-trunk_3568-backup-client-x86_64-w64-mingw32.tgz =================================================================== --- box/chris/win32/releases/boxbackup-trunk_3568-backup-client-x86_64-w64-mingw32.tgz 2015-05-16 09:17:29 UTC (rev 3568) +++ box/chris/win32/releases/boxbackup-trunk_3568-backup-client-x86_64-w64-mingw32.tgz 2015-05-16 10:11:52 UTC (rev 3569) Property changes on: box/chris/win32/releases/boxbackup-trunk_3568-backup-client-x86_64-w64-mingw32.tgz ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property From subversion at boxbackup.org Sat May 16 12:54:21 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sat, 16 May 2015 11:54:21 GMT Subject: [Box Backup-commit] COMMIT r3571 - box/trunk/infrastructure Message-ID: <201505161154.t4GBsLMP084788@web1.boxbackup.org> Author: chris Date: 2015-05-16 11:54:21 +0000 (Sat, 16 May 2015) New Revision: 3571 Modified: box/trunk/infrastructure/BoxPlatform.pm.in Log: Include full platform name in parcels, to distinguish 64-bit builds. Modified: box/trunk/infrastructure/BoxPlatform.pm.in =================================================================== --- box/trunk/infrastructure/BoxPlatform.pm.in 2015-05-16 11:54:16 UTC (rev 3570) +++ box/trunk/infrastructure/BoxPlatform.pm.in 2015-05-16 11:54:21 UTC (rev 3571) @@ -82,19 +82,30 @@ if($product_version =~ /USE_SVN_VERSION/) { # for developers, use SVN version - my $svnversion = `svnversion .`; - chomp $svnversion; - $svnversion =~ tr/0-9A-Za-z/_/c; - open INFO,'svn info . |'; - my $svnurl; - while() + my $svnversion = 'unknown'; + my $svnurl = 'unknown'; + + if(-d '.svn') { - if(m/^URL: (.+?)[\n\r]+/) + my $svnversion = `svnversion .`; + chomp $svnversion; + $svnversion =~ tr/0-9A-Za-z/_/c; + open INFO,'svn info . |'; + while() { - $svnurl = $1 + if(m/^URL: (.+?)[\n\r]+/) + { + $svnurl = $1 + } } + close INFO; } - close INFO; + elsif(-d '.git') + { + $svnversion = `git svn info | grep '^Revision:' | cut -d' ' -f2`; + chomp $svnversion; + $svnurl = `git svn info --url`; + } my $svndir; if ($svnurl =~ m!/box/(.+)$!) @@ -158,7 +169,7 @@ sub parcel_root { - my $tos = $_[1] || $ac_target_os; + my $tos = $_[1] || $ac_target; return $product_name.'-'.$product_version.'-'.$_[0].'-'.$tos; } From subversion at boxbackup.org Sat May 16 12:54:16 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sat, 16 May 2015 11:54:16 GMT Subject: [Box Backup-commit] COMMIT r3570 - box/trunk Message-ID: <201505161154.t4GBsGK3084770@web1.boxbackup.org> Author: chris Date: 2015-05-16 11:54:16 +0000 (Sat, 16 May 2015) New Revision: 3570 Modified: box/trunk/runtest.pl.in Log: Fix test script to match change to autoconf variable names. Modified: box/trunk/runtest.pl.in =================================================================== --- box/trunk/runtest.pl.in 2015-05-16 10:11:52 UTC (rev 3569) +++ box/trunk/runtest.pl.in 2015-05-16 11:54:16 UTC (rev 3570) @@ -52,7 +52,7 @@ next if m/\AEND-OMIT/; if(m/\AOMIT:(.+)/) { - if($1 eq $build_os or $1 eq $target_os) + if($1 eq $build_os or $1 eq $ac_target_os) { while() { From subversion at boxbackup.org Sat May 16 14:07:49 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sat, 16 May 2015 13:07:49 GMT Subject: [Box Backup-commit] COMMIT r3572 - box/trunk/test/backupstorefix Message-ID: <201505161307.t4GD7nTp087142@web1.boxbackup.org> Author: chris Date: 2015-05-16 13:07:49 +0000 (Sat, 16 May 2015) New Revision: 3572 Modified: box/trunk/test/backupstorefix/testbackupstorefix.cpp Log: Fix another test failure on Windows caused by holding files open. Modified: box/trunk/test/backupstorefix/testbackupstorefix.cpp =================================================================== --- box/trunk/test/backupstorefix/testbackupstorefix.cpp 2015-05-16 11:54:21 UTC (rev 3571) +++ box/trunk/test/backupstorefix/testbackupstorefix.cpp 2015-05-16 13:07:49 UTC (rev 3572) @@ -562,8 +562,6 @@ StoreStructure::MakeObjectFilename(1 /* root */, accountRootDir, discSetNum, fn, true /* EnsureDirectoryExists */); - std::auto_ptr file(RaidFileRead::Open(discSetNum, - fn)); RaidFileWrite d(discSetNum, fn); d.Open(true /* allow overwrite */); dir.WriteToStream(d); @@ -578,7 +576,8 @@ // so it's not a bad thing to test. TEST_EQUAL(2, check_account_for_errors()); - file = RaidFileRead::Open(discSetNum, fn); + std::auto_ptr file(RaidFileRead::Open(discSetNum, + fn)); dir.ReadFromStream(*file, IOStream::TimeOutInfinite); TEST_THAT(dir.FindEntryByID(0x1234567890123456LL) == 0); }