From boxbackup-dev at fluffy.co.uk Tue Aug 1 11:09:15 2006 From: boxbackup-dev at fluffy.co.uk (Nick Knight) Date: Tue, 1 Aug 2006 11:09:15 +0100 Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: <20060731154051.c4zuz49wyskcw08k@ebourne.me.uk> Message-ID: I think personnel branches are exactly that, my own scratch branch used for playing around and the changes I am going to make may not even get into any development. You then have branches which are projects which are agreed by the development team. The branch would have a specific goal, a target of what it has to achieve at which point it would be merged back into the main branch. So for example: Win 32 developments, Branch WIN32: goal to get the current version compiling and running under windoze Branch Next version features, Branch FEATURES: goal, implement this list of features Bugs branch, a branch for bugs to be fixed under the current release And so on... When I have taken this tact in the past, you have to basic rules, after a commit it much compile etc, as you then tend to have more than one developer working on any one branch. -----Original Message----- From: boxbackup-dev-admin at fluffy.co.uk [mailto:boxbackup-dev-admin at fluffy.co.uk] On Behalf Of Martin Ebourne Sent: 31 July 2006 15:41 To: boxbackup-dev at fluffy.co.uk Subject: Re: [Box Backup-dev] Where to put my bug fixes? Ben Summers wrote: > We do sort of have branches for different kinds of work, it's just > they're named by individuals at the moment. Suggestions for better ways > of working welcomed. That worked fairly well initially because there were several people =20 with several changes each, and all had been worked on individually. It still works well where people are doing their own change or =20 creating scratch branches for playing with. It becomes suboptimal when people start sharing branches or if there's =20 a major branch being worked on (eg. Chris's windows dev). Maybe there =20 could be a different way of marking 'blessed' branches. Keeping =20 'personal' branches in subdirs by name but under a /branches directory =20 and putting main branches directly at that level could work. Cheers, Martin. _______________________________________________ Boxbackup-dev mailing list Boxbackup-dev at fluffy.co.uk http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Sat Aug 5 18:50:26 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Sat, 5 Aug 2006 18:50:26 +0100 (BST) Subject: [Box Backup-dev] COMMIT r692 - in box/chris/general: infrastructure lib/common lib/server In-Reply-To: <83951091-D077-4307-B01D-C640FABF4FE7@fluffy.co.uk> References: <20060726191019.C5FBE96@s0g0.pems.testserver.co.uk> <83951091-D077-4307-B01D-C640FABF4FE7@fluffy.co.uk> Message-ID: Hi Ben, > I'm not totally convinced this is a good idea. Those scripts are already > too complex. I found that it saved me a lot of needless recompilation after rerunning configure or makebuildenv.pl. Compilation is especially slow on Cygwin due to the slow fork process. If you don't want to merge it then I understand, but would you mind if I maintain it separately in my Win32 tree? >> * lib/common/makeexception.pl.in >> - Don't rewrite auto-generated files unless they have changed, to prevent >> unnecessary rebuilds Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Sat Aug 5 19:10:27 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Sat, 5 Aug 2006 19:10:27 +0100 (BST) Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: References: Message-ID: Hi all, > I think personnel branches are exactly that, my own scratch branch used > for playing around and the changes I am going to make may not even get > into any development. > > You then have branches which are projects which are agreed by the > development team. The branch would have a specific goal, a target of > what it has to achieve at which point it would be merged back into the > main branch. I'm viewing my Win32 branch in a slightly different way, at the moment. I want to be able to fix reported and discovered bugs in the Win32 client, without risking affecting the trunk. I also want to do this in public, so that others can see, comment on, compile and test this code. I don't know if all the changes will make it into trunk, but I hope so. So this branch is somewhere between a personal and a project branch. If others are happy to bless this branch as a project to fix all reported bugs under Win32, then I'm happy to maintain (or co-maintain) that branch until it goes away. I would probably keep a personal branch with my own changes as well, which the other developers are less likely to ever agree to merge. There would be some additional overhead in maintaining an additional branch, which I'd like to avoid if possible. The best way that I can see to achieve that is for as much as possible of the current win32 branch to be merged into trunk, but so far I haven't had any responses to my requests to review the changes for merging. Could I have permission from the development team (especially Ben and Martin) to merge any of my Win32 patches, under any conditions? For example, anything clearly enclosed in #ifdef WIN32? Nick, if you can upload your changes to a branch of your own, and let me know, then I'll be happy to review them to merge into my tree, at least. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Sat Aug 5 21:22:51 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 5 Aug 2006 20:22:51 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r711 - box/chris/general/test/bbackupd Message-ID: <20060805202251.6B23F96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-05 20:22:45 +0000 (Sat, 05 Aug 2006) New Revision: 711 Modified: box/chris/general/test/bbackupd/testbbackupd.cpp Log: * testbbackupd.cpp - Added tests that file exclusion is working properly - Improved comments on existing exclusion tests Modified: box/chris/general/test/bbackupd/testbbackupd.cpp =================================================================== --- box/chris/general/test/bbackupd/testbbackupd.cpp 2006-07-27 23:18:35 UTC (rev 710) +++ box/chris/general/test/bbackupd/testbbackupd.cpp 2006-08-05 20:22:45 UTC (rev 711) @@ -47,6 +47,8 @@ #include "BoxTime.h" #include "BoxTimeToUnix.h" #include "ServerControl.h" +#include "Configuration.h" +#include "BackupDaemonConfigVerify.h" #include "MemLeakFindOn.h" @@ -575,6 +577,19 @@ return success; } +int64_t SearchDir(BackupStoreDirectory& rDir, + const std::string& rChildName) +{ + BackupStoreDirectory::Iterator i(rDir); + BackupStoreFilenameClear child(rChildName.c_str()); + BackupStoreDirectory::Entry *en = i.FindMatchingClearName(child); + if (en == 0) return 0; + int64_t id = en->GetObjectID(); + TEST_THAT(id > 0); + TEST_THAT(id != BackupProtocolClientListDirectory::RootDirectory); + return id; +} + int test_bbackupd() { // // First, wait for a normal period to make sure the last changes attributes are within a normal backup timeframe. @@ -845,15 +860,97 @@ wait_for_sync_end(); wait_for_sync_end(); - compareReturnValue = ::system(BBACKUPQUERY " -q -c testfiles/bbackupd.conf -l testfiles/query3c.log \"compare -ac\" quit"); + // compare with exclusions, should not find differences + compareReturnValue = ::system(BBACKUPQUERY " -q " + "-c testfiles/bbackupd.conf -l testfiles/query3c.log " + "\"compare -ac\" quit"); TEST_RETURN(compareReturnValue, 1); TestRemoteProcessMemLeaks("bbackupquery.memleaks"); - compareReturnValue = ::system(BBACKUPQUERY " -q -c testfiles/bbackupd.conf -l testfiles/query3d.log \"compare -acE\" quit"); - // should find differences + // compare without exclusions, should find differences + compareReturnValue = ::system(BBACKUPQUERY " -q " + "-c testfiles/bbackupd.conf -l testfiles/query3d.log " + "\"compare -acE\" quit"); TEST_RETURN(compareReturnValue, 2); TestRemoteProcessMemLeaks("bbackupquery.memleaks"); + // check that the excluded files did not make it + // into the store, and the included files did + printf("Check that exclude/alwaysinclude commands " + "actually work\n"); + + { + std::string errs; + std::auto_ptr config( + Configuration::LoadAndVerify( + "testfiles/bbackupd.conf", + &BackupDaemonConfigVerify, errs)); + Configuration& conf(*config); + SSLLib::Initialise(); + TLSContext tlsContext; + std::string certFile(conf.GetKeyValue("CertificateFile")); + std::string keyFile (conf.GetKeyValue("PrivateKeyFile")); + std::string caFile (conf.GetKeyValue("TrustedCAsFile")); + tlsContext.Initialise(false, certFile.c_str(), + keyFile.c_str(), caFile.c_str()); + BackupClientCryptoKeys_Setup( + conf.GetKeyValue("KeysFile").c_str()); + SocketStreamTLS socket; + socket.Open(tlsContext, Socket::TypeINET, + conf.GetKeyValue("StoreHostname").c_str(), + BOX_PORT_BBSTORED); + BackupProtocolClient connection(socket); + connection.Handshake(); + std::auto_ptr + serverVersion(connection.QueryVersion( + BACKUP_STORE_SERVER_VERSION)); + if(serverVersion->GetVersion() != + BACKUP_STORE_SERVER_VERSION) + { + THROW_EXCEPTION(BackupStoreException, + WrongServerVersion); + } + connection.QueryLogin( + conf.GetKeyValueInt("AccountNumber"), + BackupProtocolClientLogin::Flags_ReadOnly); + + int64_t rootDirId = BackupProtocolClientListDirectory + ::RootDirectory; + std::auto_ptr dirreply( + connection.QueryListDirectory( + rootDirId, false, 0, false)); + std::auto_ptr dirstream( + connection.ReceiveStream()); + BackupStoreDirectory dir; + dir.ReadFromStream(*dirstream, connection.GetTimeout()); + + int64_t testDirId = SearchDir(dir, "Test1"); + TEST_THAT(testDirId != 0); + dirreply = connection.QueryListDirectory(testDirId, false, 0, false); + dirstream = connection.ReceiveStream(); + dir.ReadFromStream(*dirstream, connection.GetTimeout()); + + TEST_THAT(!SearchDir(dir, "excluded_1")); + TEST_THAT(!SearchDir(dir, "excluded_2")); + TEST_THAT(!SearchDir(dir, "exclude_dir")); + TEST_THAT(!SearchDir(dir, "exclude_dir_2")); + // xx_not_this_dir_22 should not be excluded by + // ExcludeDirsRegex, because it's a file + TEST_THAT(SearchDir (dir, "xx_not_this_dir_22")); + TEST_THAT(!SearchDir(dir, "zEXCLUDEu")); + TEST_THAT(SearchDir (dir, "dont.excludethis")); + TEST_THAT(SearchDir (dir, "xx_not_this_dir_ALWAYSINCLUDE")); + + int64_t sub23id = SearchDir(dir, "sub23"); + TEST_THAT(sub23id != 0); + dirreply = connection.QueryListDirectory(sub23id, false, 0, false); + dirstream = connection.ReceiveStream(); + dir.ReadFromStream(*dirstream, connection.GetTimeout()); + TEST_THAT(!SearchDir(dir, "xx_not_this_dir_22")); + TEST_THAT(!SearchDir(dir, "somefile.excludethis")); + connection.QueryFinished(); + } + #ifndef WIN32 // These tests only work as non-root users. if(::getuid() != 0) From boxbackup-dev at fluffy.co.uk Sat Aug 5 21:23:42 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 5 Aug 2006 20:23:42 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r712 - box/chris/general/infrastructure Message-ID: <20060805202342.BC08596@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-05 20:23:40 +0000 (Sat, 05 Aug 2006) New Revision: 712 Modified: box/chris/general/infrastructure/buildenv-testmain-template.cpp Log: * buildenv-testmain-template.cpp - Improved output on memory leak detection Modified: box/chris/general/infrastructure/buildenv-testmain-template.cpp =================================================================== --- box/chris/general/infrastructure/buildenv-testmain-template.cpp 2006-08-05 20:22:45 UTC (rev 711) +++ box/chris/general/infrastructure/buildenv-testmain-template.cpp 2006-08-05 20:23:40 UTC (rev 712) @@ -113,7 +113,7 @@ if(memleakfinder_numleaks() != 0) { failures++; - printf("FAILURE: Memory leaks detected\n"); + printf("FAILURE: Memory leaks detected in test code\n"); printf("==== MEMORY LEAKS =================================\n"); memleakfinder_reportleaks(); printf("===================================================\n"); From boxbackup-dev at fluffy.co.uk Sat Aug 5 21:24:37 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 5 Aug 2006 20:24:37 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r713 - box/chris/general/lib/backupclient Message-ID: <20060805202437.1AE2696@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-05 20:24:34 +0000 (Sat, 05 Aug 2006) New Revision: 713 Modified: box/chris/general/lib/backupclient/BackupStoreDirectory.cpp Log: * BackupStoreDirectory.cpp - Fixed memory leak when BackupStoreDirectory object is reused Modified: box/chris/general/lib/backupclient/BackupStoreDirectory.cpp =================================================================== --- box/chris/general/lib/backupclient/BackupStoreDirectory.cpp 2006-08-05 20:23:40 UTC (rev 712) +++ box/chris/general/lib/backupclient/BackupStoreDirectory.cpp 2006-08-05 20:24:34 UTC (rev 713) @@ -149,6 +149,11 @@ int count = ntohl(hdr.mNumEntries); // Clear existing list + for(std::vector::iterator i = mEntries.begin(); + i != mEntries.end(); i++) + { + delete (*i); + } mEntries.clear(); // Read them in! From boxbackup-dev at fluffy.co.uk Sat Aug 5 21:25:37 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 5 Aug 2006 20:25:37 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r714 - box/chris/general/lib/common Message-ID: <20060805202537.30E0C96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-05 20:25:33 +0000 (Sat, 05 Aug 2006) New Revision: 714 Modified: box/chris/general/lib/common/Test.h Log: * Test.h - Report failing file and line when memory leaks are detected by TestRemoteProcessMemLeaks() Modified: box/chris/general/lib/common/Test.h =================================================================== --- box/chris/general/lib/common/Test.h 2006-08-05 20:24:34 UTC (rev 713) +++ box/chris/general/lib/common/Test.h 2006-08-05 20:25:33 UTC (rev 714) @@ -235,12 +235,21 @@ return pid; } -inline void TestRemoteProcessMemLeaks(const char *filename) +#define TestRemoteProcessMemLeaks(filename) \ + TestRemoteProcessMemLeaksFunc(filename, __FILE__, __LINE__) + +inline void TestRemoteProcessMemLeaksFunc(const char *filename, + const char* file, int line) { #ifdef BOX_MEMORY_LEAK_TESTING // Does the file exist? if(!TestFileExists(filename)) { + if (failures == 0) + { + first_fail_file = file; + first_fail_line = line; + } ++failures; printf("FAILURE: MemLeak report not available (file %s)\n", filename); } @@ -249,8 +258,14 @@ // Is it empty? if(TestGetFileSize(filename) > 0) { + if (failures == 0) + { + first_fail_file = file; + first_fail_line = line; + } ++failures; - printf("FAILURE: Memory leaks found in other process (file %s)\n==========\n", filename); + printf("FAILURE: Memory leaks found in other process " + "(file %s)\n==========\n", filename); FILE *f = fopen(filename, "r"); char line[512]; while(::fgets(line, sizeof(line), f) != 0) From boxbackup-dev at fluffy.co.uk Sat Aug 5 21:26:34 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 5 Aug 2006 20:26:34 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r715 - box/chris/general/lib/common Message-ID: <20060805202634.B7D1296@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-05 20:26:31 +0000 (Sat, 05 Aug 2006) New Revision: 715 Modified: box/chris/general/lib/common/ExcludeList.cpp box/chris/general/lib/common/ExcludeList.h Log: * ExcludeList.cpp * ExcludeList.h - Match exclude lists case-insensitively and regardless of use of forward slashes in paths on Win32 Modified: box/chris/general/lib/common/ExcludeList.cpp =================================================================== --- box/chris/general/lib/common/ExcludeList.cpp 2006-08-05 20:25:33 UTC (rev 714) +++ box/chris/general/lib/common/ExcludeList.cpp 2006-08-05 20:26:31 UTC (rev 715) @@ -65,7 +65,46 @@ } } +#ifdef WIN32 +std::string ExcludeList::ReplaceSlashesDefinite(const std::string& input) const +{ + std::string output = input; + for (std::string::size_type pos = output.find("/"); + pos != std::string::npos; + pos = output.find("/")) + { + output.replace(pos, 1, DIRECTORY_SEPARATOR); + } + + for (std::string::iterator i = output.begin(); i != output.end(); i++) + { + *i = tolower(*i); + } + + return output; +} + +std::string ExcludeList::ReplaceSlashesRegex(const std::string& input) const +{ + std::string output = input; + + for (std::string::size_type pos = output.find("/"); + pos != std::string::npos; + pos = output.find("/")) + { + output.replace(pos, 1, "\\" DIRECTORY_SEPARATOR); + } + + for (std::string::iterator i = output.begin(); i != output.end(); i++) + { + *i = tolower(*i); + } + + return output; +} +#endif + // -------------------------------------------------------------------------- // // Function @@ -88,7 +127,16 @@ { if(i->size() > 0) { - mDefinite.insert(*i); + std::string entry = *i; + + // Convert any forward slashes in the string + // to backslashes + + #ifdef WIN32 + entry = ReplaceSlashesDefinite(entry); + #endif + + mDefinite.insert(entry); } } } @@ -123,8 +171,18 @@ try { + std::string entry = *i; + + // Convert any forward slashes in the string + // to appropriately escaped backslashes + + #ifdef WIN32 + entry = ReplaceSlashesRegex(entry); + #endif + // Compile - if(::regcomp(pregex, i->c_str(), REG_EXTENDED | REG_NOSUB) != 0) + if(::regcomp(pregex, entry.c_str(), + REG_EXTENDED | REG_NOSUB) != 0) { THROW_EXCEPTION(CommonException, BadRegularExpression) } @@ -132,7 +190,7 @@ // Store in list of regular expressions mRegex.push_back(pregex); // Store in list of regular expression string for Serialize - mRegexStr.push_back(i->c_str()); + mRegexStr.push_back(entry.c_str()); } catch(...) { @@ -158,10 +216,16 @@ // -------------------------------------------------------------------------- bool ExcludeList::IsExcluded(const std::string &rTest) const { + std::string test = rTest; + + #ifdef WIN32 + test = ReplaceSlashesDefinite(test); + #endif + // Check against the always include list if(mpAlwaysInclude != 0) { - if(mpAlwaysInclude->IsExcluded(rTest)) + if(mpAlwaysInclude->IsExcluded(test)) { // Because the "always include" list says it's 'excluded' // this means it should actually be included. @@ -170,7 +234,7 @@ } // Is it in the set of definite entries? - if(mDefinite.find(rTest) != mDefinite.end()) + if(mDefinite.find(test) != mDefinite.end()) { return true; } @@ -180,7 +244,7 @@ for(std::vector::const_iterator i(mRegex.begin()); i != mRegex.end(); ++i) { // Test against this expression - if(regexec(*i, rTest.c_str(), 0, 0 /* no match information required */, 0 /* no flags */) == 0) + if(regexec(*i, test.c_str(), 0, 0 /* no match information required */, 0 /* no flags */) == 0) { // match happened return true; Modified: box/chris/general/lib/common/ExcludeList.h =================================================================== --- box/chris/general/lib/common/ExcludeList.h 2006-08-05 20:25:33 UTC (rev 714) +++ box/chris/general/lib/common/ExcludeList.h 2006-08-05 20:26:31 UTC (rev 715) @@ -63,6 +63,11 @@ std::vector mRegexStr; // save original regular expression string-based source for Serialize #endif +#ifdef WIN32 + std::string ReplaceSlashesDefinite(const std::string& input) const; + std::string ReplaceSlashesRegex (const std::string& input) const; +#endif + // For exceptions to the excludes ExcludeList *mpAlwaysInclude; }; From boxbackup-dev at fluffy.co.uk Sun Aug 6 02:44:42 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Sun, 06 Aug 2006 02:44:42 +0100 Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: References: Message-ID: <1154828683.3833.18.camel@avenin.ebourne.me.uk> On Sat, 2006-08-05 at 19:10 +0100, Chris Wilson wrote: > Could I have permission from the development team (especially Ben and > Martin) to merge any of my Win32 patches, under any conditions? For > example, anything clearly enclosed in #ifdef WIN32? I'd like to apologise for being silent on your proposed patches so far. I glanced at them and decided there was rather a lot so I thought I'd come back to it - assuming I found some time! It would be daft to not merge changes after the hard work has been put in, just for lack of review, so it is important to find the time somehow. One thing that would help is knowing what all of the individual changes are. It's generally easier to review small self contained groups of related changes together rather than a whole branch with lots happening. You don't need to make branches, but if you could just list SVN revisions you'd like to merge, grouped together where appropriate, that would help. When I looked before I couldn't see how you'd arrived at what was in the merge branch, it just seemed to have sprung into existence. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Sun Aug 6 11:24:21 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 6 Aug 2006 10:24:21 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r716 - box/chris/general/test/common Message-ID: <20060806102421.44BA796@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-06 10:24:19 +0000 (Sun, 06 Aug 2006) New Revision: 716 Modified: box/chris/general/test/common/testcommon.cpp Log: * common/testcommon.cpp - Added tests for case-insensitive matching on Win32 Modified: box/chris/general/test/common/testcommon.cpp =================================================================== --- box/chris/general/test/common/testcommon.cpp 2006-08-05 20:26:31 UTC (rev 715) +++ box/chris/general/test/common/testcommon.cpp 2006-08-06 10:24:19 UTC (rev 716) @@ -548,21 +548,43 @@ TEST_CHECK_THROWS(elist.AddRegexEntries(std::string("[a-d]+\\.reg$" "\x01" "EXCLUDE" "\x01" "^exclude$")), CommonException, RegexNotSupportedOnThisPlatform); TEST_THAT(elist.SizeOfRegexList() == 0); #endif + + #ifdef WIN32 + #define CASE_SENSITIVE false + #else + #define CASE_SENSITIVE true + #endif + // Try some matches! TEST_THAT(elist.IsExcluded(std::string("Definite1")) == true); TEST_THAT(elist.IsExcluded(std::string("/dir/DefNumberTwo")) == true); TEST_THAT(elist.IsExcluded(std::string("ThingDefThree")) == true); TEST_THAT(elist.IsExcluded(std::string("AnotherDef")) == true); TEST_THAT(elist.IsExcluded(std::string("dir/DefNumberTwo")) == false); + + // Try some case insensitive matches, + // that should pass on Win32 and fail elsewhere + TEST_THAT(elist.IsExcluded("DEFINITe1") + == !CASE_SENSITIVE); + TEST_THAT(elist.IsExcluded("/Dir/DefNumberTwo") + == !CASE_SENSITIVE); + TEST_THAT(elist.IsExcluded("thingdefthree") + == !CASE_SENSITIVE); + #ifdef HAVE_REGEX_H TEST_THAT(elist.IsExcluded(std::string("b.reg")) == true); + TEST_THAT(elist.IsExcluded(std::string("B.reg")) == !CASE_SENSITIVE); + TEST_THAT(elist.IsExcluded(std::string("b.Reg")) == !CASE_SENSITIVE); TEST_THAT(elist.IsExcluded(std::string("e.reg")) == false); - TEST_THAT(elist.IsExcluded(std::string("b.Reg")) == false); - TEST_THAT(elist.IsExcluded(std::string("DEfinite1")) == false); + TEST_THAT(elist.IsExcluded(std::string("e.Reg")) == false); + TEST_THAT(elist.IsExcluded(std::string("DEfinite1")) == !CASE_SENSITIVE); TEST_THAT(elist.IsExcluded(std::string("DEXCLUDEfinite1")) == true); - TEST_THAT(elist.IsExcluded(std::string("DEfinitexclude1")) == false); + TEST_THAT(elist.IsExcluded(std::string("DEfinitexclude1")) == !CASE_SENSITIVE); TEST_THAT(elist.IsExcluded(std::string("exclude")) == true); + TEST_THAT(elist.IsExcluded(std::string("ExcludE")) == !CASE_SENSITIVE); #endif + + #undef CASE_SENSITIVE } test_conversions(); From boxbackup-dev at fluffy.co.uk Sun Aug 6 14:29:24 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Sun, 6 Aug 2006 14:29:24 +0100 (BST) Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: <1154828683.3833.18.camel@avenin.ebourne.me.uk> References: <1154828683.3833.18.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin and all, > I'd like to apologise for being silent on your proposed patches so far. > I glanced at them and decided there was rather a lot so I thought I'd > come back to it - assuming I found some time! It would be daft to not > merge changes after the hard work has been put in, just for lack of > review, so it is important to find the time somehow. OK, thanks. I'm glad there is some interest in reviewing them :-) > One thing that would help is knowing what all of the individual changes > are. It's generally easier to review small self contained groups of > related changes together rather than a whole branch with lots happening. > You don't need to make branches, but if you could just list SVN > revisions you'd like to merge, grouped together where appropriate, that > would help. When I looked before I couldn't see how you'd arrived at > what was in the merge branch, it just seemed to have sprung into > existence. That would be a bit difficult, because there are often several revisions before arriving at the final version of a particular change. I was trying to do that by posting patches to the list, with comments, but they were ignored. Ben suggested that I should be trying to track the changes through SVN, so I created the merge branch. What I've done so far with the merge branch is committed all the patches that I think are uncontroversial. I understand that there are a significant number of them, but I think they are the trivial ones, not requiring explanation, so I committed them in one go. If you disagree about the triviality of any patch, please tell me so, and I'll yank it from merge, for now. If you have any questions, please raise them, and I will try to answer them quickly, or yank the patch. Or you can review the svn log for the same file(s) in my working branch (chris/general) to determine why I changed what I did. After these changes are merged, the differences between trunk and general will be significantly less. The remaining changes will be the more controversial ones requiring closer analysis. Therefore, I propose to separate out individual changes from general, and merge them to the merge branch one at a time, with comments. I will point these commits out to the dev mailing list, and remind people about them until they are committed to trunk. This will be rather a slow process, I'm afraid. I hope that this process satisfies everyone, but comments, questions and constructive criticism are welcome. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Sun Aug 6 14:30:28 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Sun, 6 Aug 2006 14:30:28 +0100 (BST) Subject: [Box Backup-dev] COMMIT r698 - box/chris/general/bin/bbackupquery In-Reply-To: References: <20060727203521.5303C96@s0g0.pems.testserver.co.uk> Message-ID: Hi Ben, On Sun, 30 Jul 2006, Ben Summers wrote: >> * BackupQueries.cpp >> - Restore_TargetPathNotFound should only be used on Win32 > > Why? Sounds like it should apply to all platforms. I haven't written the necessary code to make it work on non-Win32 platforms, sorry. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Sun Aug 6 14:56:18 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Sun, 06 Aug 2006 14:56:18 +0100 Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: References: <1154828683.3833.18.camel@avenin.ebourne.me.uk> Message-ID: <1154872578.3833.32.camel@avenin.ebourne.me.uk> On Sun, 2006-08-06 at 14:29 +0100, Chris Wilson wrote: > That would be a bit difficult, because there are often several revisions > before arriving at the final version of a particular change. I was trying > to do that by posting patches to the list, with comments, but they were > ignored. Ben suggested that I should be trying to track the changes > through SVN, so I created the merge branch. I agree that we should do this through svn. As to several revisions to a change, that's no problem, just list each related revision together as a group, which is what I was suggesting. > What I've done so far with the merge branch is committed all the patches > that I think are uncontroversial. I understand that there are a > significant number of them, but I think they are the trivial ones, not > requiring explanation, so I committed them in one go. Ok, I understand what you did now. I can work with that. I've still got the patches in my mailbox so I'll go back and look over them. > Therefore, I propose to > separate out individual changes from general, and merge them to the merge > branch one at a time, with comments. I will point these commits out to the > dev mailing list, and remind people about them until they are committed to > trunk. This will be rather a slow process, I'm afraid. This could work, though just giving us the revision numbers on the current branch would probably be easier and just as effective. > I hope that this process satisfies everyone, but comments, questions and > constructive criticism are welcome. One thing I'm concerned about is that when this is all merged into trunk that the revision history there is ok to follow. ie. Unrelated changes should preferably be merged into trunk in their own commits with sensible comments. Related or larger changes on a branch by themselves could be merged in one go as long as they only come from one branch. It's ok to see a branch merge and go and check the history of the branch, but doesn't work well if the branches have been copied around and partially merged, makes it time consuming to see what happened where. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Sun Aug 6 15:28:03 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 6 Aug 2006 14:28:03 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r717 - box/chris/win32/releases Message-ID: <20060806142803.1118D96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-06 14:26:51 +0000 (Sun, 06 Aug 2006) New Revision: 717 Added: box/chris/win32/releases/boxbackup-chris_general_716-backup-client-mingw32.zip Log: * boxbackup-chris_general_716-backup-client-mingw32.zip - Uploaded a new Windows client release - (Windows) All unit tests run and pass - (Windows) Fixed support for installing service when configuration file path contains a space - Changed the exceeded storage limits message to a warning, not info - (Windows) Save PID file when running daemon - (Windows) Improved (largely rewritten) implementation of poll() - (Windows) Fixed non-blocking SSL sockets - (Windows) Fixed error handling on named pipe, thanks to Pascal Lalonde - (Windows) Internally convert Unix path separators to Windows (/ to \) on all filenames, e.g. those specified in configuration files - (Windows) Added support for Unicode filenames when creating and changing directories, may fix restoring files with unicode characters in their names - (Windows) Hopefully fixed the inaccurate sleep problem after backup errors, which might cause the daemon to wait much longer than expected before retrying, and use too much CPU while doing so. - Rewrote upload decision logic (whether or not to upload a given file), should be easier to read and debug and implement same semantics - (Windows) Fixed restoring to paths with Unix path separators (for unit tests) - Added a new bbackupctl command to wait for the end of the next sync (useful for unit tests) - Fixed spelling errors - Cleaned up bbackupctl option handling code to make it easier to extend - (Windows) Changed permissions requested in openfile() to better match expectations, should fix backing up read-only files and filesystems - (Windows) Fixed buffering in WinNamedPipeStream when more data is in the pipe than will fit into the supplied buffer - (Windows) Fixed minor memory leaks in bbackupd (cosmetic) - (Windows) Fixed infinite loop with 100% CPU usage when a read error occurs on the named pipe - (Windows) Improved handling of locked files during compare - Disabled informational messages in bbackupctl when running in quiet mode - Merged changed from trunk (nothing significant, I think) - (Windows) Fixed restoring and comparing file attributes, creation and modification times - (Windows) Fixed matching in exclude lists to be case insensitive Copied: box/chris/win32/releases/boxbackup-chris_general_716-backup-client-mingw32.zip (from rev 569, box/chris/win32/releases/boxbackup-chris_general_568-backup-client-mingw32.zip) =================================================================== (Binary files differ) From boxbackup-dev at fluffy.co.uk Sun Aug 6 15:59:49 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Sun, 6 Aug 2006 15:59:49 +0100 (BST) Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: <1154872578.3833.32.camel@avenin.ebourne.me.uk> References: <1154828683.3833.18.camel@avenin.ebourne.me.uk> <1154872578.3833.32.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, > I agree that we should do this through svn. As to several revisions to a > change, that's no problem, just list each related revision together as a > group, which is what I was suggesting. Please could you give an example? I'm confused as to exactly what information I should be giving. > Ok, I understand what you did now. I can work with that. I've still got > the patches in my mailbox so I'll go back and look over them. If you do, please note that some of the patches should be updated, but weren't because nobody seemed interested in the patches I posted. So please would you consider reviewing all the changes between trunk and general in those files, instead of just the changes given in the posted patch file? > One thing I'm concerned about is that when this is all merged into trunk > that the revision history there is ok to follow. ie. Unrelated changes > should preferably be merged into trunk in their own commits with > sensible comments. Related or larger changes on a branch by themselves > could be merged in one go as long as they only come from one branch. > It's ok to see a branch merge and go and check the history of the > branch, but doesn't work well if the branches have been copied around > and partially merged, makes it time consuming to see what happened > where. I definitely agree that commits to trunk should be atomic, minimal and well commented. I don't want all changes in the merge branch to be committed at once, or with the same log message. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Sun Aug 6 16:22:18 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Sun, 06 Aug 2006 16:22:18 +0100 Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: References: <1154828683.3833.18.camel@avenin.ebourne.me.uk> <1154872578.3833.32.camel@avenin.ebourne.me.uk> Message-ID: <1154877738.3833.42.camel@avenin.ebourne.me.uk> On Sun, 2006-08-06 at 15:59 +0100, Chris Wilson wrote: > Hi Martin, > > > I agree that we should do this through svn. As to several revisions to a > > change, that's no problem, just list each related revision together as a > > group, which is what I was suggesting. > > Please could you give an example? I'm confused as to exactly what > information I should be giving. Simply to list the numbers of all of the revisions where a certain change was made. eg. 715, 716 Added case and slash insensitivity to exclude lists, with tests 699, 700 Revert to UNIX paths which should now work under Win32 Those ones happened to be adjacent, but they wouldn't need to be. This is an alternative to adding things one at a time to your merge branch which is a perfectly reasonable way of doing things, but may involve a bit more work for yourself. I'm easy either way really, as long as I can get to review sensible chunks of work rather than one branch with 6 separate patches on it in one commit. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Sun Aug 6 16:28:16 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Sun, 6 Aug 2006 16:28:16 +0100 (BST) Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: <1154877738.3833.42.camel@avenin.ebourne.me.uk> References: <1154828683.3833.18.camel@avenin.ebourne.me.uk> <1154872578.3833.32.camel@avenin.ebourne.me.uk> <1154877738.3833.42.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, >> Please could you give an example? I'm confused as to exactly what >> information I should be giving. > > Simply to list the numbers of all of the revisions where a certain > change was made. > > eg. > > 715, 716 > Added case and slash insensitivity to exclude lists, with tests [...] > This is an alternative to adding things one at a time to your merge > branch which is a perfectly reasonable way of doing things, but may > involve a bit more work for yourself. I'm easy either way really, as > long as I can get to review sensible chunks of work rather than one > branch with 6 separate patches on it in one commit. If other things were changed, in different files, in the same commit, then should I also include a path for you to diff, or an svn command? If several unrelated changes were made to the same file in a series of commits, perhaps it's better that I put the individual changes into my merge branch, one change per commit, or post a patch to the list? Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Sun Aug 6 22:26:31 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Sun, 06 Aug 2006 22:26:31 +0100 Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: References: <1154828683.3833.18.camel@avenin.ebourne.me.uk> <1154872578.3833.32.camel@avenin.ebourne.me.uk> <1154877738.3833.42.camel@avenin.ebourne.me.uk> Message-ID: <1154899591.3833.49.camel@avenin.ebourne.me.uk> On Sun, 2006-08-06 at 16:28 +0100, Chris Wilson wrote: > If other things were changed, in different files, in the same commit, then > should I also include a path for you to diff, or an svn command? Of course, in a perfect world that shouldn't happen. ;-) > If several unrelated changes were made to the same file in a series of > commits, perhaps it's better that I put the individual changes into my > merge branch, one change per commit, or post a patch to the list? I think the one change per commit into the merge branch is probably the best solution here. I fully understand that unrelated changes end up in a commit, although we all know ideally they shouldn't. Rearranging them into the merge branch is a good workaround. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Sun Aug 6 22:57:35 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Sun, 6 Aug 2006 22:57:35 +0100 (BST) Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: <1154899591.3833.49.camel@avenin.ebourne.me.uk> References: <1154828683.3833.18.camel@avenin.ebourne.me.uk> <1154872578.3833.32.camel@avenin.ebourne.me.uk> <1154877738.3833.42.camel@avenin.ebourne.me.uk> <1154899591.3833.49.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin (and all), On Sun, 6 Aug 2006, Martin Ebourne wrote: >> If other things were changed, in different files, in the same commit, then >> should I also include a path for you to diff, or an svn command? > > Of course, in a perfect world that shouldn't happen. ;-) I know that I've been getting a bit too personal with my personal branch. Sorry about that. > I think the one change per commit into the merge branch is probably the > best solution here. I fully understand that unrelated changes end up in > a commit, although we all know ideally they shouldn't. Rearranging them > into the merge branch is a good workaround. Do you require me to scrap the current merge branch and re-commit with one change per commit, or are you (all) happy to review it as it stands, given that it consists of orthogonal, independent, and self-explanatory changes (I hope)? Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Mon Aug 7 09:47:10 2006 From: boxbackup-dev at fluffy.co.uk (Nick Knight) Date: Mon, 7 Aug 2006 09:47:10 +0100 Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: Message-ID: Hello All, I have been following the latest discussion on the bug submission protocol, can I make a suggestion, I have been trying to follow how I should add my bug fixes to the source tree, and at the mo I am a little confused, I am happy to follow the pack on this, but once we have a procedure for this can it be documented on the wiki? This would really help me sort the outstanding bugs I have found. Regards Nick -----Original Message----- From: boxbackup-dev-admin at fluffy.co.uk [mailto:boxbackup-dev-admin at fluffy.co.uk] On Behalf Of Chris Wilson Sent: 06 August 2006 22:58 To: boxbackup-dev at fluffy.co.uk Subject: RE: [Box Backup-dev] Where to put my bug fixes? Hi Martin (and all), On Sun, 6 Aug 2006, Martin Ebourne wrote: >> If other things were changed, in different files, in the same commit, then >> should I also include a path for you to diff, or an svn command? > > Of course, in a perfect world that shouldn't happen. ;-) I know that I've been getting a bit too personal with my personal branch.=20 Sorry about that. > I think the one change per commit into the merge branch is probably the=20 > best solution here. I fully understand that unrelated changes end up in=20 > a commit, although we all know ideally they shouldn't. Rearranging them=20 > into the merge branch is a good workaround. Do you require me to scrap the current merge branch and re-commit with one=20 change per commit, or are you (all) happy to review it as it stands, given=20 that it consists of orthogonal, independent, and self-explanatory changes=20 (I hope)? Cheers, Chris. --=20 _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | _______________________________________________ Boxbackup-dev mailing list Boxbackup-dev at fluffy.co.uk http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Mon Aug 7 12:15:38 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Mon, 07 Aug 2006 12:15:38 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [01] bbackupd.conf In-Reply-To: References: Message-ID: <20060807121538.rlyrajzascgwgcss@ebourne.me.uk> Chris Wilson wrote: > In the recent changes to auto-generating Perl files, it seems that an > @PERL@ template was inserted into a unit test configuration file, which > is not auto-generated as far as I can tell. This breaks the unit tests. > The attached patch should fix it as long as perl is on your PATH. I'm replying to the original patch emails but reviewing the patches as they currently stand in the chris/merge tree. eg. For this one the final solution was quite different. You should wait for Ben's opinion on these patches as well before merging them, these are just my viewpoints. This one is good to merge. [And this is so obviously right I don't think you need to wait for Ben - always good to start with a rule and then break it immediately. :-)] Cheers, Martin. From boxbackup-dev at fluffy.co.uk Mon Aug 7 12:21:01 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Mon, 07 Aug 2006 12:21:01 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [02] BoxPlatform.pm and uname -p In-Reply-To: References: Message-ID: <20060807122101.ziiau779c0o8wswk@ebourne.me.uk> Chris Wilson wrote: > It seems that "uname -p", as used in BoxPlatform.pm.in, is not very > portable. I'm not even sure what $build_cpu is used for, if anything, > but "uname -m" should work better than "uname -p". Changing from uname -p to uname -m could be dangerous because they mean different things. One is processor type, the other is machine architecture. On Solaris for instance they return different results, eg. sparc and sun4u respectively. However, Box isn't using the result of build_cpu so it doesn't matter a jot. My guess is that it was used before autoconf (eg. I think for endianness - which is generally a processor not architecture thing except on ppc) and it was something I missed in the cleanup. So no to this version of the patch, please remove that code entirely. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Mon Aug 7 13:27:22 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Mon, 07 Aug 2006 13:27:22 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [03] Additional commands for bbackupctl In-Reply-To: References: Message-ID: <20060807132722.uckkh0fi0wccwksg@ebourne.me.uk> Chris Wilson wrote: > The attached patch adds some new commands to bbackupctl. They are > "wait-for-end" and "sync-and-wait". The patch includes documentation > for them. They are useful in bbackupd unit tests (still to come). There's beginning to be quite a confusing array of commands in =20 bbackupctl now. I wonder if some of them could be rationalised to make =20 it simpler? The command execution code is something of an ifelse mess at the =20 moment. The last loop has essentially no shared code between the =20 commands. It would be a lot better to implement each of these commands =20 in a separate function and call that instead. You didn't start the =20 code down this route, so I'm not blaming you! > =09// Is the command the "wait for sync to start" command? > =09bool areWaitingForSync =3D false; > -=09if(::strcmp(argv[0], "wait-for-sync") =3D=3D 0) > +=09bool areWaitingForSyncEnd =3D false; > + > +=09if(::strcmp(argv[0], "wait-for-sync") =3D=3D 0 || > +=09 ::strcmp(argv[0], "wait-for-end") =3D=3D 0) > =09{ > -=09=09// Check that it's not in non-automatic mode, because then it'll = =20 > never start > +=09=09// Check that it's not in non-automatic mode, +=09=09// because the= n =20 > it'll never start > =09=09if(!autoBackup) > =09=09{ > -=09=09=09printf("ERROR: Daemon is not in automatic mode -- sync will =20 > never start!\n"); > +=09=09=09printf("ERROR: Daemon is not in automatic mode -- " > +=09=09=09=09"sync will never start!\n"); > =09=09=09return 1; > =09=09} > > -=09=09// Yes... set the flag so we know what we're waiting for a sync to = start > -=09=09areWaitingForSync =3D true; > +=09=09// Yes... set the flag so we know that +=09=09// we're waiting for = a =20 > sync to start/end > +=09=09if(::strcmp(argv[0], "wait-for-sync") =3D=3D 0) > +=09=09{ > +=09=09=09areWaitingForSync =3D true; > +=09=09} > +=09=09else if (::strcmp(argv[0], "wait-for-end") =3D=3D 0) > +=09=09{ > +=09=09=09areWaitingForSyncEnd =3D true; > +=09=09} > =09} At the very least the original boolean state flag (areWaitingForSync) =20 should have been replaced by an enum for command and the if further =20 down replaced by a switch though. This comparing twice for the same =20 string is bad and should be avoided. Not for efficiency here but for =20 consistency. If those strings ever manage to differ then that will be =20 hard to debug. > +=09=09=09else if(line =3D=3D "finish-sync" && syncIsRunning) > +=09=09=09{ > +=09=09=09=09if (!quiet) printf("Sync finished.\n"); > +=09=09=09=09// Send a quit command to finish nicely > +=09=09=09=09connection.Write("quit\n", 5); > + > +=09=09=09=09// And we're done > +=09=09=09=09break; > +=09=09=09} > +=09=09=09else if(line =3D=3D "finish-sync") > +=09=09=09{ > +=09=09=09=09if (!quiet) printf("Previous sync finished.\n"); > +=09=09=09} This testing the same condition would be much better as a nested if. Something along the lines of the following would be better if separate =20 functions were not used (I'm not attempting to indent this properly in =20 the email program): enum Command { Default, WaitForSync, WaitForSyncEnd, SyncAndWait }; Command command =3D Default; std::string commandName(argv[0]); if (commandName =3D=3D "wait-for-sync") { command =3D WaitForSync; } else if (commandName =3D=3D "wait-for-end") { command =3D WaitForEnd; } else if (commandName =3D=3D "sync-and-wait") { command =3D SyncAndWait; } switch (command) { case WaitForSync: case WaitForSyncEnd: { // Check that it's in automatic mode, because // otherwise it'll never start if(!autoBackup) { printf("ERROR: Daemon is not in automatic mode -- " "sync will never start!\n"); return 1; } } break; case SyncAndWait: { // send a sync command std::string cmd("force-sync\n"); connection.Write(cmd.c_str(), cmd.size()); connection.WriteAllBuffered(); if (currentState !=3D 0) { printf("Waiting for current sync/error state " "to finish...\n"); } } break; default: { // Normal case, just send the command given plus a quit command= . std::string cmd(argv[0]); cmd +=3D "\nquit\n"; connection.Write(cmd.c_str(), cmd.size()); } } // Read the response std::string line; bool syncIsRunning =3D false; bool finished =3D false; while(!finished && !getLine.IsEOF() && getLine.GetLine(line)) { switch (command) { case WaitForSync: { // Need to wait for the state change... if(line =3D=3D "start-sync") { // Send a quit command to finish nicely connection.Write("quit\n", 5); // And we're done finished =3D true; } } break; case WaitForSync: case SyncAndWait: { if(line =3D=3D "start-sync") { if (!quiet) printf("Sync started...\n"); syncIsRunning =3D true; } else if(line =3D=3D "finish-sync") { if (syncIsRunning) { if (!quiet) printf("Sync finished.\n"); // Send a quit command to finish nicely connection.Write("quit\n", 5); // And we're done finished =3D true; } else { if (!quiet) printf("Previous sync finished.\n"); } // daemon must still be busy } } break; default: { // Is this an OK or error line? if(line =3D=3D "ok") { if(!quiet) { printf("Succeeded.\n"); } finished =3D true; } else if(line =3D=3D "error") { printf("ERROR. (Check command spelling)\n"); returnCode =3D 1; finished =3D true; } } } } Cheers, Martin. From boxbackup-dev at fluffy.co.uk Mon Aug 7 13:29:45 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Mon, 07 Aug 2006 13:29:45 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [04] Storage limits message severity In-Reply-To: References: Message-ID: <20060807132945.jgkkegtyv440occg@ebourne.me.uk> Chris Wilson wrote: > Someone requested on the list that the severity of the "Exceeded > storage limits on server -- not uploading changes to files" message be > increased. This seems like a good idea to me. Trivial patch attached. Good to merge. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Mon Aug 7 14:01:37 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Mon, 7 Aug 2006 14:01:37 +0100 Subject: [Box Backup-dev] Reviewing code Message-ID: I have been meaning to review the Win32 code, but unfortunately it's not a trivial amount of work and I've just got absolutely snowed under with other stuff. If Martin is happy to review code and Chris to merge it into trunk, I'll take a look after the event. I think it's important to get going and test things, and there does seem to be a lot to get through. It is an interesting code management project to make and review changes with part time developers. Anyone know how other projects cope? Maybe in future we could try and do things in smaller and more incremental chunks? Thanks for all the hard work, and sorry to let you all down by not looking at it in a timely manner. Ben From boxbackup-dev at fluffy.co.uk Mon Aug 7 14:03:10 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Mon, 7 Aug 2006 14:03:10 +0100 Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: References: Message-ID: <9907EA5B-FF2F-4238-9ED6-08B44CCC1145@fluffy.co.uk> Nick Would you mind writing a procedure and putting it up on the wiki? Then we can rapidly move towards something we're all happy with. Thanks! Ben On 7 Aug 2006, at 09:47, Nick Knight wrote: > Hello All, > > I have been following the latest discussion on the bug submission > protocol, can I make a suggestion, I have been trying to follow how I > should add my bug fixes to the source tree, and at the mo I am a > little > confused, I am happy to follow the pack on this, but once we have a > procedure for this can it be documented on the wiki? This would really > help me sort the outstanding bugs I have found. > > Regards > > Nick > > -----Original Message----- > From: boxbackup-dev-admin at fluffy.co.uk > [mailto:boxbackup-dev-admin at fluffy.co.uk] On Behalf Of Chris Wilson > Sent: 06 August 2006 22:58 > To: boxbackup-dev at fluffy.co.uk > Subject: RE: [Box Backup-dev] Where to put my bug fixes? > > Hi Martin (and all), > > On Sun, 6 Aug 2006, Martin Ebourne wrote: > >>> If other things were changed, in different files, in the same >>> commit, > then >>> should I also include a path for you to diff, or an svn command? >> >> Of course, in a perfect world that shouldn't happen. ;-) > > I know that I've been getting a bit too personal with my personal > branch. > Sorry about that. > >> I think the one change per commit into the merge branch is probably > the >> best solution here. I fully understand that unrelated changes end up > in >> a commit, although we all know ideally they shouldn't. Rearranging > them >> into the merge branch is a good workaround. > > Do you require me to scrap the current merge branch and re-commit with > one > change per commit, or are you (all) happy to review it as it stands, > given > that it consists of orthogonal, independent, and self-explanatory > changes > (I hope)? > > Cheers, Chris. > -- > _ ___ __ _ > / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | > / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | > \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | > > _______________________________________________ > Boxbackup-dev mailing list > Boxbackup-dev at fluffy.co.uk > http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev > _______________________________________________ > Boxbackup-dev mailing list > Boxbackup-dev at fluffy.co.uk > http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Mon Aug 7 14:20:01 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Mon, 07 Aug 2006 14:20:01 +0100 Subject: [Box Backup-dev] Reviewing code In-Reply-To: References: Message-ID: <20060807142001.amonlc4x0k00swo0@ebourne.me.uk> Ben Summers wrote: > It is an interesting code management project to make and review changes > with part time developers. Anyone know how other projects cope? Maybe > in future we could try and do things in smaller and more incremental > chunks? For the majority of projects the barrier to code entry is lower. =20 Especially for developers with commit access most projects let people =20 just get on with it and hope to catch things either by people glancing =20 over commit messages or just testing/working with the code. In the case of box though I think it makes a lot of sense to set the =20 barrier high. Backup software is always under tested (in the sense =20 that users don't tend to keep a close eye on it and only notice =20 something bad when it fails) and over relied upon. Some projects are notable exceptions though, and on these I suspect =20 it's just a case of less changes per man-hour are eventually made. =20 Then you just need more people to achieve the same rate of feature =20 growth (although the end result should be higher quality we hope). =20 Pity this poor guy for instance (you have to click on the replies on =20 the left): http://lkml.org/lkml/2006/8/1/296 Cheers, Martin. From boxbackup-dev at fluffy.co.uk Mon Aug 7 15:11:25 2006 From: boxbackup-dev at fluffy.co.uk (Nick Knight) Date: Mon, 7 Aug 2006 15:11:25 +0100 Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: <9907EA5B-FF2F-4238-9ED6-08B44CCC1145@fluffy.co.uk> Message-ID: Hello Ben, I am more than happy to - but I am not sure I have the most to contribute here, Chris and Martin appear to be heavily involved in how SVN works - and I suppose it would be good to understand how your branching and everything SVN works first... Nick -----Original Message----- From: boxbackup-dev-admin at fluffy.co.uk [mailto:boxbackup-dev-admin at fluffy.co.uk] On Behalf Of Ben Summers Sent: 07 August 2006 14:03 To: boxbackup-dev at fluffy.co.uk Subject: Re: [Box Backup-dev] Where to put my bug fixes? Nick Would you mind writing a procedure and putting it up on the wiki? =20 Then we can rapidly move towards something we're all happy with. Thanks! Ben On 7 Aug 2006, at 09:47, Nick Knight wrote: > Hello All, > > I have been following the latest discussion on the bug submission > protocol, can I make a suggestion, I have been trying to follow how I > should add my bug fixes to the source tree, and at the mo I am a =20 > little > confused, I am happy to follow the pack on this, but once we have a > procedure for this can it be documented on the wiki? This would really > help me sort the outstanding bugs I have found. > > Regards > > Nick > > -----Original Message----- > From: boxbackup-dev-admin at fluffy.co.uk > [mailto:boxbackup-dev-admin at fluffy.co.uk] On Behalf Of Chris Wilson > Sent: 06 August 2006 22:58 > To: boxbackup-dev at fluffy.co.uk > Subject: RE: [Box Backup-dev] Where to put my bug fixes? > > Hi Martin (and all), > > On Sun, 6 Aug 2006, Martin Ebourne wrote: > >>> If other things were changed, in different files, in the same =20 >>> commit, > then >>> should I also include a path for you to diff, or an svn command? >> >> Of course, in a perfect world that shouldn't happen. ;-) > > I know that I've been getting a bit too personal with my personal > branch. > Sorry about that. > >> I think the one change per commit into the merge branch is probably > the >> best solution here. I fully understand that unrelated changes end up > in >> a commit, although we all know ideally they shouldn't. Rearranging > them >> into the merge branch is a good workaround. > > Do you require me to scrap the current merge branch and re-commit with > one > change per commit, or are you (all) happy to review it as it stands, > given > that it consists of orthogonal, independent, and self-explanatory > changes > (I hope)? > > Cheers, Chris. > --=20 > _ ___ __ _ > / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | > / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | > \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | > > _______________________________________________ > Boxbackup-dev mailing list > Boxbackup-dev at fluffy.co.uk > http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev > _______________________________________________ > Boxbackup-dev mailing list > Boxbackup-dev at fluffy.co.uk > http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev _______________________________________________ Boxbackup-dev mailing list Boxbackup-dev at fluffy.co.uk http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Mon Aug 7 15:46:34 2006 From: boxbackup-dev at fluffy.co.uk (Charles Lecklider) Date: Mon, 07 Aug 2006 15:46:34 +0100 Subject: [Box Backup-dev] Reviewing code In-Reply-To: <20060807142001.amonlc4x0k00swo0@ebourne.me.uk> References: <20060807142001.amonlc4x0k00swo0@ebourne.me.uk> Message-ID: <44D7524A.3070003@invis.net> Martin Ebourne wrote: > In the case of box though I think it makes a lot of sense to set the > barrier high. Backup software is always under tested (in the sense that > users don't tend to keep a close eye on it and only notice something bad > when it fails) and over relied upon. I think there's more than 1 barrier, at least for me: 1) Understanding what bit does what. Probably slightly lower than a lot of other bits of software in that the design seems sensible, and mostly the comments are helpful. 2) Source control. a) I want to work on the Win32 version. I've never managed to get trunk to compile, and people's personal branches are, well, personal. There's no "Win32-stable" branch I can see, so while I could create my own and do some work, merging that back in would be no fun at all (as I'm sure Chris will agree by the time his changes are done). b) TortoiseSVN is probably the least reliable bit of software I've used for many years. I've just abandoned SVN on another project because adding a file has about a 50/50 chance of trashing the local repository. This pretty much rules out me creating my own branch. 3) Compiling Box. It's obviously OK on the unix side, but if trunk is anything to go by the Win32 side leaves a lot to be desired. My main gripes are: a) Cygwin. For me, needing any part of Cygwin to compile something for Windows instantly puts it in the "damn, I suppose we have to support bloody Windoze too; let's make it work like unix" category. b) Not using VC2k5. Again, I think MinGW is trying to do unix-on-Windows. I don't have a problem with (1), I continue to hope that (2a) will sort itself out with time, and I can find some way to work around (2b). I can't live with any of (3). It's probably a good idea if Box continues to be compilable with MinGW, but VC2k5 is what the Windows world uses. I noticed some discussion about the licensing of the Express version not allowing you to release a binary, but that's hardly an excuse not to use it for development; all it takes is someone (e.g. me) with a full version that's willing to produce release binaries. Having said all that, I'm aware that I've contributed very little to Box so far, so it's a bit rich to start making all sorts of demands. But having said that, it's a chicken/egg problem for me. If (2a) and (3) aren't sorted out I can't start doing anything, and until I start doing something I can't really demand they're sorted out. To extend that metaphor further than I probably should, what I'd like ideally is for someone to say "here's an egg, here's a chicken, off you go". Failing that, someone saying "there will be no egg" would allow me to cross Box off the list of things I need to find time for. -C From boxbackup-dev at fluffy.co.uk Mon Aug 7 16:14:45 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Mon, 07 Aug 2006 16:14:45 +0100 Subject: [Box Backup-dev] Reviewing code In-Reply-To: <44D7524A.3070003@invis.net> References: <20060807142001.amonlc4x0k00swo0@ebourne.me.uk> <44D7524A.3070003@invis.net> Message-ID: <20060807161445.hlsmw2lj7k0o0440@ebourne.me.uk> Charles Lecklider wrote: > Martin Ebourne wrote: >> In the case of box though I think it makes a lot of sense to set the >> barrier high. Backup software is always under tested (in the sense that >> users don't tend to keep a close eye on it and only notice something bad >> when it fails) and over relied upon. > > I think there's more than 1 barrier, at least for me: Charles, I was specifically talking about barriers on commiting code re: depth =20 of code review. You've somewhat taken my comment and gone down a whole =20 different road! While your points are all reasonable mostly Chris and now Nick are =20 working hard to resolve almost all of your issues. Although there is =20 no "official" win32 branch it is clear from reading that list that the =20 chris/general branch is where Chris has been doing all his windows =20 development. I'm sure he wouldn't mind you taking that and fixing it =20 so it compiles on VC, and I'm sure he'd be happy to commit any changes =20 you made. Chris has stated his reasons why he won't use VC himself and =20 they seem sound to me. He's also stated he's happy to accept other's =20 work on VC so he's clearly open minded about it. Obviously your life will be a lot easier if you wait until all of the =20 windows stuff is committed to trunk, and we're all putting effort into =20 seeing that happen because that will benefit everyone. Until the =20 windows code is merged further work on the unix side would be =20 inconvenient. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Mon Aug 7 17:15:29 2006 From: boxbackup-dev at fluffy.co.uk (Charles Lecklider) Date: Mon, 07 Aug 2006 17:15:29 +0100 Subject: [Box Backup-dev] Reviewing code In-Reply-To: <20060807161445.hlsmw2lj7k0o0440@ebourne.me.uk> References: <20060807142001.amonlc4x0k00swo0@ebourne.me.uk> <44D7524A.3070003@invis.net> <20060807161445.hlsmw2lj7k0o0440@ebourne.me.uk> Message-ID: <44D76721.3050106@invis.net> Martin Ebourne wrote: > Charles Lecklider wrote: >> Martin Ebourne wrote: >>> In the case of box though I think it makes a lot of sense to set the >>> barrier high. Backup software is always under tested (in the sense that >>> users don't tend to keep a close eye on it and only notice something bad >>> when it fails) and over relied upon. >> >> I think there's more than 1 barrier, at least for me: > > Charles, > > I was specifically talking about barriers on commiting code re: depth of > code review. You've somewhat taken my comment and gone down a whole > different road! A tangent perhaps, but if people can't write the code in the first place there's little need to worry about the review process.... > While your points are all reasonable mostly Chris and now Nick are > working hard to resolve almost all of your issues. Although there is no > "official" win32 branch it is clear from reading that list that the > chris/general branch is where Chris has been doing all his windows > development. I'm sure he wouldn't mind you taking that and fixing it so > it compiles on VC, and I'm sure he'd be happy to commit any changes you > made. Chris has stated his reasons why he won't use VC himself and they > seem sound to me. He's also stated he's happy to accept other's work on > VC so he's clearly open minded about it. That'd be a good start. More importantly though, is the Win32-specific version of BoxConfig.h kept up-to-date? That's where I've had most problems in the past, and where Cygwin is needed otherwise. -C From boxbackup-dev at fluffy.co.uk Mon Aug 7 16:37:53 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Mon, 7 Aug 2006 16:37:53 +0100 (BST) Subject: [Box Backup-dev] Reviewing code In-Reply-To: <44D7524A.3070003@invis.net> References: <20060807142001.amonlc4x0k00swo0@ebourne.me.uk> <44D7524A.3070003@invis.net> Message-ID: Hi Charles, On Mon, 7 Aug 2006, Charles Lecklider wrote: > a) Cygwin. For me, needing any part of Cygwin to compile something for > Windows instantly puts it in the "damn, I suppose we have to support > bloody Windoze too; let's make it work like unix" category. By the way, it should definitely be possible to compile Box on Windows without ANY cygwin support, primarily because you requested it in the past, and Nick supplied the beginnings of an underlying infrastructure in win32.bat. You do need Perl and SVN command-line tools installed though. Please see the "Compile with Visual C" page on the wiki: [http://boxbackup.hostworks.ca/index.php/Compile_With_Visual_C] Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Mon Aug 7 18:00:18 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Mon, 7 Aug 2006 18:00:18 +0100 (BST) Subject: [Box Backup-dev] Reviewing code In-Reply-To: <44D76721.3050106@invis.net> References: <20060807142001.amonlc4x0k00swo0@ebourne.me.uk> <44D7524A.3070003@invis.net> <20060807161445.hlsmw2lj7k0o0440@ebourne.me.uk> <44D76721.3050106@invis.net> Message-ID: Hi Charles, On Mon, 7 Aug 2006, Charles Lecklider wrote: > That'd be a good start. More importantly though, is the Win32-specific > version of BoxConfig.h kept up-to-date? That's where I've had most > problems in the past, and where Cygwin is needed otherwise. I do compile occasionally with VS2K5, but haven't needed to update this file for some time. Cygwin is NOT required. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Mon Aug 7 21:26:34 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Mon, 7 Aug 2006 21:26:34 +0100 (BST) Subject: [Box Backup-dev] Where to put my bug fixes? In-Reply-To: References: Message-ID: Hi Nick, > I am more than happy to - but I am not sure I have the most to > contribute here, Chris and Martin appear to be heavily involved in how > SVN works - and I suppose it would be good to understand how your > branching and everything SVN works first... Quick guide to Subversion: Install the Windows Subversion client command-line tools from [http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91] Make sure they are in your path. You should be able to run "svn" from the command line. To create a new branch from scratch: svn mkdir http://bbdev.fluffy.co.uk/svn/box/nick To copy an existing branch, creating a new one: svn cp http://bbdev.fluffy.co.uk/svn/box/chris/general http://bbdev.fluffy.co.uk/svn/box/nick/personal To check out your new branch as a local working copy: svn co http://bbdev.fluffy.co.uk/svn/box/nick/personal (creates a directory called "personal" under the current directory where you run the command) To commit changes to your working copy to the branch where it belongs: svn ci . To show differences between your working copy and the version you checked out: svn diff To show differences between two branches: svn diff http://bbdev.fluffy.co.uk/svn/box/chris/general http://bbdev.fluffy.co.uk/svn/box/nick/personal To update your local working copy: svn update To switch a working copy to a new branch: svn switch http://bbdev.fluffy.co.uk/svn/box/nick/personal For more information about how SVN works, and the available commands, please see [http://svnbook.red-bean.com/] I'd recommend that you create a new personal branch for yourself as above, based on mine, commit your changes, and then tell me so that I can review them and commit them to my branch, where I can look after merging them for you. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Mon Aug 7 21:42:29 2006 From: boxbackup-dev at fluffy.co.uk (Charles Lecklider) Date: Mon, 07 Aug 2006 21:42:29 +0100 Subject: [Box Backup-dev] Reviewing code In-Reply-To: References: <20060807142001.amonlc4x0k00swo0@ebourne.me.uk> <44D7524A.3070003@invis.net> Message-ID: <44D7A5B5.50000@invis.net> Chris Wilson wrote: > Hi Charles, > > On Mon, 7 Aug 2006, Charles Lecklider wrote: > >> a) Cygwin. For me, needing any part of Cygwin to compile something for >> Windows instantly puts it in the "damn, I suppose we have to support >> bloody Windoze too; let's make it work like unix" category. > > By the way, it should definitely be possible to compile Box on Windows > without ANY cygwin support, primarily because you requested it in the > past, and Nick supplied the beginnings of an underlying infrastructure > in win32.bat. You do need Perl and SVN command-line tools installed > though. Please see the "Compile with Visual C" page on the wiki: > > [http://boxbackup.hostworks.ca/index.php/Compile_With_Visual_C] Aha! I clearly missed all the emails where people said that had been fixed.... Which branch should I try? -C From boxbackup-dev at fluffy.co.uk Mon Aug 7 21:53:17 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Mon, 7 Aug 2006 20:53:17 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r718 - in box/trunk: . test/bbackupd/testfiles Message-ID: <20060807205317.95C5496@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-07 20:53:12 +0000 (Mon, 07 Aug 2006) New Revision: 718 Added: box/trunk/test/bbackupd/testfiles/bbackupd.conf.in Removed: box/trunk/test/bbackupd/testfiles/bbackupd.conf Modified: box/trunk/configure.ac Log: * test/bbackupd/testfiles/bbackupd.conf * test/bbackupd/testfiles/bbackupd.conf.in * configure.ac - Define @PERL_NATIVE@ to "perl" on Win32, @PERL@ on other platforms - Automatically generate test/bbackupd/testfiles/bbackupd.conf with autoconf substitution of @PERL_NATIVE@ Modified: box/trunk/configure.ac =================================================================== --- box/trunk/configure.ac 2006-08-06 14:26:51 UTC (rev 717) +++ box/trunk/configure.ac 2006-08-07 20:53:12 UTC (rev 718) @@ -26,14 +26,21 @@ # Use -rdynamic if we have gcc. This is needed for backtrace AC_SUBST([LDADD_RDYNAMIC], ['-rdynamic']) fi -AC_PATH_PROG([PERL], [perl], [no]) -if test "x$PERL" != "xno"; then - AC_DEFINE_UNQUOTED([PERL_EXECUTABLE], ["$PERL"], [Location of the perl executable]) -else - AC_MSG_ERROR([[perl executable was not found]]) -fi +AC_PATH_PROG([PERL], [perl], [AC_MSG_ERROR([[perl executable was not found]])]) +case $target_os in +mingw*) + AC_DEFINE_UNQUOTED([PERL_EXECUTABLE], ["perl"], [Command to run Perl]) + PERL_NATIVE=perl + AC_SUBST([PERL_NATIVE]) + ;; +*) + AC_DEFINE_UNQUOTED([PERL_EXECUTABLE], ["$PERL"], + [Location of the perl executable]) + ;; +esac + ### Checks for libraries. if test "$target_os" != "mingw32" -a "$target_os" != "winnt"; then Deleted: box/trunk/test/bbackupd/testfiles/bbackupd.conf =================================================================== --- box/trunk/test/bbackupd/testfiles/bbackupd.conf 2006-08-06 14:26:51 UTC (rev 717) +++ box/trunk/test/bbackupd/testfiles/bbackupd.conf 2006-08-07 20:53:12 UTC (rev 718) @@ -1,50 +0,0 @@ - -CertificateFile = testfiles/clientCerts.pem -PrivateKeyFile = testfiles/clientPrivKey.pem -TrustedCAsFile = testfiles/clientTrustedCAs.pem - -KeysFile = testfiles/bbackupd.keys - -DataDirectory = testfiles/bbackupd-data - -StoreHostname = localhost -AccountNumber = 0x01234567 - -UpdateStoreInterval = 3 -MinimumFileAge = 4 -MaxUploadWait = 24 - -FileTrackingSizeThreshold = 1024 -DiffingUploadSizeThreshold = 1024 - -MaximumDiffingTime = 8 - -ExtendedLogging = yes - -CommandSocket = testfiles/bbackupd.sock - -NotifyScript = @PERL@ testfiles/notifyscript.pl - -Server -{ - PidFile = testfiles/bbackupd.pid -} - -BackupLocations -{ - Test1 - { - Path = testfiles/TestDir1 - - ExcludeFile = testfiles/TestDir1/excluded_1 - ExcludeFile = testfiles/TestDir1/excluded_2 - ExcludeFilesRegex = \.excludethis$ - ExcludeFilesRegex = EXCLUDE - AlwaysIncludeFile = testfiles/TestDir1/dont.excludethis - ExcludeDir = testfiles/TestDir1/exclude_dir - ExcludeDir = testfiles/TestDir1/exclude_dir_2 - ExcludeDirsRegex = not_this_dir - AlwaysIncludeDirsRegex = ALWAYSINCLUDE - } -} - Copied: box/trunk/test/bbackupd/testfiles/bbackupd.conf.in (from rev 717, box/trunk/test/bbackupd/testfiles/bbackupd.conf) =================================================================== --- box/trunk/test/bbackupd/testfiles/bbackupd.conf 2006-08-06 14:26:51 UTC (rev 717) +++ box/trunk/test/bbackupd/testfiles/bbackupd.conf.in 2006-08-07 20:53:12 UTC (rev 718) @@ -0,0 +1,50 @@ + +CertificateFile = testfiles/clientCerts.pem +PrivateKeyFile = testfiles/clientPrivKey.pem +TrustedCAsFile = testfiles/clientTrustedCAs.pem + +KeysFile = testfiles/bbackupd.keys + +DataDirectory = testfiles/bbackupd-data + +StoreHostname = localhost +AccountNumber = 0x01234567 + +UpdateStoreInterval = 3 +MinimumFileAge = 4 +MaxUploadWait = 24 + +FileTrackingSizeThreshold = 1024 +DiffingUploadSizeThreshold = 1024 + +MaximumDiffingTime = 8 + +ExtendedLogging = yes + +CommandSocket = testfiles/bbackupd.sock + +NotifyScript = @PERL_NATIVE@ testfiles/notifyscript.pl + +Server +{ + PidFile = testfiles/bbackupd.pid +} + +BackupLocations +{ + Test1 + { + Path = testfiles/TestDir1 + + ExcludeFile = testfiles/TestDir1/excluded_1 + ExcludeFile = testfiles/TestDir1/excluded_2 + ExcludeFilesRegex = \.excludethis$ + ExcludeFilesRegex = EXCLUDE + AlwaysIncludeFile = testfiles/TestDir1/dont.excludethis + ExcludeDir = testfiles/TestDir1/exclude_dir + ExcludeDir = testfiles/TestDir1/exclude_dir_2 + ExcludeDirsRegex = not_this_dir + AlwaysIncludeDirsRegex = ALWAYSINCLUDE + } +} + From boxbackup-dev at fluffy.co.uk Mon Aug 7 22:02:14 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Mon, 7 Aug 2006 22:02:14 +0100 (BST) Subject: [Box Backup-dev] [PATCH] Win32 merge [01] bbackupd.conf In-Reply-To: <20060807121538.rlyrajzascgwgcss@ebourne.me.uk> References: <20060807121538.rlyrajzascgwgcss@ebourne.me.uk> Message-ID: Hi Martin, On Mon, 7 Aug 2006, Martin Ebourne wrote: > Chris Wilson wrote: >> In the recent changes to auto-generating Perl files, it seems that an >> @PERL@ template was inserted into a unit test configuration file, which >> is not auto-generated as far as I can tell. This breaks the unit tests. >> The attached patch should fix it as long as perl is on your PATH. > > I'm replying to the original patch emails but reviewing the patches as they > currently stand in the chris/merge tree. eg. For this one the final solution > was quite different. [...] > This one is good to merge. [And this is so obviously right I don't think you > need to wait for Ben - always good to start with a rule and then break it > immediately. :-)] OK, merged. (I hope this is what you reviewed :-) Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Mon Aug 7 21:56:23 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Mon, 7 Aug 2006 20:56:23 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r719 - box/chris/merge/infrastructure Message-ID: <20060807205623.CB72696@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-07 20:56:23 +0000 (Mon, 07 Aug 2006) New Revision: 719 Modified: box/chris/merge/infrastructure/BoxPlatform.pm.in Log: * BoxPlatform.pm.in - Removed $build_cpu and `uname -p` entirely, as they are not used anywhere Modified: box/chris/merge/infrastructure/BoxPlatform.pm.in =================================================================== --- box/chris/merge/infrastructure/BoxPlatform.pm.in 2006-08-07 20:53:12 UTC (rev 718) +++ box/chris/merge/infrastructure/BoxPlatform.pm.in 2006-08-07 20:56:23 UTC (rev 719) @@ -1,7 +1,7 @@ package BoxPlatform; use Exporter; @ISA = qw/Exporter/; - at EXPORT = qw/$build_os $build_cpu $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 update_if_changed/; + at EXPORT = qw/$build_os $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 update_if_changed/; BEGIN { @@ -15,14 +15,11 @@ if ($^O eq "MSWin32" and not -x "/usr/bin/uname") { $build_os = "winnt"; - $build_cpu = "ix86"; } else { $build_os = `uname`; chomp $build_os; - $build_cpu = `uname -m`; - chomp $build_cpu; } # Cygwin Builds usually something like CYGWIN_NT-5.0, CYGWIN_NT-5.1 From boxbackup-dev at fluffy.co.uk Mon Aug 7 22:15:24 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Mon, 7 Aug 2006 22:15:24 +0100 (BST) Subject: [Box Backup-dev] [PATCH] Win32 merge [02] BoxPlatform.pm and uname -p In-Reply-To: <20060807122101.ziiau779c0o8wswk@ebourne.me.uk> References: <20060807122101.ziiau779c0o8wswk@ebourne.me.uk> Message-ID: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---128931150-1182473555-1154985324=:28495 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Hi all, On Mon, 7 Aug 2006, Martin Ebourne wrote: > Chris Wilson wrote: >> It seems that "uname -p", as used in BoxPlatform.pm.in, is not very >> portable. I'm not even sure what $build_cpu is used for, if anything, >> but "uname -m" should work better than "uname -p". [...] > Box isn't using the result of build_cpu so it doesn't matter a jot. > My guess is that it was used before autoconf (eg. I think for endianness - > which is generally a processor not architecture thing except on ppc) and it > was something I missed in the cleanup. > > So no to this version of the patch, please remove that code entirely. Please review the attached patch. I have verified that $build_cpu is not used in any Perl script. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | ---128931150-1182473555-1154985324=:28495 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=bb-win32-merge-02-uname-p-v2.patch Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=bb-win32-merge-02-uname-p-v2.patch SW5kZXg6IGluZnJhc3RydWN0dXJlL0JveFBsYXRmb3JtLnBtLmluDQo9PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09DQotLS0gaW5mcmFzdHJ1Y3R1cmUvQm94UGxh dGZvcm0ucG0uaW4JKHJldmlzaW9uIDcxNykNCisrKyBpbmZyYXN0cnVjdHVy ZS9Cb3hQbGF0Zm9ybS5wbS5pbgkod29ya2luZyBjb3B5KQ0KQEAgLTEsNyAr MSw3IEBADQogcGFja2FnZSBCb3hQbGF0Zm9ybTsNCiB1c2UgRXhwb3J0ZXI7 DQogQElTQSA9IHF3L0V4cG9ydGVyLzsNCi1ARVhQT1JUID0gcXcvJGJ1aWxk X29zICRidWlsZF9jcHUgJHRhcmdldF9vcyAkbWFrZV9jb21tYW5kICRic2Rf bWFrZSAkcGxhdGZvcm1fZGVmaW5lICRwbGF0Zm9ybV9jcHUgJGdjY192MyAk cHJvZHVjdF92ZXJzaW9uICRwcm9kdWN0X25hbWUgJGluc3RhbGxfaW50b19k aXIgJHN1Yl9tYWtlX29wdGlvbnMgJHBsYXRmb3JtX2NvbXBpbGVfbGluZV9l eHRyYSAkcGxhdGZvcm1fbGlua19saW5lX2V4dHJhICRwbGF0Zm9ybV9saWJf ZmlsZXMgJHBsYXRmb3JtX2V4ZV9leHQvOw0KK0BFWFBPUlQgPSBxdy8kYnVp bGRfb3MgJHRhcmdldF9vcyAkbWFrZV9jb21tYW5kICRic2RfbWFrZSAkcGxh dGZvcm1fZGVmaW5lICRwbGF0Zm9ybV9jcHUgJGdjY192MyAkcHJvZHVjdF92 ZXJzaW9uICRwcm9kdWN0X25hbWUgJGluc3RhbGxfaW50b19kaXIgJHN1Yl9t YWtlX29wdGlvbnMgJHBsYXRmb3JtX2NvbXBpbGVfbGluZV9leHRyYSAkcGxh dGZvcm1fbGlua19saW5lX2V4dHJhICRwbGF0Zm9ybV9saWJfZmlsZXMgJHBs YXRmb3JtX2V4ZV9leHQvOw0KIA0KIEJFR0lODQogew0KQEAgLTksMTEgKzks OSBAQA0KIAkjIHdoaWNoIE9TIGFyZSB3ZSBidWlsZGluZyB1bmRlcj8NCiAJ JGJ1aWxkX29zID0gYHVuYW1lYDsNCiAJY2hvbXAgJGJ1aWxkX29zOw0KLQkk YnVpbGRfY3B1ID0gYHVuYW1lIC1wYDsNCi0JY2hvbXAgJGJ1aWxkX2NwdTsN CisNCiAJIyBDeWd3aW4gQnVpbGRzIHVzdWFsbHkgc29tZXRoaW5nIGxpa2Ug Q1lHV0lOX05ULTUuMCwgQ1lHV0lOX05ULTUuMQ0KIAkjIEJveCBCYWNrdXAg dHJpZWQgb24gV2luMjAwMCxYUCBvbmx5IDopDQotDQogCSRidWlsZF9vcyA9 ICdDWUdXSU4nIGlmICRidWlsZF9vcyA9fiBtL0NZR1dJTi87DQogDQogCSRt YWtlX2NvbW1hbmQgPSAoJGJ1aWxkX29zIGVxICdEYXJ3aW4nKSA/ICdic2Rt YWtlJyA6ICgkYnVpbGRfb3MgZXEgJ1N1bk9TJykgPyAnZ21ha2UnIDogJ21h a2UnOw0K ---128931150-1182473555-1154985324=:28495-- From boxbackup-dev at fluffy.co.uk Mon Aug 7 22:22:22 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Mon, 07 Aug 2006 22:22:22 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [01] bbackupd.conf In-Reply-To: References: <20060807121538.rlyrajzascgwgcss@ebourne.me.uk> Message-ID: <1154985742.25886.4.camel@avenin.ebourne.me.uk> On Mon, 2006-08-07 at 22:02 +0100, Chris Wilson wrote: > Hi Martin, > > On Mon, 7 Aug 2006, Martin Ebourne wrote: > > Chris Wilson wrote: > >> In the recent changes to auto-generating Perl files, it seems that an > >> @PERL@ template was inserted into a unit test configuration file, which > >> is not auto-generated as far as I can tell. This breaks the unit tests. > >> The attached patch should fix it as long as perl is on your PATH. > > > > I'm replying to the original patch emails but reviewing the patches as they > > currently stand in the chris/merge tree. eg. For this one the final solution > > was quite different. > [...] > > This one is good to merge. [And this is so obviously right I don't think you > > need to wait for Ben - always good to start with a rule and then break it > > immediately. :-)] > > OK, merged. (I hope this is what you reviewed :-) Er, no actually it's not! I'm a bit confused. I reviewed what was in the chris/merge branch as I thought you requested. The related change in that appeared to be rename bbackupd.conf to bbackupd.conf.in and apply this patch: --- trunk/configure.ac 2006-08-07 22:14:16.000000000 +0100 +++ merge/configure.ac 2006-08-07 22:12:26.000000000 +0100 @@ -220,6 +221,7 @@ lib/server/makeprotocol.pl runtest.pl test/backupstorefix/testfiles/testbackupstorefix.pl + test/bbackupd/testfiles/bbackupd.conf test/bbackupd/testfiles/extcheck1.pl test/bbackupd/testfiles/extcheck2.pl test/bbackupd/testfiles/notifyscript.pl]) I can see how that works and fixes it. I don't see how the change you've commited fixes it though, you've not even added bbackupd.conf to the list of files to substitute. And what you have committed doesn't match what's in your merge branch. Not sure what PERL_NATIVE is in aid of either. Can you explain it a bit? Is the idea for mingw that the compile and unit tests take place under unix (hence the native perl) but the exe & other scripts run under windows? Cheers, Martin. From boxbackup-dev at fluffy.co.uk Mon Aug 7 22:24:36 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Mon, 07 Aug 2006 22:24:36 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [02] BoxPlatform.pm and uname -p In-Reply-To: References: <20060807122101.ziiau779c0o8wswk@ebourne.me.uk> Message-ID: <1154985876.25886.6.camel@avenin.ebourne.me.uk> On Mon, 2006-08-07 at 22:15 +0100, Chris Wilson wrote: > Please review the attached patch. I have verified that $build_cpu is not > used in any Perl script. Yep, that's great thanks! Martin. From boxbackup-dev at fluffy.co.uk Mon Aug 7 22:28:10 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Mon, 7 Aug 2006 22:28:10 +0100 (BST) Subject: [Box Backup-dev] [PATCH] Win32 merge [01] bbackupd.conf In-Reply-To: <1154985742.25886.4.camel@avenin.ebourne.me.uk> References: <20060807121538.rlyrajzascgwgcss@ebourne.me.uk> <1154985742.25886.4.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, On Mon, 7 Aug 2006, Martin Ebourne wrote: >> OK, merged. (I hope this is what you reviewed :-) > > Er, no actually it's not! > > I'm a bit confused. I reviewed what was in the chris/merge branch as I > thought you requested. OK, sorry, I misunderstood. > The related change in that appeared to be rename > bbackupd.conf to bbackupd.conf.in and apply this patch: > > --- trunk/configure.ac 2006-08-07 22:14:16.000000000 +0100 > +++ merge/configure.ac 2006-08-07 22:12:26.000000000 +0100 > @@ -220,6 +221,7 @@ > lib/server/makeprotocol.pl > runtest.pl > test/backupstorefix/testfiles/testbackupstorefix.pl > + test/bbackupd/testfiles/bbackupd.conf > test/bbackupd/testfiles/extcheck1.pl > test/bbackupd/testfiles/extcheck2.pl > test/bbackupd/testfiles/notifyscript.pl]) > > I can see how that works and fixes it. I don't see how the change you've > commited fixes it though, you've not even added bbackupd.conf to the > list of files to substitute. Sorry, I missed that bit. > And what you have committed doesn't match what's in your merge branch. No, you're right, I'll revert it. > Not sure what PERL_NATIVE is in aid of either. Can you explain it a bit? > Is the idea for mingw that the compile and unit tests take place under > unix (hence the native perl) but the exe & other scripts run under > windows? Yes. bbackupd is a native process, and it needs to find a native Perl using a native path when calling the notify script. But in all other places, we are running under Cygwin, so we need a Unix path to a Cygwin Perl. I'll commit the change in "chris/merge" and we can discuss the PERL_NATIVE change separately. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Mon Aug 7 22:22:19 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Mon, 7 Aug 2006 21:22:19 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r720 - in box/trunk: . test/bbackupd/testfiles Message-ID: <20060807212219.96E9796@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-07 21:22:15 +0000 (Mon, 07 Aug 2006) New Revision: 720 Added: box/trunk/test/bbackupd/testfiles/bbackupd.conf Removed: box/trunk/test/bbackupd/testfiles/bbackupd.conf.in Modified: box/trunk/configure.ac Log: * test/bbackupd/testfiles/bbackupd.conf * test/bbackupd/testfiles/bbackupd.conf.in * configure.ac - Reverted rev 718 Modified: box/trunk/configure.ac =================================================================== --- box/trunk/configure.ac 2006-08-07 20:56:23 UTC (rev 719) +++ box/trunk/configure.ac 2006-08-07 21:22:15 UTC (rev 720) @@ -26,21 +26,14 @@ # Use -rdynamic if we have gcc. This is needed for backtrace AC_SUBST([LDADD_RDYNAMIC], ['-rdynamic']) fi +AC_PATH_PROG([PERL], [perl], [no]) +if test "x$PERL" != "xno"; then + AC_DEFINE_UNQUOTED([PERL_EXECUTABLE], ["$PERL"], [Location of the perl executable]) +else + AC_MSG_ERROR([[perl executable was not found]]) +fi -AC_PATH_PROG([PERL], [perl], [AC_MSG_ERROR([[perl executable was not found]])]) -case $target_os in -mingw*) - AC_DEFINE_UNQUOTED([PERL_EXECUTABLE], ["perl"], [Command to run Perl]) - PERL_NATIVE=perl - AC_SUBST([PERL_NATIVE]) - ;; -*) - AC_DEFINE_UNQUOTED([PERL_EXECUTABLE], ["$PERL"], - [Location of the perl executable]) - ;; -esac - ### Checks for libraries. if test "$target_os" != "mingw32" -a "$target_os" != "winnt"; then Copied: box/trunk/test/bbackupd/testfiles/bbackupd.conf (from rev 717, box/trunk/test/bbackupd/testfiles/bbackupd.conf) Property changes on: box/trunk/test/bbackupd/testfiles/bbackupd.conf ___________________________________________________________________ Name: svn:eol-style + native Deleted: box/trunk/test/bbackupd/testfiles/bbackupd.conf.in =================================================================== --- box/trunk/test/bbackupd/testfiles/bbackupd.conf.in 2006-08-07 20:56:23 UTC (rev 719) +++ box/trunk/test/bbackupd/testfiles/bbackupd.conf.in 2006-08-07 21:22:15 UTC (rev 720) @@ -1,50 +0,0 @@ - -CertificateFile = testfiles/clientCerts.pem -PrivateKeyFile = testfiles/clientPrivKey.pem -TrustedCAsFile = testfiles/clientTrustedCAs.pem - -KeysFile = testfiles/bbackupd.keys - -DataDirectory = testfiles/bbackupd-data - -StoreHostname = localhost -AccountNumber = 0x01234567 - -UpdateStoreInterval = 3 -MinimumFileAge = 4 -MaxUploadWait = 24 - -FileTrackingSizeThreshold = 1024 -DiffingUploadSizeThreshold = 1024 - -MaximumDiffingTime = 8 - -ExtendedLogging = yes - -CommandSocket = testfiles/bbackupd.sock - -NotifyScript = @PERL_NATIVE@ testfiles/notifyscript.pl - -Server -{ - PidFile = testfiles/bbackupd.pid -} - -BackupLocations -{ - Test1 - { - Path = testfiles/TestDir1 - - ExcludeFile = testfiles/TestDir1/excluded_1 - ExcludeFile = testfiles/TestDir1/excluded_2 - ExcludeFilesRegex = \.excludethis$ - ExcludeFilesRegex = EXCLUDE - AlwaysIncludeFile = testfiles/TestDir1/dont.excludethis - ExcludeDir = testfiles/TestDir1/exclude_dir - ExcludeDir = testfiles/TestDir1/exclude_dir_2 - ExcludeDirsRegex = not_this_dir - AlwaysIncludeDirsRegex = ALWAYSINCLUDE - } -} - From boxbackup-dev at fluffy.co.uk Mon Aug 7 22:24:53 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Mon, 7 Aug 2006 21:24:53 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r721 - in box/trunk: . test/bbackupd/testfiles Message-ID: <20060807212453.5A6C096@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-07 21:24:50 +0000 (Mon, 07 Aug 2006) New Revision: 721 Added: box/trunk/test/bbackupd/testfiles/bbackupd.conf.in Removed: box/trunk/test/bbackupd/testfiles/bbackupd.conf Modified: box/trunk/configure.ac Log: * test/bbackupd/testfiles/bbackupd.conf * test/bbackupd/testfiles/bbackupd.conf.in * configure.ac - Merged the change in chris/merge: - Auto-generate test/bbackupd/testfiles/bbackupd.conf, since it requires @PERL@ to be substituted Modified: box/trunk/configure.ac =================================================================== --- box/trunk/configure.ac 2006-08-07 21:22:15 UTC (rev 720) +++ box/trunk/configure.ac 2006-08-07 21:24:50 UTC (rev 721) @@ -220,6 +220,7 @@ lib/server/makeprotocol.pl runtest.pl test/backupstorefix/testfiles/testbackupstorefix.pl + test/bbackupd/testfiles/bbackupd.conf test/bbackupd/testfiles/extcheck1.pl test/bbackupd/testfiles/extcheck2.pl test/bbackupd/testfiles/notifyscript.pl]) Deleted: box/trunk/test/bbackupd/testfiles/bbackupd.conf =================================================================== --- box/trunk/test/bbackupd/testfiles/bbackupd.conf 2006-08-07 21:22:15 UTC (rev 720) +++ box/trunk/test/bbackupd/testfiles/bbackupd.conf 2006-08-07 21:24:50 UTC (rev 721) @@ -1,50 +0,0 @@ - -CertificateFile = testfiles/clientCerts.pem -PrivateKeyFile = testfiles/clientPrivKey.pem -TrustedCAsFile = testfiles/clientTrustedCAs.pem - -KeysFile = testfiles/bbackupd.keys - -DataDirectory = testfiles/bbackupd-data - -StoreHostname = localhost -AccountNumber = 0x01234567 - -UpdateStoreInterval = 3 -MinimumFileAge = 4 -MaxUploadWait = 24 - -FileTrackingSizeThreshold = 1024 -DiffingUploadSizeThreshold = 1024 - -MaximumDiffingTime = 8 - -ExtendedLogging = yes - -CommandSocket = testfiles/bbackupd.sock - -NotifyScript = @PERL@ testfiles/notifyscript.pl - -Server -{ - PidFile = testfiles/bbackupd.pid -} - -BackupLocations -{ - Test1 - { - Path = testfiles/TestDir1 - - ExcludeFile = testfiles/TestDir1/excluded_1 - ExcludeFile = testfiles/TestDir1/excluded_2 - ExcludeFilesRegex = \.excludethis$ - ExcludeFilesRegex = EXCLUDE - AlwaysIncludeFile = testfiles/TestDir1/dont.excludethis - ExcludeDir = testfiles/TestDir1/exclude_dir - ExcludeDir = testfiles/TestDir1/exclude_dir_2 - ExcludeDirsRegex = not_this_dir - AlwaysIncludeDirsRegex = ALWAYSINCLUDE - } -} - Copied: box/trunk/test/bbackupd/testfiles/bbackupd.conf.in (from rev 720, box/trunk/test/bbackupd/testfiles/bbackupd.conf) From boxbackup-dev at fluffy.co.uk Mon Aug 7 22:33:59 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Mon, 7 Aug 2006 22:33:59 +0100 (BST) Subject: [Box Backup-dev] [PATCH] Win32 merge [02] BoxPlatform.pm and uname -p In-Reply-To: <1154985876.25886.6.camel@avenin.ebourne.me.uk> References: <20060807122101.ziiau779c0o8wswk@ebourne.me.uk> <1154985876.25886.6.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, > On Mon, 2006-08-07 at 22:15 +0100, Chris Wilson wrote: >> Please review the attached patch. I have verified that $build_cpu is not >> used in any Perl script. > > Yep, that's great thanks! Should I wait for Ben to confirm, or go ahead and merge? Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Mon Aug 7 23:07:05 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Mon, 07 Aug 2006 23:07:05 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [02] BoxPlatform.pm and uname -p In-Reply-To: References: <20060807122101.ziiau779c0o8wswk@ebourne.me.uk> <1154985876.25886.6.camel@avenin.ebourne.me.uk> Message-ID: <1154988425.25886.8.camel@avenin.ebourne.me.uk> On Mon, 2006-08-07 at 22:33 +0100, Chris Wilson wrote: > Hi Martin, > > > On Mon, 2006-08-07 at 22:15 +0100, Chris Wilson wrote: > >> Please review the attached patch. I have verified that $build_cpu is not > >> used in any Perl script. > > > > Yep, that's great thanks! > > Should I wait for Ben to confirm, or go ahead and merge? Ben's opted out of the loop. Merge and be damned! Cheers, Martin. From boxbackup-dev at fluffy.co.uk Mon Aug 7 23:01:31 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Mon, 7 Aug 2006 22:01:31 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r722 - box/trunk/infrastructure Message-ID: <20060807220131.CE80096@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-07 22:01:26 +0000 (Mon, 07 Aug 2006) New Revision: 722 Modified: box/trunk/infrastructure/BoxPlatform.pm.in Log: * BoxPlatform.pm.in - $build_cpu is not used anywhere, and "uname -p" barfs on some platforms, removed. Modified: box/trunk/infrastructure/BoxPlatform.pm.in =================================================================== --- box/trunk/infrastructure/BoxPlatform.pm.in 2006-08-07 21:24:50 UTC (rev 721) +++ box/trunk/infrastructure/BoxPlatform.pm.in 2006-08-07 22:01:26 UTC (rev 722) @@ -1,7 +1,7 @@ package BoxPlatform; use Exporter; @ISA = qw/Exporter/; - at EXPORT = qw/$build_os $build_cpu $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/; + at EXPORT = qw/$build_os $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/; BEGIN { @@ -9,11 +9,9 @@ # which OS are we building under? $build_os = `uname`; chomp $build_os; - $build_cpu = `uname -p`; - chomp $build_cpu; + # Cygwin Builds usually something like CYGWIN_NT-5.0, CYGWIN_NT-5.1 # Box Backup tried on Win2000,XP only :) - $build_os = 'CYGWIN' if $build_os =~ m/CYGWIN/; $make_command = ($build_os eq 'Darwin') ? 'bsdmake' : ($build_os eq 'SunOS') ? 'gmake' : 'make'; From boxbackup-dev at fluffy.co.uk Mon Aug 7 23:10:10 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Mon, 7 Aug 2006 23:10:10 +0100 (BST) Subject: [Box Backup-dev] [PATCH] Win32 merge [02] BoxPlatform.pm and uname -p In-Reply-To: <1154988425.25886.8.camel@avenin.ebourne.me.uk> References: <20060807122101.ziiau779c0o8wswk@ebourne.me.uk> <1154985876.25886.6.camel@avenin.ebourne.me.uk> <1154988425.25886.8.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, >> Should I wait for Ben to confirm, or go ahead and merge? > > Ben's opted out of the loop. Merge and be damned! I'm used to that :-) Merged. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Mon Aug 7 23:34:14 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Mon, 7 Aug 2006 23:34:14 +0100 (BST) Subject: [Box Backup-dev] Reviewing code In-Reply-To: <44D7524A.3070003@invis.net> References: <20060807142001.amonlc4x0k00swo0@ebourne.me.uk> <44D7524A.3070003@invis.net> Message-ID: Hi Charles, On Mon, 7 Aug 2006, Charles Lecklider wrote: > 1) Understanding what bit does what. Probably slightly lower than a lot > of other bits of software in that the design seems sensible, and > mostly the comments are helpful. I'd be happy to comment to the best of my ability on any questions you raise about any part of the code. > 2) Source control. > > a) I want to work on the Win32 version. I've never managed to get trunk > to compile, and people's personal branches are, well, personal. There's > no "Win32-stable" branch I can see, so while I could create my own and > do some work, merging that back in would be no fun at all (as I'm sure > Chris will agree by the time his changes are done). You're welcome to start from my branch, and either send me patches, or make a copy and commit to it and I'll review the changes for inclusion in my branch. > b) TortoiseSVN is probably the least reliable bit of software I've used > for many years. I've just abandoned SVN on another project because > adding a file has about a 50/50 chance of trashing the local repository. > This pretty much rules out me creating my own branch. The svn command-line tools are pretty much guaranteed not to break your working copy, and they do run on Win32. If you want a graphical interface and don't mind a 20+MB download, try Eclipse + Subclipse. Otherwise, use whatever source control floats your boat, as long as it enables you to send patches to me or to the list. > 3) Compiling Box. It's obviously OK on the unix side, but if trunk is > anything to go by the Win32 side leaves a lot to be desired. I hope you will find that 0.10 release, trunk and chris/general all compile on Windows without Cygwin. If not, please let us know (although 0.10 is now frozen and will not be changed). > b) Not using VC2k5. Again, I think MinGW is trying to do > unix-on-Windows. Not exactly. gcc-on-Windows is not Unix-on-Windows. And I have no objections to you building releases with VS2k5, or Borland, or any other compiler that you choose. I do invest considerable time in making sure that my tree builds with VS2K5, and I'm very happy to accept patches and suggestions and to help users who have problems with it, to the best of my ability. > I can't live with any of (3). It's probably a good idea if Box continues > to be compilable with MinGW, but VC2k5 is what the Windows world uses. I > noticed some discussion about the licensing of the Express version not > allowing you to release a binary, but that's hardly an excuse not to use > it for development; all it takes is someone (e.g. me) with a full > version that's willing to produce release binaries. And you are welcome to do so. My binary builds are not blessed or special in any way, and I have no objection at all if you or anyone else wants to make binary builds with any other compiler and release them to the world. The fact that I personally use MinGW for distributable binary builds should not stop anyone from using any other compiler. The only thing that I will not be happy with is any attempt to stop me from using MinGW or to remove MinGW compatibility from Box. I absolutely require MinGW for Boxi, and if it's not allowed, then I will have to abandon work on Boxi, and therefore probably on Box Backup. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Mon Aug 7 23:48:06 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Mon, 07 Aug 2006 23:48:06 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [01] bbackupd.conf In-Reply-To: References: <20060807121538.rlyrajzascgwgcss@ebourne.me.uk> <1154985742.25886.4.camel@avenin.ebourne.me.uk> Message-ID: <1154990886.25886.30.camel@avenin.ebourne.me.uk> On Mon, 2006-08-07 at 22:28 +0100, Chris Wilson wrote: > OK, sorry, I misunderstood. No problem. > Yes. bbackupd is a native process, and it needs to find a native Perl > using a native path when calling the notify script. But in all other > places, we are running under Cygwin, so we need a Unix path to a Cygwin > Perl. Ok, I get it, I hadn't realised cygwin was involved. I've had another look at the mingw perl patch and I understand what you're doing now. What you're trying to achieve really is a cross compilation that just happens to be on the same machine. The standard nomenclature for a cross compilation scenario is as follows: BUILD - What you are building the package on HOST - What the package you are building will run on TARGET - If the package you are building generates code (ie. compiler), what the generated code should run on So for a normal program being cross compiled (like Box), BUILD is what you are compiling on (eg. i386-pc-cygwin) and HOST is where it will be run (eg. i386-pc-windows). I would find it easier to understand if all the build and test time uses of PERL were renamed BUILD_PERL and the few runtime ones were named HOST_PERL. I think that goes for the PERL_EXECUTABLE define in BoxConfig.h as well. I don't really see why that needs a different name to the one that is subst in the other files, and I could imagine one day that the C++ may even have use for both BUILD_PERL and HOST_PERL. I'd be interested in thoughts from others on this though, because some may find it confusing (especially anyone who's not cross compiled before I guess). Maybe BUILD_PERL and RUNTIME_PERL would be more widely understood? Also I'm curious as to whether the cross compilation features in autoconf could be employed to make the mingw build easier (ie. less special cases), though I don't think we should worry about that for now. As to the patch itself, the only thing I didn't really like was that you AC_DEFINE PERL_EXECUTABLE separately for each platform type. I'd prefer you just do that once, and the only conditional code is that which sets the values to something platform specific. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Mon Aug 7 23:42:19 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Mon, 7 Aug 2006 22:42:19 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r723 - box/chris/general/bin/bbackupctl Message-ID: <20060807224219.AECDE96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-07 22:42:18 +0000 (Mon, 07 Aug 2006) New Revision: 723 Modified: box/chris/general/bin/bbackupctl/bbackupctl.cpp Log: * bbackupctl.cpp - Changed code structure to be more readable and robust, following Martin's advice. Modified: box/chris/general/bin/bbackupctl/bbackupctl.cpp =================================================================== --- box/chris/general/bin/bbackupctl/bbackupctl.cpp 2006-08-07 22:01:26 UTC (rev 722) +++ box/chris/general/bin/bbackupctl/bbackupctl.cpp 2006-08-07 22:42:18 UTC (rev 723) @@ -28,6 +28,14 @@ #include "MemLeakFindOn.h" +enum Command +{ + Default, + WaitForSyncStart, + WaitForSyncEnd, + SyncAndWaitForEnd, +}; + void PrintUsageAndExit() { printf("Usage: bbackupctl [-q] [-c config_file] \n" @@ -221,112 +229,134 @@ return 1; } - // Is the command the "wait for sync to start" command? - bool areWaitingForSync = false; - bool areWaitingForSyncEnd = false; + Command command = Default; + std::string commandName(argv[0]); - if(::strcmp(argv[0], "wait-for-sync") == 0 || - ::strcmp(argv[0], "wait-for-end") == 0) + if (commandName == "wait-for-sync") { - // Check that it's not in non-automatic mode, - // because then it'll never start - if(!autoBackup) + command = WaitForSyncStart; + } + else if (commandName == "wait-for-end") + { + command = WaitForSyncEnd; + } + else if (commandName == "sync-and-wait") + { + command = SyncAndWaitForEnd; + } + + switch (command) + { + case WaitForSyncStart: + case WaitForSyncEnd: { - printf("ERROR: Daemon is not in automatic mode -- " - "sync will never start!\n"); - return 1; + // Check that it's not in non-automatic mode, + // because then it'll never start + + if(!autoBackup) + { + printf("ERROR: Daemon is not in automatic mode -- " + "sync will never start!\n"); + return 1; + } + } - - // Yes... set the flag so we know that - // we're waiting for a sync to start/end - if(::strcmp(argv[0], "wait-for-sync") == 0) + break; + + case SyncAndWaitForEnd: { - areWaitingForSync = true; + // send a sync command + std::string cmd("force-sync\n"); + connection.Write(cmd.c_str(), cmd.size()); + connection.WriteAllBuffered(); + + if (currentState != 0) + { + printf("Waiting for current sync/error state " + "to finish...\n"); + } } - else if (::strcmp(argv[0], "wait-for-end") == 0) - { - areWaitingForSyncEnd = true; - } - } - else if (::strcmp(argv[0], "sync-and-wait") == 0) - { - // send a sync command - std::string cmd("force-sync\n"); - connection.Write(cmd.c_str(), cmd.size()); - connection.WriteAllBuffered(); - areWaitingForSyncEnd = true; + break; - if (currentState != 0) + default: { - printf("Waiting for current sync/error state " - "to finish...\n"); + // Normal case, just send the command given + // plus a quit command. + std::string cmd = commandName; + cmd += "\nquit\n"; + connection.Write(cmd.c_str(), cmd.size()); } } - else - { - // No? Just send the command given plus a quit command. - std::string cmd(argv[0]); - cmd += "\nquit\n"; - connection.Write(cmd.c_str(), cmd.size()); - } // Read the response std::string line; bool syncIsRunning = false; + bool finished = false; - while(!getLine.IsEOF() && getLine.GetLine(line)) + while(!finished && !getLine.IsEOF() && getLine.GetLine(line)) { - if(areWaitingForSync) + switch (command) { - // Need to wait for the state change... - if(line == "start-sync") + case WaitForSyncStart: { - // Send a quit command to finish nicely - connection.Write("quit\n", 5); - - // And we're done - break; - } - } - else if(areWaitingForSyncEnd) - { - if(line == "start-sync") - { - if (!quiet) printf("Sync started...\n"); - syncIsRunning = true; + // Need to wait for the state change... + if(line == "start-sync") + { + // Send a quit command to finish nicely + connection.Write("quit\n", 5); + + // And we're done + finished = true; + } } - else if(line == "finish-sync" && syncIsRunning) + break; + + case WaitForSyncEnd: + case SyncAndWaitForEnd: { - if (!quiet) printf("Sync finished.\n"); - // Send a quit command to finish nicely - connection.Write("quit\n", 5); - - // And we're done - break; + if(line == "start-sync") + { + if (!quiet) printf("Sync started...\n"); + syncIsRunning = true; + } + else if(line == "finish-sync") + { + if (syncIsRunning) + { + if (!quiet) printf("Sync finished.\n"); + // Send a quit command to finish nicely + connection.Write("quit\n", 5); + + // And we're done + finished = true; + } + else + { + if (!quiet) printf("Previous sync finished.\n"); + } + // daemon must still be busy + } } - else if(line == "finish-sync") + break; + + default: { - if (!quiet) printf("Previous sync finished.\n"); - } - // daemon must still be busy - } - else - { - // Is this an OK or error line? - if(line == "ok") - { - if(!quiet) + // Is this an OK or error line? + if(line == "ok") { - printf("Succeeded.\n"); + if(!quiet) + { + printf("Succeeded.\n"); + } + finished = true; } - break; + else if(line == "error") + { + printf("ERROR. (Check command spelling)\n"); + returnCode = 1; + finished = true; + } } - else if(line == "error") - { - printf("ERROR. (Check command spelling)\n"); - returnCode = 1; - break; - } } } From boxbackup-dev at fluffy.co.uk Mon Aug 7 23:43:45 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Mon, 7 Aug 2006 22:43:45 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r724 - box/chris/merge/bin/bbackupctl Message-ID: <20060807224345.D93D796@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-07 22:43:43 +0000 (Mon, 07 Aug 2006) New Revision: 724 Modified: box/chris/merge/bin/bbackupctl/bbackupctl.cpp Log: * bbackupctl.cpp - Revert all changes back to trunk state Modified: box/chris/merge/bin/bbackupctl/bbackupctl.cpp =================================================================== --- box/chris/merge/bin/bbackupctl/bbackupctl.cpp 2006-08-07 22:42:18 UTC (rev 723) +++ box/chris/merge/bin/bbackupctl/bbackupctl.cpp 2006-08-07 22:43:43 UTC (rev 724) @@ -32,14 +32,12 @@ { printf("Usage: bbackupctl [-q] [-c config_file] \n" "Commands are:\n" - " sync -- start a synchronisation (backup) run now\n" - " force-sync -- force the start of a synchronisation run, " + " sync -- start a syncronisation run now\n" + " force-sync -- force the start of a syncronisation run, " "even if SyncAllowScript says no\n" " reload -- reload daemon configuration\n" " terminate -- terminate daemon now\n" " wait-for-sync -- wait until the next sync starts, then exit\n" - " wait-for-end -- wait until the next sync finishes, then exit\n" - " sync-and-wait -- start sync, wait until it finishes, then exit\n" ); exit(1); } @@ -109,10 +107,7 @@ // Check there's a socket defined in the config file if(!conf.KeyExists("CommandSocket")) { - printf("Daemon isn't using a control socket, " - "could not execute command.\n" - "Add a CommandSocket declaration to the " - "bbackupd.conf file.\n"); + printf("Daemon isn't using a control socket, could not execute command.\nAdd a CommandSocket declaration to the bbackupd.conf file.\n"); return 1; } @@ -193,75 +188,28 @@ // Print summary? if(!quiet) { - printf("Daemon configuration summary:\n" - " AutomaticBackup = %s\n" - " UpdateStoreInterval = %d seconds\n" - " MinimumFileAge = %d seconds\n" - " MaxUploadWait = %d seconds\n", - autoBackup?"true":"false", updateStoreInterval, - minimumFileAge, maxUploadWait); + printf("Daemon configuration summary:\n" \ + " AutomaticBackup = %s\n" \ + " UpdateStoreInterval = %d seconds\n" \ + " MinimumFileAge = %d seconds\n" \ + " MaxUploadWait = %d seconds\n", + autoBackup?"true":"false", updateStoreInterval, minimumFileAge, maxUploadWait); } - std::string stateLine; - if(!getLine.GetLine(stateLine) || getLine.IsEOF()) - { -#if defined WIN32 && ! defined NDEBUG - syslog(LOG_ERR, "Failed to receive state line from daemon"); -#else - printf("Failed to receive state line from daemon\n"); -#endif - return 1; - } - - // Decode it - int currentState; - if(::sscanf(stateLine.c_str(), "state %d", ¤tState) != 1) - { - printf("State line didn't decode\n"); - return 1; - } - // Is the command the "wait for sync to start" command? bool areWaitingForSync = false; - bool areWaitingForSyncEnd = false; - - if(::strcmp(argv[0], "wait-for-sync") == 0 || - ::strcmp(argv[0], "wait-for-end") == 0) + if(::strcmp(argv[0], "wait-for-sync") == 0) { - // Check that it's not in non-automatic mode, - // because then it'll never start + // Check that it's not in non-automatic mode, because then it'll never start if(!autoBackup) { - printf("ERROR: Daemon is not in automatic mode -- " - "sync will never start!\n"); + printf("ERROR: Daemon is not in automatic mode -- sync will never start!\n"); return 1; } - // Yes... set the flag so we know that - // we're waiting for a sync to start/end - if(::strcmp(argv[0], "wait-for-sync") == 0) - { - areWaitingForSync = true; - } - else if (::strcmp(argv[0], "wait-for-end") == 0) - { - areWaitingForSyncEnd = true; - } + // Yes... set the flag so we know what we're waiting for a sync to start + areWaitingForSync = true; } - else if (::strcmp(argv[0], "sync-and-wait") == 0) - { - // send a sync command - std::string cmd("force-sync\n"); - connection.Write(cmd.c_str(), cmd.size()); - connection.WriteAllBuffered(); - areWaitingForSyncEnd = true; - - if (currentState != 0) - { - printf("Waiting for current sync/error state " - "to finish...\n"); - } - } else { // No? Just send the command given plus a quit command. @@ -272,8 +220,6 @@ // Read the response std::string line; - bool syncIsRunning = false; - while(!getLine.IsEOF() && getLine.GetLine(line)) { if(areWaitingForSync) @@ -288,28 +234,6 @@ break; } } - else if(areWaitingForSyncEnd) - { - if(line == "start-sync") - { - if (!quiet) printf("Sync started...\n"); - syncIsRunning = true; - } - else if(line == "finish-sync" && syncIsRunning) - { - if (!quiet) printf("Sync finished.\n"); - // Send a quit command to finish nicely - connection.Write("quit\n", 5); - - // And we're done - break; - } - else if(line == "finish-sync") - { - if (!quiet) printf("Previous sync finished.\n"); - } - // daemon must still be busy - } else { // Is this an OK or error line? From boxbackup-dev at fluffy.co.uk Mon Aug 7 23:46:51 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Mon, 7 Aug 2006 22:46:51 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r725 - box/chris/merge/bin/bbackupctl Message-ID: <20060807224651.531BC96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-07 22:46:35 +0000 (Mon, 07 Aug 2006) New Revision: 725 Modified: box/chris/merge/bin/bbackupctl/bbackupctl.cpp Log: * bin/bbackupctl/bbackupctl.cpp - Changed code structure to be more readable and robust, following Martin's advice. Modified: box/chris/merge/bin/bbackupctl/bbackupctl.cpp =================================================================== --- box/chris/merge/bin/bbackupctl/bbackupctl.cpp 2006-08-07 22:43:43 UTC (rev 724) +++ box/chris/merge/bin/bbackupctl/bbackupctl.cpp 2006-08-07 22:46:35 UTC (rev 725) @@ -28,16 +28,26 @@ #include "MemLeakFindOn.h" +enum Command +{ + Default, + WaitForSyncStart, + WaitForSyncEnd, + SyncAndWaitForEnd, +}; + void PrintUsageAndExit() { printf("Usage: bbackupctl [-q] [-c config_file] \n" "Commands are:\n" - " sync -- start a syncronisation run now\n" - " force-sync -- force the start of a syncronisation run, " + " sync -- start a synchronisation (backup) run now\n" + " force-sync -- force the start of a synchronisation run, " "even if SyncAllowScript says no\n" " reload -- reload daemon configuration\n" " terminate -- terminate daemon now\n" " wait-for-sync -- wait until the next sync starts, then exit\n" + " wait-for-end -- wait until the next sync finishes, then exit\n" + " sync-and-wait -- start sync, wait until it finishes, then exit\n" ); exit(1); } @@ -107,7 +117,10 @@ // Check there's a socket defined in the config file if(!conf.KeyExists("CommandSocket")) { - printf("Daemon isn't using a control socket, could not execute command.\nAdd a CommandSocket declaration to the bbackupd.conf file.\n"); + printf("Daemon isn't using a control socket, " + "could not execute command.\n" + "Add a CommandSocket declaration to the " + "bbackupd.conf file.\n"); return 1; } @@ -188,68 +201,161 @@ // Print summary? if(!quiet) { - printf("Daemon configuration summary:\n" \ - " AutomaticBackup = %s\n" \ - " UpdateStoreInterval = %d seconds\n" \ - " MinimumFileAge = %d seconds\n" \ - " MaxUploadWait = %d seconds\n", - autoBackup?"true":"false", updateStoreInterval, minimumFileAge, maxUploadWait); + printf("Daemon configuration summary:\n" + " AutomaticBackup = %s\n" + " UpdateStoreInterval = %d seconds\n" + " MinimumFileAge = %d seconds\n" + " MaxUploadWait = %d seconds\n", + autoBackup?"true":"false", updateStoreInterval, + minimumFileAge, maxUploadWait); } - // Is the command the "wait for sync to start" command? - bool areWaitingForSync = false; - if(::strcmp(argv[0], "wait-for-sync") == 0) + std::string stateLine; + if(!getLine.GetLine(stateLine) || getLine.IsEOF()) { - // Check that it's not in non-automatic mode, because then it'll never start - if(!autoBackup) +#if defined WIN32 && ! defined NDEBUG + syslog(LOG_ERR, "Failed to receive state line from daemon"); +#else + printf("Failed to receive state line from daemon\n"); +#endif + return 1; + } + + // Decode it + int currentState; + if(::sscanf(stateLine.c_str(), "state %d", ¤tState) != 1) + { + printf("State line didn't decode\n"); + return 1; + } + + Command command = Default; + std::string commandName(argv[0]); + + if (commandName == "wait-for-sync") + { + command = WaitForSyncStart; + } + else if (commandName == "wait-for-end") + { + command = WaitForSyncEnd; + } + else if (commandName == "sync-and-wait") + { + command = SyncAndWaitForEnd; + } + + switch (command) + { + case WaitForSyncStart: + case WaitForSyncEnd: { - printf("ERROR: Daemon is not in automatic mode -- sync will never start!\n"); - return 1; + // Check that it's not in non-automatic mode, + // because then it'll never start + + if(!autoBackup) + { + printf("ERROR: Daemon is not in automatic mode -- " + "sync will never start!\n"); + return 1; + } + } - - // Yes... set the flag so we know what we're waiting for a sync to start - areWaitingForSync = true; + break; + + case SyncAndWaitForEnd: + { + // send a sync command + std::string cmd("force-sync\n"); + connection.Write(cmd.c_str(), cmd.size()); + connection.WriteAllBuffered(); + + if (currentState != 0) + { + printf("Waiting for current sync/error state " + "to finish...\n"); + } + } + break; + + default: + { + // Normal case, just send the command given + // plus a quit command. + std::string cmd = commandName; + cmd += "\nquit\n"; + connection.Write(cmd.c_str(), cmd.size()); + } } - else - { - // No? Just send the command given plus a quit command. - std::string cmd(argv[0]); - cmd += "\nquit\n"; - connection.Write(cmd.c_str(), cmd.size()); - } // Read the response std::string line; - while(!getLine.IsEOF() && getLine.GetLine(line)) + bool syncIsRunning = false; + bool finished = false; + + while(!finished && !getLine.IsEOF() && getLine.GetLine(line)) { - if(areWaitingForSync) + switch (command) { - // Need to wait for the state change... - if(line == "start-sync") + case WaitForSyncStart: { - // Send a quit command to finish nicely - connection.Write("quit\n", 5); - - // And we're done - break; - } - } - else - { - // Is this an OK or error line? - if(line == "ok") + // Need to wait for the state change... + if(line == "start-sync") + { + // Send a quit command to finish nicely + connection.Write("quit\n", 5); + + // And we're done + finished = true; + } + } + break; + + case WaitForSyncEnd: + case SyncAndWaitForEnd: { - if(!quiet) + if(line == "start-sync") { - printf("Succeeded.\n"); + if (!quiet) printf("Sync started...\n"); + syncIsRunning = true; } - break; + else if(line == "finish-sync") + { + if (syncIsRunning) + { + if (!quiet) printf("Sync finished.\n"); + // Send a quit command to finish nicely + connection.Write("quit\n", 5); + + // And we're done + finished = true; + } + else + { + if (!quiet) printf("Previous sync finished.\n"); + } + // daemon must still be busy + } } - else if(line == "error") + break; + + default: { - printf("ERROR. (Check command spelling)\n"); - returnCode = 1; - break; + // Is this an OK or error line? + if(line == "ok") + { + if(!quiet) + { + printf("Succeeded.\n"); + } + finished = true; + } + else if(line == "error") + { + printf("ERROR. (Check command spelling)\n"); + returnCode = 1; + finished = true; + } } } } From boxbackup-dev at fluffy.co.uk Tue Aug 8 00:07:41 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Tue, 8 Aug 2006 00:07:41 +0100 (BST) Subject: [Box Backup-dev] [PATCH] Win32 merge [03] Additional commands for bbackupctl In-Reply-To: <20060807132722.uckkh0fi0wccwksg@ebourne.me.uk> References: <20060807132722.uckkh0fi0wccwksg@ebourne.me.uk> Message-ID: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---128931150-28992530-1154992061=:28495 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Hi all, On Mon, 7 Aug 2006, Martin Ebourne wrote: > There's beginning to be quite a confusing array of commands in > bbackupctl now. I wonder if some of them could be rationalised to make > it simpler? > > The command execution code is something of an ifelse mess at the moment. > The last loop has essentially no shared code between the commands. It > would be a lot better to implement each of these commands in a separate > function and call that instead. You didn't start the code down this > route, so I'm not blaming you! [...] > At the very least the original boolean state flag (areWaitingForSync) > should have been replaced by an enum for command and the if further down > replaced by a switch though. This comparing twice for the same string is > bad and should be avoided. Not for efficiency here but for consistency. > If those strings ever manage to differ then that will be hard to debug. [...] > Something along the lines of the following would be better if separate > functions were not used (I'm not attempting to indent this properly in the > email program): [...] I've rewritten the code according to Martin's suppgestions. Please review the following patch for merge to trunk (bbackupd tests pass on Win32): svn diff -r 724:725 http://bbdev.fluffy.co.uk/svn/box/chris/merge (also attached for convenience). Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | ---128931150-28992530-1154992061=:28495 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=bb-win32-merge-3-bbackupctl-commands-v2.patch Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=bb-win32-merge-3-bbackupctl-commands-v2.patch SW5kZXg6IGJpbi9iYmFja3VwY3RsL2JiYWNrdXBjdGwuY3BwDQo9PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09DQotLS0gYmluL2JiYWNrdXBjdGwvYmJhY2t1cGN0 bC5jcHAJKHJldmlzaW9uIDcyNCkNCisrKyBiaW4vYmJhY2t1cGN0bC9iYmFj a3VwY3RsLmNwcAkocmV2aXNpb24gNzI1KQ0KQEAgLTI4LDE2ICsyOCwyNiBA QA0KIA0KICNpbmNsdWRlICJNZW1MZWFrRmluZE9uLmgiDQogDQorZW51bSBD b21tYW5kDQorew0KKwlEZWZhdWx0LA0KKwlXYWl0Rm9yU3luY1N0YXJ0LA0K KwlXYWl0Rm9yU3luY0VuZCwNCisJU3luY0FuZFdhaXRGb3JFbmQsDQorfTsN CisNCiB2b2lkIFByaW50VXNhZ2VBbmRFeGl0KCkNCiB7DQogCXByaW50Zigi VXNhZ2U6IGJiYWNrdXBjdGwgWy1xXSBbLWMgY29uZmlnX2ZpbGVdIDxjb21t YW5kPlxuIg0KIAkiQ29tbWFuZHMgYXJlOlxuIg0KLQkiICBzeW5jIC0tIHN0 YXJ0IGEgc3luY3JvbmlzYXRpb24gcnVuIG5vd1xuIg0KLQkiICBmb3JjZS1z eW5jIC0tIGZvcmNlIHRoZSBzdGFydCBvZiBhIHN5bmNyb25pc2F0aW9uIHJ1 biwgIg0KKwkiICBzeW5jIC0tIHN0YXJ0IGEgc3luY2hyb25pc2F0aW9uIChi YWNrdXApIHJ1biBub3dcbiINCisJIiAgZm9yY2Utc3luYyAtLSBmb3JjZSB0 aGUgc3RhcnQgb2YgYSBzeW5jaHJvbmlzYXRpb24gcnVuLCAiDQogCSJldmVu IGlmIFN5bmNBbGxvd1NjcmlwdCBzYXlzIG5vXG4iDQogCSIgIHJlbG9hZCAt LSByZWxvYWQgZGFlbW9uIGNvbmZpZ3VyYXRpb25cbiINCiAJIiAgdGVybWlu YXRlIC0tIHRlcm1pbmF0ZSBkYWVtb24gbm93XG4iDQogCSIgIHdhaXQtZm9y LXN5bmMgLS0gd2FpdCB1bnRpbCB0aGUgbmV4dCBzeW5jIHN0YXJ0cywgdGhl biBleGl0XG4iDQorCSIgIHdhaXQtZm9yLWVuZCAgLS0gd2FpdCB1bnRpbCB0 aGUgbmV4dCBzeW5jIGZpbmlzaGVzLCB0aGVuIGV4aXRcbiINCisJIiAgc3lu Yy1hbmQtd2FpdCAtLSBzdGFydCBzeW5jLCB3YWl0IHVudGlsIGl0IGZpbmlz aGVzLCB0aGVuIGV4aXRcbiINCiAJKTsNCiAJZXhpdCgxKTsNCiB9DQpAQCAt MTA3LDcgKzExNywxMCBAQA0KIAkvLyBDaGVjayB0aGVyZSdzIGEgc29ja2V0 IGRlZmluZWQgaW4gdGhlIGNvbmZpZyBmaWxlDQogCWlmKCFjb25mLktleUV4 aXN0cygiQ29tbWFuZFNvY2tldCIpKQ0KIAl7DQotCQlwcmludGYoIkRhZW1v biBpc24ndCB1c2luZyBhIGNvbnRyb2wgc29ja2V0LCBjb3VsZCBub3QgZXhl Y3V0ZSBjb21tYW5kLlxuQWRkIGEgQ29tbWFuZFNvY2tldCBkZWNsYXJhdGlv biB0byB0aGUgYmJhY2t1cGQuY29uZiBmaWxlLlxuIik7DQorCQlwcmludGYo IkRhZW1vbiBpc24ndCB1c2luZyBhIGNvbnRyb2wgc29ja2V0LCAiDQorCQkJ ImNvdWxkIG5vdCBleGVjdXRlIGNvbW1hbmQuXG4iDQorCQkJIkFkZCBhIENv bW1hbmRTb2NrZXQgZGVjbGFyYXRpb24gdG8gdGhlICINCisJCQkiYmJhY2t1 cGQuY29uZiBmaWxlLlxuIik7DQogCQlyZXR1cm4gMTsNCiAJfQ0KIAkNCkBA IC0xODgsNjggKzIwMSwxNjEgQEANCiAJLy8gUHJpbnQgc3VtbWFyeT8NCiAJ aWYoIXF1aWV0KQ0KIAl7DQotCQlwcmludGYoIkRhZW1vbiBjb25maWd1cmF0 aW9uIHN1bW1hcnk6XG4iCVwNCi0JCQkgICAiICBBdXRvbWF0aWNCYWNrdXAg PSAlc1xuIgkJCVwNCi0JCQkgICAiICBVcGRhdGVTdG9yZUludGVydmFsID0g JWQgc2Vjb25kc1xuIglcDQotCQkJICAgIiAgTWluaW11bUZpbGVBZ2UgPSAl ZCBzZWNvbmRzXG4iCVwNCi0JCQkgICAiICBNYXhVcGxvYWRXYWl0ID0gJWQg c2Vjb25kc1xuIiwNCi0JCQkgICBhdXRvQmFja3VwPyJ0cnVlIjoiZmFsc2Ui LCB1cGRhdGVTdG9yZUludGVydmFsLCBtaW5pbXVtRmlsZUFnZSwgbWF4VXBs b2FkV2FpdCk7DQorCQlwcmludGYoIkRhZW1vbiBjb25maWd1cmF0aW9uIHN1 bW1hcnk6XG4iDQorCQkJIiAgQXV0b21hdGljQmFja3VwID0gJXNcbiINCisJ CQkiICBVcGRhdGVTdG9yZUludGVydmFsID0gJWQgc2Vjb25kc1xuIg0KKwkJ CSIgIE1pbmltdW1GaWxlQWdlID0gJWQgc2Vjb25kc1xuIg0KKwkJCSIgIE1h eFVwbG9hZFdhaXQgPSAlZCBzZWNvbmRzXG4iLA0KKwkJCWF1dG9CYWNrdXA/ InRydWUiOiJmYWxzZSIsIHVwZGF0ZVN0b3JlSW50ZXJ2YWwsIA0KKwkJCW1p bmltdW1GaWxlQWdlLCBtYXhVcGxvYWRXYWl0KTsNCiAJfQ0KIA0KLQkvLyBJ cyB0aGUgY29tbWFuZCB0aGUgIndhaXQgZm9yIHN5bmMgdG8gc3RhcnQiIGNv bW1hbmQ/DQotCWJvb2wgYXJlV2FpdGluZ0ZvclN5bmMgPSBmYWxzZTsNCi0J aWYoOjpzdHJjbXAoYXJndlswXSwgIndhaXQtZm9yLXN5bmMiKSA9PSAwKQ0K KwlzdGQ6OnN0cmluZyBzdGF0ZUxpbmU7DQorCWlmKCFnZXRMaW5lLkdldExp bmUoc3RhdGVMaW5lKSB8fCBnZXRMaW5lLklzRU9GKCkpDQogCXsNCi0JCS8v IENoZWNrIHRoYXQgaXQncyBub3QgaW4gbm9uLWF1dG9tYXRpYyBtb2RlLCBi ZWNhdXNlIHRoZW4gaXQnbGwgbmV2ZXIgc3RhcnQNCi0JCWlmKCFhdXRvQmFj a3VwKQ0KKyNpZiBkZWZpbmVkIFdJTjMyICYmICEgZGVmaW5lZCBOREVCVUcN CisJCXN5c2xvZyhMT0dfRVJSLCAiRmFpbGVkIHRvIHJlY2VpdmUgc3RhdGUg bGluZSBmcm9tIGRhZW1vbiIpOw0KKyNlbHNlDQorCQlwcmludGYoIkZhaWxl ZCB0byByZWNlaXZlIHN0YXRlIGxpbmUgZnJvbSBkYWVtb25cbiIpOw0KKyNl bmRpZg0KKwkJcmV0dXJuIDE7DQorCX0NCisNCisJLy8gRGVjb2RlIGl0DQor CWludCBjdXJyZW50U3RhdGU7DQorCWlmKDo6c3NjYW5mKHN0YXRlTGluZS5j X3N0cigpLCAic3RhdGUgJWQiLCAmY3VycmVudFN0YXRlKSAhPSAxKQ0KKwl7 DQorCQlwcmludGYoIlN0YXRlIGxpbmUgZGlkbid0IGRlY29kZVxuIik7DQor CQlyZXR1cm4gMTsNCisJfQ0KKw0KKwlDb21tYW5kIGNvbW1hbmQgPSBEZWZh dWx0Ow0KKwlzdGQ6OnN0cmluZyBjb21tYW5kTmFtZShhcmd2WzBdKTsNCisN CisJaWYgKGNvbW1hbmROYW1lID09ICJ3YWl0LWZvci1zeW5jIikNCisJew0K KwkJY29tbWFuZCA9IFdhaXRGb3JTeW5jU3RhcnQ7DQorCX0NCisJZWxzZSBp ZiAoY29tbWFuZE5hbWUgPT0gIndhaXQtZm9yLWVuZCIpDQorCXsNCisJCWNv bW1hbmQgPSBXYWl0Rm9yU3luY0VuZDsNCisJfQ0KKwllbHNlIGlmIChjb21t YW5kTmFtZSA9PSAic3luYy1hbmQtd2FpdCIpDQorCXsNCisJCWNvbW1hbmQg PSBTeW5jQW5kV2FpdEZvckVuZDsNCisJfQ0KKw0KKwlzd2l0Y2ggKGNvbW1h bmQpDQorCXsNCisJCWNhc2UgV2FpdEZvclN5bmNTdGFydDoNCisJCWNhc2Ug V2FpdEZvclN5bmNFbmQ6DQogCQl7DQotCQkJcHJpbnRmKCJFUlJPUjogRGFl bW9uIGlzIG5vdCBpbiBhdXRvbWF0aWMgbW9kZSAtLSBzeW5jIHdpbGwgbmV2 ZXIgc3RhcnQhXG4iKTsNCi0JCQlyZXR1cm4gMTsNCisJCQkvLyBDaGVjayB0 aGF0IGl0J3Mgbm90IGluIG5vbi1hdXRvbWF0aWMgbW9kZSwgDQorCQkJLy8g YmVjYXVzZSB0aGVuIGl0J2xsIG5ldmVyIHN0YXJ0DQorDQorCQkJaWYoIWF1 dG9CYWNrdXApDQorCQkJew0KKwkJCQlwcmludGYoIkVSUk9SOiBEYWVtb24g aXMgbm90IGluIGF1dG9tYXRpYyBtb2RlIC0tICINCisJCQkJCSJzeW5jIHdp bGwgbmV2ZXIgc3RhcnQhXG4iKTsNCisJCQkJcmV0dXJuIDE7DQorCQkJfQ0K Kw0KIAkJfQ0KLQkNCi0JCS8vIFllcy4uLiBzZXQgdGhlIGZsYWcgc28gd2Ug a25vdyB3aGF0IHdlJ3JlIHdhaXRpbmcgZm9yIGEgc3luYyB0byBzdGFydA0K LQkJYXJlV2FpdGluZ0ZvclN5bmMgPSB0cnVlOw0KKwkJYnJlYWs7DQorDQor CQljYXNlIFN5bmNBbmRXYWl0Rm9yRW5kOg0KKwkJew0KKwkJCS8vIHNlbmQg YSBzeW5jIGNvbW1hbmQNCisJCQlzdGQ6OnN0cmluZyBjbWQoImZvcmNlLXN5 bmNcbiIpOw0KKwkJCWNvbm5lY3Rpb24uV3JpdGUoY21kLmNfc3RyKCksIGNt ZC5zaXplKCkpOw0KKwkJCWNvbm5lY3Rpb24uV3JpdGVBbGxCdWZmZXJlZCgp Ow0KKw0KKwkJCWlmIChjdXJyZW50U3RhdGUgIT0gMCkNCisJCQl7DQorCQkJ CXByaW50ZigiV2FpdGluZyBmb3IgY3VycmVudCBzeW5jL2Vycm9yIHN0YXRl ICINCisJCQkJCSJ0byBmaW5pc2guLi5cbiIpOw0KKwkJCX0NCisJCX0NCisJ CWJyZWFrOw0KKw0KKwkJZGVmYXVsdDoNCisJCXsNCisJCQkvLyBOb3JtYWwg Y2FzZSwganVzdCBzZW5kIHRoZSBjb21tYW5kIGdpdmVuIA0KKwkJCS8vIHBs dXMgYSBxdWl0IGNvbW1hbmQuDQorCQkJc3RkOjpzdHJpbmcgY21kID0gY29t bWFuZE5hbWU7DQorCQkJY21kICs9ICJcbnF1aXRcbiI7DQorCQkJY29ubmVj dGlvbi5Xcml0ZShjbWQuY19zdHIoKSwgY21kLnNpemUoKSk7DQorCQl9DQog CX0NCi0JZWxzZQ0KLQl7DQotCQkvLyBObz8gSnVzdCBzZW5kIHRoZSBjb21t YW5kIGdpdmVuIHBsdXMgYSBxdWl0IGNvbW1hbmQuDQotCQlzdGQ6OnN0cmlu ZyBjbWQoYXJndlswXSk7DQotCQljbWQgKz0gIlxucXVpdFxuIjsNCi0JCWNv bm5lY3Rpb24uV3JpdGUoY21kLmNfc3RyKCksIGNtZC5zaXplKCkpOw0KLQl9 DQogCQ0KIAkvLyBSZWFkIHRoZSByZXNwb25zZQ0KIAlzdGQ6OnN0cmluZyBs aW5lOw0KLQl3aGlsZSghZ2V0TGluZS5Jc0VPRigpICYmIGdldExpbmUuR2V0 TGluZShsaW5lKSkNCisJYm9vbCBzeW5jSXNSdW5uaW5nID0gZmFsc2U7DQor CWJvb2wgZmluaXNoZWQgPSBmYWxzZTsNCisNCisJd2hpbGUoIWZpbmlzaGVk ICYmICFnZXRMaW5lLklzRU9GKCkgJiYgZ2V0TGluZS5HZXRMaW5lKGxpbmUp KQ0KIAl7DQotCQlpZihhcmVXYWl0aW5nRm9yU3luYykNCisJCXN3aXRjaCAo Y29tbWFuZCkNCiAJCXsNCi0JCQkvLyBOZWVkIHRvIHdhaXQgZm9yIHRoZSBz dGF0ZSBjaGFuZ2UuLi4NCi0JCQlpZihsaW5lID09ICJzdGFydC1zeW5jIikN CisJCQljYXNlIFdhaXRGb3JTeW5jU3RhcnQ6DQogCQkJew0KLQkJCQkvLyBT ZW5kIGEgcXVpdCBjb21tYW5kIHRvIGZpbmlzaCBuaWNlbHkNCi0JCQkJY29u bmVjdGlvbi5Xcml0ZSgicXVpdFxuIiwgNSk7DQotCQkJCQ0KLQkJCQkvLyBB bmQgd2UncmUgZG9uZQ0KLQkJCQlicmVhazsNCi0JCQl9CQkNCi0JCX0NCi0J CWVsc2UNCi0JCXsNCi0JCQkvLyBJcyB0aGlzIGFuIE9LIG9yIGVycm9yIGxp bmU/DQotCQkJaWYobGluZSA9PSAib2siKQ0KKwkJCQkvLyBOZWVkIHRvIHdh aXQgZm9yIHRoZSBzdGF0ZSBjaGFuZ2UuLi4NCisJCQkJaWYobGluZSA9PSAi c3RhcnQtc3luYyIpDQorCQkJCXsNCisJCQkJCS8vIFNlbmQgYSBxdWl0IGNv bW1hbmQgdG8gZmluaXNoIG5pY2VseQ0KKwkJCQkJY29ubmVjdGlvbi5Xcml0 ZSgicXVpdFxuIiwgNSk7DQorCQkJCQkNCisJCQkJCS8vIEFuZCB3ZSdyZSBk b25lDQorCQkJCQlmaW5pc2hlZCA9IHRydWU7DQorCQkJCX0NCisJCQl9DQor CQkJYnJlYWs7DQorDQorCQkJY2FzZSBXYWl0Rm9yU3luY0VuZDoNCisJCQlj YXNlIFN5bmNBbmRXYWl0Rm9yRW5kOg0KIAkJCXsNCi0JCQkJaWYoIXF1aWV0 KQ0KKwkJCQlpZihsaW5lID09ICJzdGFydC1zeW5jIikNCiAJCQkJew0KLQkJ CQkJcHJpbnRmKCJTdWNjZWVkZWQuXG4iKTsNCisJCQkJCWlmICghcXVpZXQp IHByaW50ZigiU3luYyBzdGFydGVkLi4uXG4iKTsNCisJCQkJCXN5bmNJc1J1 bm5pbmcgPSB0cnVlOw0KIAkJCQl9DQotCQkJCWJyZWFrOw0KKwkJCQllbHNl IGlmKGxpbmUgPT0gImZpbmlzaC1zeW5jIikNCisJCQkJew0KKwkJCQkJaWYg KHN5bmNJc1J1bm5pbmcpDQorCQkJCQl7DQorCQkJCQkJaWYgKCFxdWlldCkg cHJpbnRmKCJTeW5jIGZpbmlzaGVkLlxuIik7DQorCQkJCQkJLy8gU2VuZCBh IHF1aXQgY29tbWFuZCB0byBmaW5pc2ggbmljZWx5DQorCQkJCQkJY29ubmVj dGlvbi5Xcml0ZSgicXVpdFxuIiwgNSk7DQorCQkJCQkNCisJCQkJCQkvLyBB bmQgd2UncmUgZG9uZQ0KKwkJCQkJCWZpbmlzaGVkID0gdHJ1ZTsNCisJCQkJ CX0NCisJCQkJCWVsc2UNCisJCQkJCXsNCisJCQkJCQlpZiAoIXF1aWV0KSBw cmludGYoIlByZXZpb3VzIHN5bmMgZmluaXNoZWQuXG4iKTsNCisJCQkJCX0N CisJCQkJCS8vIGRhZW1vbiBtdXN0IHN0aWxsIGJlIGJ1c3kNCisJCQkJfQ0K IAkJCX0NCi0JCQllbHNlIGlmKGxpbmUgPT0gImVycm9yIikNCisJCQlicmVh azsNCisNCisJCQlkZWZhdWx0Og0KIAkJCXsNCi0JCQkJcHJpbnRmKCJFUlJP Ui4gKENoZWNrIGNvbW1hbmQgc3BlbGxpbmcpXG4iKTsNCi0JCQkJcmV0dXJu Q29kZSA9IDE7DQotCQkJCWJyZWFrOw0KKwkJCQkvLyBJcyB0aGlzIGFuIE9L IG9yIGVycm9yIGxpbmU/DQorCQkJCWlmKGxpbmUgPT0gIm9rIikNCisJCQkJ ew0KKwkJCQkJaWYoIXF1aWV0KQ0KKwkJCQkJew0KKwkJCQkJCXByaW50Zigi U3VjY2VlZGVkLlxuIik7DQorCQkJCQl9DQorCQkJCQlmaW5pc2hlZCA9IHRy dWU7DQorCQkJCX0NCisJCQkJZWxzZSBpZihsaW5lID09ICJlcnJvciIpDQor CQkJCXsNCisJCQkJCXByaW50ZigiRVJST1IuIChDaGVjayBjb21tYW5kIHNw ZWxsaW5nKVxuIik7DQorCQkJCQlyZXR1cm5Db2RlID0gMTsNCisJCQkJCWZp bmlzaGVkID0gdHJ1ZTsNCisJCQkJfQ0KIAkJCX0NCiAJCX0NCiAJfQ0K ---128931150-28992530-1154992061=:28495-- From boxbackup-dev at fluffy.co.uk Tue Aug 8 00:16:07 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Tue, 8 Aug 2006 00:16:07 +0100 (BST) Subject: [Box Backup-dev] Reviewing code In-Reply-To: <44D7A5B5.50000@invis.net> References: <20060807142001.amonlc4x0k00swo0@ebourne.me.uk> <44D7524A.3070003@invis.net> <44D7A5B5.50000@invis.net> Message-ID: Hi Charles, On Mon, 7 Aug 2006, Charles Lecklider wrote: >> By the way, it should definitely be possible to compile Box on Windows >> without ANY cygwin support, primarily because you requested it in the >> past, and Nick supplied the beginnings of an underlying infrastructure >> in win32.bat. You do need Perl and SVN command-line tools installed >> though. Please see the "Compile with Visual C" page on the wiki: >> >> [http://boxbackup.hostworks.ca/index.php/Compile_With_Visual_C] > > Aha! I clearly missed all the emails where people said that had been > fixed.... > > Which branch should I try? I recommend that you use mine, but as Mae West once said, "Well, he would say that, wouldn't he?" I promise that I will work hard to resolve any problems that you have with my branch, as quickly as possible. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Tue Aug 8 10:33:43 2006 From: boxbackup-dev at fluffy.co.uk (Nick Knight) Date: Tue, 8 Aug 2006 10:33:43 +0100 Subject: [Box Backup-dev] wiki page changes Message-ID: Hello All, I have made a start at documenting how you would like to use SVN (*plus the changes I would like to see introduced). I think it is very important to get down on paper formal procedures like this with any number of developers greater than 1. Nothing I have put down there is concrete yet, but before I commit my changes so far I would like to know I am committing correctly. The page I have added it to is http://boxbackup.hostworks.ca/index.php/Source_code_repository.=20 With introducing this page it would be good to re-introduce a bug tracking facility - I introduced one last year but it looks as though it hasn't really been used, it is all too easy to lose track of bugs which are not tracked properly - any ideas welcome... I am happy to host whatever solution - or perhaps integrate with the wiki somehow. Regards Nick From boxbackup-dev at fluffy.co.uk Tue Aug 8 10:40:42 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Tue, 8 Aug 2006 10:40:42 +0100 (BST) Subject: [Box Backup-dev] wiki page changes In-Reply-To: References: Message-ID: Hi Nick, > I have made a start at documenting how you would like to use SVN (*plus > the changes I would like to see introduced). I think it is very > important to get down on paper formal procedures like this with any > number of developers greater than 1. Nothing I have put down there is > concrete yet, but before I commit my changes so far I would like to know > I am committing correctly. > > The page I have added it to is > http://boxbackup.hostworks.ca/index.php/Source_code_repository. I suggest that we change the requirements 2 and 3 to "unit tests passing on all supported platforms," which is stricter. Large file tests are a good idea. I wonder if we could automate it? With sparse files, large file tests do not need a lot of disk space. > With introducing this page it would be good to re-introduce a bug > tracking facility - I introduced one last year but it looks as though it > hasn't really been used, it is all too easy to lose track of bugs which > are not tracked properly - any ideas welcome... I am happy to host > whatever solution - or perhaps integrate with the wiki somehow. Wiki is OK but it may get spammed, and is difficult to search and get an overview/summary of outstanding bugs. Someone recommended Trac and Martin seemed to like it. I've used Request Tracker but wouldn't recommend it because it's a pig to install. I've also used Mantis and liked it, very easy to install (just PHP and MySQL). Sourceforge and Gforge also offer bug trackers. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Tue Aug 8 15:35:55 2006 From: boxbackup-dev at fluffy.co.uk (Charles Lecklider) Date: Tue, 08 Aug 2006 15:35:55 +0100 Subject: [Box Backup-dev] Reviewing code In-Reply-To: References: <20060807142001.amonlc4x0k00swo0@ebourne.me.uk> <44D7524A.3070003@invis.net> <44D7A5B5.50000@invis.net> Message-ID: <44D8A14B.7080707@invis.net> Chris Wilson wrote: > I recommend that you use mine, but as Mae West once said, "Well, he > would say that, wouldn't he?" Checked out http://bbdev.fluffy.co.uk/svn/box/chris/general Opened infrastructure\msvc\2005\boxbackup.sln Pressed F7. Got lots of errors. Took a guess and ran win32.bat: quick and dirty to get up and running by generating the required files using Cygwin and Perl 1 file(s) copied. Can't open perl script "./../../bin/bbackupquery/makedocumentation.pl": No such file or directory Can't open perl script "./../../lib/common/makeexception.pl": No such file or directory Can't open perl script "./../../lib/server/makeprotocol.pl": No such file or directory Can't open perl script "./../../lib/common/makeexception.pl": No such file or directory Can't open perl script "./../../lib/common/makeexception.pl": No such file or directory Can't open perl script "./../../lib/common/makeexception.pl": No such file or directory Can't open perl script "./../../lib/common/makeexception.pl": No such file or directory server parts - which appears as though some of the clients rely on Can't open perl script "./../../lib/common/makeexception.pl": No such file or directory Can't open perl script "./../../lib/common/makeexception.pl": No such file or directory Can't open ./test/bbackupd/testfiles/bbackupd.conf: No such file or directory. Am now thinking I picked the wrong branch? -C From boxbackup-dev at fluffy.co.uk Tue Aug 8 18:20:14 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Tue, 08 Aug 2006 18:20:14 +0100 Subject: [Box Backup-dev] wiki page changes In-Reply-To: References: Message-ID: <20060808182014.qimmeznz0kkog48w@ebourne.me.uk> Nick Knight wrote: > The page I have added it to is > http://boxbackup.hostworks.ca/index.php/Source_code_repository. Excellent, thanks Nick. That was a good base. I've gone in and made =20 some changes to make it reflect a combination of what we already do =20 and where I thought we should go. I liked the idea of the features/ =20 directory for branches so went with that and extended it. I didn't quite get time to finish what I wanted but I can see Ben has =20 gone in and made some edits, so I'm guessing he agrees with the =20 general direction. We both didn't see the need for a bugs branch so I =20 removed it. A few things I'd like to discuss (and email is better than a wiki page =20 for that :)). If people could review the page and then follow up with =20 ideas that would be great. 1. Looking at the current repository top level I felt it was getting =20 too cluttered so some cleaning up was in order. Using Nick's feature =20 branches I think that should cover all significant extensions to box, =20 including ports. I also think all personal branches should be together =20 out of the top level. 2. The way release branching is done at the moment is a little =20 confusing. I think we should have the concept of tagging an exact =20 release and I think that is the intention for the RELEASE directory =20 which is fine. But then the 0.10 release branch/tag also had a last minute fix merged =20 into it which confuses things. :) A common way projects handle =20 releases is to branch the trunk into a maintenance branch for that =20 codeline. eg. maintenance/0.11. Then any last minute fixes can be =20 added to this. When the tarballs are actually cut this is copied to =20 RELEASES/0.11. Then if any serious bugs are found before 0.12 is ready =20 they can be fixed on the maintenance/0.11 branch and a 0.11.1 cut from =20 it. Ben wonders if we have enough people for this, but really it's only a =20 couple of svn commands above what we already do. In the event that we =20 had important bugs we wanted to put fixes out it would be quite easy. A crucial rule here would be that nothing is ever committed directly =20 to a maintenance branch, only ever merged from trunk. If you follow =20 this it becomes very easy. Only the testing for a bugfix release would =20 be a lot of work but by that time we presumably all think it is =20 worthwhile. And from last time we seem to have plenty of users to help =20 us with that. > With introducing this page it would be good to re-introduce a bug > tracking facility - I introduced one last year but it looks as though it > hasn't really been used, it is all too easy to lose track of bugs which > are not tracked properly - any ideas welcome... I am happy to host > whatever solution - or perhaps integrate with the wiki somehow. Ben did say he was going to install trac, which would be great (works =20 well with svn), but then I think he went to do it and was put off by =20 the difficulty of installing it on OpenBSD. :-( The problem with hosting these things externally is hooking them into =20 the version control system. If it doesn't integrate properly into svn =20 then it won't get any use. The wiki is rubbish for bug tracking, but =20 fine for feature tracking (much better than a bug tracker in that =20 case). My bug tracking for box consists of keeping emails that discuss =20 bugs in my email folder until there is a bug tracker so I can go back =20 and reenter them. I don't really like it though, folder's getting =20 quite big. :-/ Cheers, Martin. From boxbackup-dev at fluffy.co.uk Tue Aug 8 20:52:27 2006 From: boxbackup-dev at fluffy.co.uk (Stefan Norlin) Date: Tue, 8 Aug 2006 21:52:27 +0200 Subject: [Box Backup-dev] wiki page changes References: <20060808182014.qimmeznz0kkog48w@ebourne.me.uk> Message-ID: <007f01c6bb24$2d68fdb0$0101050a@stenorhem> > But then the 0.10 release branch/tag also had a last minute fix merged > into it which confuses things. :) A common way projects handle releases > is to branch the trunk into a maintenance branch for that codeline. eg. > maintenance/0.11. Then any last minute fixes can be added to this. When > the tarballs are actually cut this is copied to RELEASES/0.11. Then if > any serious bugs are found before 0.12 is ready they can be fixed on the > maintenance/0.11 branch and a 0.11.1 cut from it. For what it's worth... We use Perforce for SCM using the mainline model as described here. http://www.perforce.com/perforce/bestpractices.html Basically all development is done in project branches (sometimes in one instance, sometimes in multiple, personal, ones), then everything is merged into the mainline (trunk) from which a release branch is created when it is time for release. All testing and "last-minute" fixes are done in the release branch and then a label is set when a release is done. I do not know if it is relevant or merely confusing... just wanted to share something that we have been using successfully for a few years now on multiple different projects with 1-4 developers on each project. Also we use the version syntax major.minor.patchlevel.build, like 2.0.1.9878, where the build number is always unique and basically the unique "change" number provided by perforce. This way we always now exactly from where a special build origins. The version is generated, added to a include file and compiled into the build by the build script. So, if we "find" a binary laying around we can also always tell exactly what version the binary is and locate the origin in the tree of branches. Stefan From boxbackup-dev at fluffy.co.uk Tue Aug 8 21:10:07 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Tue, 08 Aug 2006 21:10:07 +0100 Subject: [Box Backup-dev] wiki page changes In-Reply-To: <007f01c6bb24$2d68fdb0$0101050a@stenorhem> References: <20060808182014.qimmeznz0kkog48w@ebourne.me.uk> <007f01c6bb24$2d68fdb0$0101050a@stenorhem> Message-ID: <1155067808.17799.6.camel@avenin.ebourne.me.uk> On Tue, 2006-08-08 at 21:52 +0200, Stefan Norlin wrote: > Basically all development is done in project branches (sometimes in > one instance, sometimes in multiple, personal, ones), then everything is > merged into the mainline (trunk) from which a release branch is created > when it is time for release. All testing and "last-minute" fixes are done > in the release branch and then a label is set when a release is done. That sounds pretty much like what we're suggesting, which is reassuring! The only difference is that I think it works better to always merge from trunk onto a release branch and not the other way around. Otherwise you invariably end up merging both ways and that gets confusing. Things should be tested on trunk and only merged to the release branch if they are good fixes. And we're only talking about merging occasional valuable fixes here. Commercially it seems more common to develop on the release branch and merge to trunk but then they often do significant development on branches and maintain several of them for long periods of time. Open source tends to be more fast moving and work the other way round. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Tue Aug 8 21:19:27 2006 From: boxbackup-dev at fluffy.co.uk (Stefan Norlin) Date: Tue, 8 Aug 2006 22:19:27 +0200 Subject: [Box Backup-dev] wiki page changes References: <20060808182014.qimmeznz0kkog48w@ebourne.me.uk> <007f01c6bb24$2d68fdb0$0101050a@stenorhem> <1155067808.17799.6.camel@avenin.ebourne.me.uk> Message-ID: <009601c6bb27$f2988bc0$0101050a@stenorhem> > Commercially it seems more common to develop on the release branch and > merge to trunk but then they often do significant development on > branches and maintain several of them for long periods of time. Open > source tends to be more fast moving and work the other way round. That is a good point. However, from what I had seen so far of the box development and due to the nature of this particular piece of software (being a backup software) it looked like the life-cycle would be quite similar to some of our commercial products as opposed to some very feature-rich, PHP-style, open source projects that change dramatically from month to month. :) Anyway, I am totally with you. Just wanted to fuel the discussion a bit. ;-) Stefan From boxbackup-dev at fluffy.co.uk Tue Aug 8 21:44:44 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Tue, 08 Aug 2006 21:44:44 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [03] Additional commands for bbackupctl In-Reply-To: References: <20060807132722.uckkh0fi0wccwksg@ebourne.me.uk> Message-ID: <1155069884.17799.9.camel@avenin.ebourne.me.uk> On Tue, 2006-08-08 at 00:07 +0100, Chris Wilson wrote: > I've rewritten the code according to Martin's suppgestions. Please review > the following patch for merge to trunk (bbackupd tests pass on Win32): > > svn diff -r 724:725 http://bbdev.fluffy.co.uk/svn/box/chris/merge Well there'll be no complaints from me! Although I would like to know what's with the double negatives: // Check that it's not in non-automatic mode, because then it'll // never start Mind bending, and could be really confusing if we get any Spanish speakers on the project. ;-) Anyhow, merge on... Cheers, Martin. From boxbackup-dev at fluffy.co.uk Wed Aug 9 00:24:38 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Wed, 09 Aug 2006 00:24:38 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [05] bbackupd In-Reply-To: References: Message-ID: <1155079478.17799.19.camel@avenin.ebourne.me.uk> On Sun, 2006-07-23 at 02:11 +0100, Chris Wilson wrote: > The attached patch contains a few changes: > > * Reformat code in bin/bbackupd/Win32ServiceFunctions.cpp to better match > the Box coding standards (not claiming it's perfect yet) > * Allow passing a configuration file name to InstallService, and include > that name in the service command line > * Pass the configuration file name from the command line when calling > OurService() and InstallService() from main() > * Set a non-zero exit code if InstallService or RemoveService fails > * Detect some common error cases in InstallService() and show better > debugging messages on the console Why the chained elseifs? switch would be cleaner and less error prone. > * Stop the Box Backup service before trying to delete it > * Fixed a trivial memory leak reported by DebugMemleakFinder There seems to be a change from "Win32BackupService gDaemonService" to "Win32BackupService* gDaemonService", not sure which of the above that relates to. Is it this memory leak fix? I don't like this defining globals in a .cpp file and then declaring them extern in another .cpp to get access. At the minimum the first .cpp file's .h file should be declaring them. Encapsulation would be even nicer if appropriate, I don't know anything about the windows API here apart from what I can guess from the code, so not sure on this. > * Removed WSAStartup() and WSACleanup() from bbackupd.cpp (moved to > Daemon.cpp) - temporarily breaks Win32 builds, pending the patch to > Daemon.cpp! These should be part of the same changeset that adds the code back into Daemon.cpp. Then there would be no breakage and everything would be consistent. Prefer change based merge to file based merge. :) Notwithstanding the above, the rest of it looks fine to me. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Wed Aug 9 00:54:35 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Tue, 8 Aug 2006 23:54:35 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r726 - box/chris/merge/bin/bbackupctl Message-ID: <20060808235435.412D796@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-08 23:54:33 +0000 (Tue, 08 Aug 2006) New Revision: 726 Modified: box/chris/merge/bin/bbackupctl/bbackupctl.cpp Log: * bbackupctl.cpp - Grammar fix in comments (cosmetic) Modified: box/chris/merge/bin/bbackupctl/bbackupctl.cpp =================================================================== --- box/chris/merge/bin/bbackupctl/bbackupctl.cpp 2006-08-07 22:46:35 UTC (rev 725) +++ box/chris/merge/bin/bbackupctl/bbackupctl.cpp 2006-08-08 23:54:33 UTC (rev 726) @@ -250,8 +250,8 @@ case WaitForSyncStart: case WaitForSyncEnd: { - // Check that it's not in non-automatic mode, - // because then it'll never start + // Check that it's in automatic mode, + // because otherwise it'll never start if(!autoBackup) { From boxbackup-dev at fluffy.co.uk Wed Aug 9 00:56:59 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Tue, 8 Aug 2006 23:56:59 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r727 - box/trunk/bin/bbackupctl Message-ID: <20060808235659.05FA196@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-08 23:56:56 +0000 (Tue, 08 Aug 2006) New Revision: 727 Modified: box/trunk/bin/bbackupctl/bbackupctl.cpp Log: * bin/bbackupctl/bbackupctl.cpp - Changed code structure to be more readable and robust, following Martin's advice. - Fixed grammar in comment (cosmetic) Modified: box/trunk/bin/bbackupctl/bbackupctl.cpp =================================================================== --- box/trunk/bin/bbackupctl/bbackupctl.cpp 2006-08-08 23:54:33 UTC (rev 726) +++ box/trunk/bin/bbackupctl/bbackupctl.cpp 2006-08-08 23:56:56 UTC (rev 727) @@ -28,16 +28,26 @@ #include "MemLeakFindOn.h" +enum Command +{ + Default, + WaitForSyncStart, + WaitForSyncEnd, + SyncAndWaitForEnd, +}; + void PrintUsageAndExit() { printf("Usage: bbackupctl [-q] [-c config_file] \n" "Commands are:\n" - " sync -- start a syncronisation run now\n" - " force-sync -- force the start of a syncronisation run, " + " sync -- start a synchronisation (backup) run now\n" + " force-sync -- force the start of a synchronisation run, " "even if SyncAllowScript says no\n" " reload -- reload daemon configuration\n" " terminate -- terminate daemon now\n" " wait-for-sync -- wait until the next sync starts, then exit\n" + " wait-for-end -- wait until the next sync finishes, then exit\n" + " sync-and-wait -- start sync, wait until it finishes, then exit\n" ); exit(1); } @@ -107,7 +117,10 @@ // Check there's a socket defined in the config file if(!conf.KeyExists("CommandSocket")) { - printf("Daemon isn't using a control socket, could not execute command.\nAdd a CommandSocket declaration to the bbackupd.conf file.\n"); + printf("Daemon isn't using a control socket, " + "could not execute command.\n" + "Add a CommandSocket declaration to the " + "bbackupd.conf file.\n"); return 1; } @@ -188,68 +201,161 @@ // Print summary? if(!quiet) { - printf("Daemon configuration summary:\n" \ - " AutomaticBackup = %s\n" \ - " UpdateStoreInterval = %d seconds\n" \ - " MinimumFileAge = %d seconds\n" \ - " MaxUploadWait = %d seconds\n", - autoBackup?"true":"false", updateStoreInterval, minimumFileAge, maxUploadWait); + printf("Daemon configuration summary:\n" + " AutomaticBackup = %s\n" + " UpdateStoreInterval = %d seconds\n" + " MinimumFileAge = %d seconds\n" + " MaxUploadWait = %d seconds\n", + autoBackup?"true":"false", updateStoreInterval, + minimumFileAge, maxUploadWait); } - // Is the command the "wait for sync to start" command? - bool areWaitingForSync = false; - if(::strcmp(argv[0], "wait-for-sync") == 0) + std::string stateLine; + if(!getLine.GetLine(stateLine) || getLine.IsEOF()) { - // Check that it's not in non-automatic mode, because then it'll never start - if(!autoBackup) +#if defined WIN32 && ! defined NDEBUG + syslog(LOG_ERR, "Failed to receive state line from daemon"); +#else + printf("Failed to receive state line from daemon\n"); +#endif + return 1; + } + + // Decode it + int currentState; + if(::sscanf(stateLine.c_str(), "state %d", ¤tState) != 1) + { + printf("State line didn't decode\n"); + return 1; + } + + Command command = Default; + std::string commandName(argv[0]); + + if (commandName == "wait-for-sync") + { + command = WaitForSyncStart; + } + else if (commandName == "wait-for-end") + { + command = WaitForSyncEnd; + } + else if (commandName == "sync-and-wait") + { + command = SyncAndWaitForEnd; + } + + switch (command) + { + case WaitForSyncStart: + case WaitForSyncEnd: { - printf("ERROR: Daemon is not in automatic mode -- sync will never start!\n"); - return 1; + // Check that it's in automatic mode, + // because otherwise it'll never start + + if(!autoBackup) + { + printf("ERROR: Daemon is not in automatic mode -- " + "sync will never start!\n"); + return 1; + } + } - - // Yes... set the flag so we know what we're waiting for a sync to start - areWaitingForSync = true; + break; + + case SyncAndWaitForEnd: + { + // send a sync command + std::string cmd("force-sync\n"); + connection.Write(cmd.c_str(), cmd.size()); + connection.WriteAllBuffered(); + + if (currentState != 0) + { + printf("Waiting for current sync/error state " + "to finish...\n"); + } + } + break; + + default: + { + // Normal case, just send the command given + // plus a quit command. + std::string cmd = commandName; + cmd += "\nquit\n"; + connection.Write(cmd.c_str(), cmd.size()); + } } - else - { - // No? Just send the command given plus a quit command. - std::string cmd(argv[0]); - cmd += "\nquit\n"; - connection.Write(cmd.c_str(), cmd.size()); - } // Read the response std::string line; - while(!getLine.IsEOF() && getLine.GetLine(line)) + bool syncIsRunning = false; + bool finished = false; + + while(!finished && !getLine.IsEOF() && getLine.GetLine(line)) { - if(areWaitingForSync) + switch (command) { - // Need to wait for the state change... - if(line == "start-sync") + case WaitForSyncStart: { - // Send a quit command to finish nicely - connection.Write("quit\n", 5); - - // And we're done - break; - } - } - else - { - // Is this an OK or error line? - if(line == "ok") + // Need to wait for the state change... + if(line == "start-sync") + { + // Send a quit command to finish nicely + connection.Write("quit\n", 5); + + // And we're done + finished = true; + } + } + break; + + case WaitForSyncEnd: + case SyncAndWaitForEnd: { - if(!quiet) + if(line == "start-sync") { - printf("Succeeded.\n"); + if (!quiet) printf("Sync started...\n"); + syncIsRunning = true; } - break; + else if(line == "finish-sync") + { + if (syncIsRunning) + { + if (!quiet) printf("Sync finished.\n"); + // Send a quit command to finish nicely + connection.Write("quit\n", 5); + + // And we're done + finished = true; + } + else + { + if (!quiet) printf("Previous sync finished.\n"); + } + // daemon must still be busy + } } - else if(line == "error") + break; + + default: { - printf("ERROR. (Check command spelling)\n"); - returnCode = 1; - break; + // Is this an OK or error line? + if(line == "ok") + { + if(!quiet) + { + printf("Succeeded.\n"); + } + finished = true; + } + else if(line == "error") + { + printf("ERROR. (Check command spelling)\n"); + returnCode = 1; + finished = true; + } } } } From boxbackup-dev at fluffy.co.uk Wed Aug 9 01:05:56 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 01:05:56 +0100 (BST) Subject: [Box Backup-dev] [PATCH] Win32 merge [03] Additional commands for bbackupctl In-Reply-To: <1155069884.17799.9.camel@avenin.ebourne.me.uk> References: <20060807132722.uckkh0fi0wccwksg@ebourne.me.uk> <1155069884.17799.9.camel@avenin.ebourne.me.uk> Message-ID: Hi all, On Tue, 8 Aug 2006, Martin Ebourne wrote: > On Tue, 2006-08-08 at 00:07 +0100, Chris Wilson wrote: >> I've rewritten the code according to Martin's suppgestions. Please review >> the following patch for merge to trunk (bbackupd tests pass on Win32): >> >> svn diff -r 724:725 http://bbdev.fluffy.co.uk/svn/box/chris/merge > > Well there'll be no complaints from me! > > Although I would like to know what's with the double negatives: > // Check that it's not in non-automatic mode, because then it'll > // never start > Mind bending, and could be really confusing if we get any Spanish > speakers on the project. ;-) > > Anyhow, merge on... Grammar fixed and merged. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 09:43:13 2006 From: boxbackup-dev at fluffy.co.uk (Nick Knight) Date: Wed, 9 Aug 2006 09:43:13 +0100 Subject: [Box Backup-dev] wiki page changes In-Reply-To: <009601c6bb27$f2988bc0$0101050a@stenorhem> Message-ID: Hello all, I am please this is all looking good; it certainly is helping my understanding of where things should be put! 1. Would now be a good time for Chris to create the win32 branch? 2. I am happy to leave as is, but not sure I agree with the comments about creating bug fixes on an official release, once it is released - that should be it, especially as box is in very early release numbers anyway? If late bugs are found, then these a) should be placed in the next release and b) the release procedures needs improving as formal releases should be quite well tested! (or perhaps a major/minor release is needed) Regards Nick -----Original Message----- From: boxbackup-dev-admin at fluffy.co.uk [mailto:boxbackup-dev-admin at fluffy.co.uk] On Behalf Of Stefan Norlin Sent: 08 August 2006 21:19 To: boxbackup-dev at fluffy.co.uk Subject: Re: [Box Backup-dev] wiki page changes > Commercially it seems more common to develop on the release branch and > merge to trunk but then they often do significant development on > branches and maintain several of them for long periods of time. Open > source tends to be more fast moving and work the other way round. That is a good point. However, from what I had seen so far of the box development and due to the nature of this particular piece of software (being a backup software) it looked like the life-cycle would be quite similar to some of our commercial products as opposed to some very feature-rich, PHP-style, open source projects that change dramatically from month to month. :) Anyway, I am totally with you. Just wanted to fuel the discussion a bit. ;-) Stefan _______________________________________________ Boxbackup-dev mailing list Boxbackup-dev at fluffy.co.uk http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Wed Aug 9 09:44:57 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 08:44:57 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r728 - box/chris/merge/bin/bbackupd Message-ID: <20060809084457.E6AAF96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 08:44:56 +0000 (Wed, 09 Aug 2006) New Revision: 728 Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp Log: * Win32ServiceFunctions.cpp - Revert to trunk Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-08 23:56:56 UTC (rev 727) +++ box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 08:44:56 UTC (rev 728) @@ -93,30 +93,28 @@ // It also returns on any error because the // service cannot start if there is an eror. -static char* spConfigFileName; - VOID ServiceMain(DWORD argc, LPTSTR *argv) { - // initialise service status - gServiceStatus.dwServiceType = SERVICE_WIN32; - gServiceStatus.dwCurrentState = SERVICE_STOPPED; - gServiceStatus.dwControlsAccepted = 0; - gServiceStatus.dwWin32ExitCode = NO_ERROR; - gServiceStatus.dwServiceSpecificExitCode = NO_ERROR; - gServiceStatus.dwCheckPoint = 0; - gServiceStatus.dwWaitHint = 0; + // initialise service status + gServiceStatus.dwServiceType = SERVICE_WIN32; + gServiceStatus.dwCurrentState = SERVICE_STOPPED; + gServiceStatus.dwControlsAccepted = 0; + gServiceStatus.dwWin32ExitCode = NO_ERROR; + gServiceStatus.dwServiceSpecificExitCode = NO_ERROR; + gServiceStatus.dwCheckPoint = 0; + gServiceStatus.dwWaitHint = 0; - gServiceStatusHandle = RegisterServiceCtrlHandler(gServiceName, - ServiceControlHandler); + gServiceStatusHandle = RegisterServiceCtrlHandler(gServiceName, + ServiceControlHandler); - if (gServiceStatusHandle) - { - // service is starting - gServiceStatus.dwCurrentState = SERVICE_START_PENDING; - SetServiceStatus(gServiceStatusHandle, &gServiceStatus); + if (gServiceStatusHandle) + { + // service is starting + gServiceStatus.dwCurrentState = SERVICE_START_PENDING; + SetServiceStatus(gServiceStatusHandle, &gServiceStatus); - // do initialisation here - gStopServiceEvent = CreateEvent(0, TRUE, FALSE, 0); + // do initialisation here + gStopServiceEvent = CreateEvent( 0, TRUE, FALSE, 0 ); if (!gStopServiceEvent) { gServiceStatus.dwControlsAccepted &= @@ -131,7 +129,7 @@ NULL, 0, RunService, - spConfigFileName, + 0, CREATE_SUSPENDED, NULL); @@ -140,7 +138,7 @@ // we are now running so tell the SCM gServiceStatus.dwControlsAccepted |= - (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); + (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); gServiceStatus.dwCurrentState = SERVICE_RUNNING; SetServiceStatus(gServiceStatusHandle, &gServiceStatus); @@ -158,13 +156,11 @@ ~(SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); gServiceStatus.dwCurrentState = SERVICE_STOPPED; SetServiceStatus(gServiceStatusHandle, &gServiceStatus); - } + } } -void OurService(char* pConfigFileName) +void OurService(void) { - spConfigFileName = pConfigFileName; - SERVICE_TABLE_ENTRY serviceTable[] = { { SERVICE_NAME, (LPSERVICE_MAIN_FUNCTION) ServiceMain }, @@ -183,52 +179,28 @@ } } -int InstallService(const char* pConfigFileName) +void InstallService(void) { - if (pConfigFileName != NULL) - { - struct stat st; + SC_HANDLE newService, scm; - if (emu_stat(pConfigFileName, &st) != 0) - { - syslog(LOG_ERR, "Failed to open configuration file: " - "%s: %s", pConfigFileName, strerror(errno)); - return 1; - } + scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); - if (! st.st_mode & S_IFREG) - { - - syslog(LOG_ERR, "Failed to open configuration file: " - "%s: not a file", pConfigFileName); - return 1; - } - } - - SC_HANDLE scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); - if (!scm) { syslog(LOG_ERR, "Failed to open service control manager: " "error %d", GetLastError()); - return 1; + return; } char cmd[MAX_PATH]; GetModuleFileName(NULL, cmd, sizeof(cmd)-1); cmd[sizeof(cmd)-1] = 0; - std::string cmdWithArgs(cmd); - cmdWithArgs += " --service"; + char cmd_args[MAX_PATH]; + _snprintf(cmd_args, sizeof(cmd_args)-1, "%s --service", cmd); + cmd_args[sizeof(cmd_args)-1] = 0; - if (pConfigFileName != NULL) - { - cmdWithArgs += " \""; - cmdWithArgs += pConfigFileName; - cmdWithArgs += "\""; - } - - SC_HANDLE newService = CreateService( + newService = CreateService( scm, SERVICE_NAME, "Box Backup", @@ -236,36 +208,14 @@ SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, - cmdWithArgs.c_str(), + cmd_args, 0,0,0,0,0); - DWORD err = GetLastError(); - CloseServiceHandle(scm); - if (!newService) { - if (err == ERROR_SERVICE_EXISTS) - { - ::syslog(LOG_ERR, "Failed to create Box Backup " - "service: it already exists"); - } - else if (err == ERROR_SERVICE_MARKED_FOR_DELETE) - { - ::syslog(LOG_ERR, "Failed to create Box Backup " - "service: it is waiting to be deleted"); - } - else if (err == ERROR_DUPLICATE_SERVICE_NAME) - { - ::syslog(LOG_ERR, "Failed to create Box Backup " - "service: a service with this name " - "already exists"); - } - else - { - ::syslog(LOG_ERR, "Failed to create Box Backup " - "service: error %d", err); - } - return 1; + ::syslog(LOG_ERR, "Failed to create Box Backup service: " + "error %d", GetLastError()); + return; } ::syslog(LOG_INFO, "Created Box Backup service"); @@ -281,75 +231,45 @@ } CloseServiceHandle(newService); - - return 0; + CloseServiceHandle(scm); } -int RemoveService(void) +void RemoveService(void) { - SC_HANDLE scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); + SC_HANDLE service, scm; + SERVICE_STATUS status; + scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); + if (!scm) { syslog(LOG_ERR, "Failed to open service control manager: " "error %d", GetLastError()); - return 1; + return; } - SC_HANDLE service = OpenService(scm, SERVICE_NAME, - SERVICE_ALL_ACCESS|DELETE); - DWORD err = GetLastError(); - CloseServiceHandle(scm); + service = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS|DELETE); + ControlService(service, SERVICE_CONTROL_STOP, &status); if (!service) { - if (err == ERROR_SERVICE_DOES_NOT_EXIST || - err == ERROR_IO_PENDING) - // hello microsoft? anyone home? - { - syslog(LOG_ERR, "Failed to open Box Backup service: " - "not installed or not found"); - } - else - { - syslog(LOG_ERR, "Failed to open Box Backup service: " - "error %d", err); - } - return 1; + syslog(LOG_ERR, "Failed to open Box Backup service: " + "error %d", GetLastError()); + return; } - SERVICE_STATUS status; - if (!ControlService(service, SERVICE_CONTROL_STOP, &status)) + if (DeleteService(service)) { - err = GetLastError(); - if (err != ERROR_SERVICE_NOT_ACTIVE) - { - syslog(LOG_WARNING, "Failed to stop Box Backup " - "service: error %d", err); - } - } - - BOOL deleted = DeleteService(service); - err = GetLastError(); - CloseServiceHandle(service); - - if (deleted) - { syslog(LOG_INFO, "Box Backup service deleted"); - return 0; } - else if (err == ERROR_SERVICE_MARKED_FOR_DELETE) - { - syslog(LOG_ERR, "Failed to remove Box Backup service: " - "it is already being deleted"); - } else { syslog(LOG_ERR, "Failed to remove Box Backup service: " - "error %d", err); + "error %d", GetLastError()); } - return 1; + CloseServiceHandle(service); + CloseServiceHandle(scm); } #endif // WIN32 From boxbackup-dev at fluffy.co.uk Wed Aug 9 09:49:56 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 08:49:56 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r729 - box/chris/merge/bin/bbackupd Message-ID: <20060809084956.6A7A596@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 08:49:54 +0000 (Wed, 09 Aug 2006) New Revision: 729 Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp Log: * Win32ServiceFunctions.cpp - Reindent ServiceMain function to match coding standards and rest of file Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 08:44:56 UTC (rev 728) +++ box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 08:49:54 UTC (rev 729) @@ -95,26 +95,27 @@ VOID ServiceMain(DWORD argc, LPTSTR *argv) { - // initialise service status - gServiceStatus.dwServiceType = SERVICE_WIN32; - gServiceStatus.dwCurrentState = SERVICE_STOPPED; - gServiceStatus.dwControlsAccepted = 0; - gServiceStatus.dwWin32ExitCode = NO_ERROR; - gServiceStatus.dwServiceSpecificExitCode = NO_ERROR; - gServiceStatus.dwCheckPoint = 0; - gServiceStatus.dwWaitHint = 0; + // initialise service status + gServiceStatus.dwServiceType = SERVICE_WIN32; + gServiceStatus.dwCurrentState = SERVICE_STOPPED; + gServiceStatus.dwControlsAccepted = 0; + gServiceStatus.dwWin32ExitCode = NO_ERROR; + gServiceStatus.dwServiceSpecificExitCode = NO_ERROR; + gServiceStatus.dwCheckPoint = 0; + gServiceStatus.dwWaitHint = 0; - gServiceStatusHandle = RegisterServiceCtrlHandler(gServiceName, - ServiceControlHandler); + gServiceStatusHandle = RegisterServiceCtrlHandler(gServiceName, + ServiceControlHandler); - if (gServiceStatusHandle) - { - // service is starting - gServiceStatus.dwCurrentState = SERVICE_START_PENDING; - SetServiceStatus(gServiceStatusHandle, &gServiceStatus); + if (gServiceStatusHandle) + { + // service is starting + gServiceStatus.dwCurrentState = SERVICE_START_PENDING; + SetServiceStatus(gServiceStatusHandle, &gServiceStatus); - // do initialisation here - gStopServiceEvent = CreateEvent( 0, TRUE, FALSE, 0 ); + // do initialisation here + gStopServiceEvent = CreateEvent( 0, TRUE, FALSE, 0 ); + if (!gStopServiceEvent) { gServiceStatus.dwControlsAccepted &= @@ -156,7 +157,7 @@ ~(SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); gServiceStatus.dwCurrentState = SERVICE_STOPPED; SetServiceStatus(gServiceStatusHandle, &gServiceStatus); - } + } } void OurService(void) From boxbackup-dev at fluffy.co.uk Wed Aug 9 10:23:29 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 10:23:29 +0100 (BST) Subject: [Box Backup-dev] [PATCH] Win32 merge [05] bbackupd In-Reply-To: <1155079478.17799.19.camel@avenin.ebourne.me.uk> References: <1155079478.17799.19.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, On Wed, 9 Aug 2006, Martin Ebourne wrote: > Why the chained elseifs? switch would be cleaner and less error prone. I actually find elseifs easier to read. The exact condition being tested is always at hand; there's no break/fallthrough nonsense that can easily confuse, and indentation is not a problem. Besides, I've done a lot of Perl coding, where switch doesn't exist, and Java, where it's effectively useless because there are no integer constants, so I'm out of the habit of using switch. > These should be part of the same changeset that adds the code back into > Daemon.cpp. Then there would be no breakage and everything would be > consistent. Prefer change based merge to file based merge. :) > > Notwithstanding the above, the rest of it looks fine to me. Breaking up into separate patches. First one is at: svn diff -r 728:729 http://bbdev.fluffy.co.uk/svn/box/chris/merge Whitespace fix. Please review. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 10:29:04 2006 From: boxbackup-dev at fluffy.co.uk (Nick Knight) Date: Wed, 9 Aug 2006 10:29:04 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [05] bbackupd In-Reply-To: Message-ID: For compilers switches are more efficient, if's and elsifs if it is the last match then it runs them all, typically a lot of compilers compile switch statements into jump tables (AFAIK). -----Original Message----- From: boxbackup-dev-admin at fluffy.co.uk [mailto:boxbackup-dev-admin at fluffy.co.uk] On Behalf Of Chris Wilson Sent: 09 August 2006 10:23 To: boxbackup-dev at fluffy.co.uk Subject: Re: [Box Backup-dev] [PATCH] Win32 merge [05] bbackupd Hi Martin, On Wed, 9 Aug 2006, Martin Ebourne wrote: > Why the chained elseifs? switch would be cleaner and less error prone. I actually find elseifs easier to read. The exact condition being tested is always at hand; there's no break/fallthrough nonsense that can easily confuse, and indentation is not a problem. Besides, I've done a lot of Perl coding, where switch doesn't exist, and Java, where it's effectively useless because there are no integer=20 constants, so I'm out of the habit of using switch. > These should be part of the same changeset that adds the code back into > Daemon.cpp. Then there would be no breakage and everything would be > consistent. Prefer change based merge to file based merge. :) > > Notwithstanding the above, the rest of it looks fine to me. Breaking up into separate patches. First one is at: svn diff -r 728:729 http://bbdev.fluffy.co.uk/svn/box/chris/merge Whitespace fix. Please review. Cheers, Chris. --=20 _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | _______________________________________________ Boxbackup-dev mailing list Boxbackup-dev at fluffy.co.uk http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Wed Aug 9 10:37:29 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 10:37:29 +0100 (BST) Subject: [Box Backup-dev] [PATCH] Win32 merge [05] bbackupd In-Reply-To: References: Message-ID: Hi Nick, > For compilers switches are more efficient, if's and elsifs if it is the > last match then it runs them all, typically a lot of compilers compile > switch statements into jump tables (AFAIK). Premature optimisation is the root of all evil :-) I'd favour readability over efficiency until we have a measurable efficiency problem (not just a few machine cycles of comparing ints). Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 10:50:05 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Wed, 09 Aug 2006 10:50:05 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [05] bbackupd In-Reply-To: References: <1155079478.17799.19.camel@avenin.ebourne.me.uk> Message-ID: <20060809105005.k1jzl37jb48884w0@ebourne.me.uk> Chris Wilson wrote: > I actually find elseifs easier to read. The exact condition being > tested is always at hand; there's no break/fallthrough nonsense that > can easily confuse, and indentation is not a problem. if (state=3D=3DPending) { ... } else if (state=3DProcessing) { ... } Can't happen with switch. Decent compilers warn these days =20 fortunately. But then decent compilers also warn if you switch an enum =20 value and don't handle all the valid values for it, which they can't =20 do with if/else. With long if/else its not clear that your intent is =20 to handle most or all the cases of a variable, rather than just a =20 disjoint set of conditions. You're right about the fallthrough nonsense so that's why it should =20 always be avoided (except for the simple case of an empty fallthrough =20 so the case labels are together). I prefer to put a block around each =20 case handler with break after it to help make it clear that no =20 fallthrough is happening. The block also helps with local variable =20 scoping which is otherwise a mess in switch statements in C/C++. Not sure how indentation is a problem. Just follow the rest of the code. > Besides, I've done a lot of Perl coding, where switch doesn't exist, > and Java, where it's effectively useless because there are no integer > constants, Ah yes: "You can write Fortran in any language" Usually best to follow the languages idioms, whichever language you are usin= g. > so I'm out of the habit of using switch. Perfectly fair point. ;) > Whitespace fix. Please review. Good to merge. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Wed Aug 9 10:53:58 2006 From: boxbackup-dev at fluffy.co.uk (Nick Knight) Date: Wed, 9 Aug 2006 10:53:58 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [05] bbackupd In-Reply-To: Message-ID: Fair point - my background is DSP's! -----Original Message----- From: boxbackup-dev-admin at fluffy.co.uk [mailto:boxbackup-dev-admin at fluffy.co.uk] On Behalf Of Chris Wilson Sent: 09 August 2006 10:37 To: boxbackup-dev at fluffy.co.uk Subject: RE: [Box Backup-dev] [PATCH] Win32 merge [05] bbackupd Hi Nick, > For compilers switches are more efficient, if's and elsifs if it is the=20 > last match then it runs them all, typically a lot of compilers compile > switch statements into jump tables (AFAIK). Premature optimisation is the root of all evil :-) I'd favour readability=20 over efficiency until we have a measurable efficiency problem (not just a=20 few machine cycles of comparing ints). Cheers, Chris. --=20 _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | _______________________________________________ Boxbackup-dev mailing list Boxbackup-dev at fluffy.co.uk http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Wed Aug 9 10:57:55 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Wed, 09 Aug 2006 10:57:55 +0100 Subject: [Box Backup-dev] [PATCH] Win32 merge [05] bbackupd In-Reply-To: References: Message-ID: <20060809105755.ci7863if0kcgko0k@ebourne.me.uk> Chris Wilson wrote: >> For compilers switches are more efficient, if's and elsifs if it is =20 >> the last match then it runs them all, typically a lot of compilers =20 >> compile switch statements into jump tables (AFAIK). Nick is in general right with that. I'm not sure if any compilers are =20 good enough to optimise an if/else chain into a switch, though I don't =20 see any reason why they shouldn't. > Premature optimisation is the root of all evil :-) Yes, true enough. > I'd favour > readability over efficiency until we have a measurable efficiency > problem (not just a few machine cycles of comparing ints). Definitely. So use switch until if/else is proven to give a =20 significant performance boost. ;-) One other point I forgot in my last mail: You said that if/else is =20 easier to read because the exact condition is always to hand. Of =20 course, this is completely untrue. In a long if/else chain you have to =20 check every single condition above the one you are looking at to see =20 what the actual condition is. I shalln't post on this topic again, I promise. :) Cheers, Martin. From boxbackup-dev at fluffy.co.uk Wed Aug 9 11:00:18 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 10:00:18 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r730 - box/trunk/bin/bbackupd Message-ID: <20060809100018.5DF3296@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 10:00:17 +0000 (Wed, 09 Aug 2006) New Revision: 730 Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp Log: * bin/bbackupd/Win32ServiceFunctions.cpp - Whitespace fix for consistency Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 08:49:54 UTC (rev 729) +++ box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 10:00:17 UTC (rev 730) @@ -95,26 +95,27 @@ VOID ServiceMain(DWORD argc, LPTSTR *argv) { - // initialise service status - gServiceStatus.dwServiceType = SERVICE_WIN32; - gServiceStatus.dwCurrentState = SERVICE_STOPPED; - gServiceStatus.dwControlsAccepted = 0; - gServiceStatus.dwWin32ExitCode = NO_ERROR; - gServiceStatus.dwServiceSpecificExitCode = NO_ERROR; - gServiceStatus.dwCheckPoint = 0; - gServiceStatus.dwWaitHint = 0; + // initialise service status + gServiceStatus.dwServiceType = SERVICE_WIN32; + gServiceStatus.dwCurrentState = SERVICE_STOPPED; + gServiceStatus.dwControlsAccepted = 0; + gServiceStatus.dwWin32ExitCode = NO_ERROR; + gServiceStatus.dwServiceSpecificExitCode = NO_ERROR; + gServiceStatus.dwCheckPoint = 0; + gServiceStatus.dwWaitHint = 0; - gServiceStatusHandle = RegisterServiceCtrlHandler(gServiceName, - ServiceControlHandler); + gServiceStatusHandle = RegisterServiceCtrlHandler(gServiceName, + ServiceControlHandler); - if (gServiceStatusHandle) - { - // service is starting - gServiceStatus.dwCurrentState = SERVICE_START_PENDING; - SetServiceStatus(gServiceStatusHandle, &gServiceStatus); + if (gServiceStatusHandle) + { + // service is starting + gServiceStatus.dwCurrentState = SERVICE_START_PENDING; + SetServiceStatus(gServiceStatusHandle, &gServiceStatus); - // do initialisation here - gStopServiceEvent = CreateEvent( 0, TRUE, FALSE, 0 ); + // do initialisation here + gStopServiceEvent = CreateEvent( 0, TRUE, FALSE, 0 ); + if (!gStopServiceEvent) { gServiceStatus.dwControlsAccepted &= @@ -156,7 +157,7 @@ ~(SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); gServiceStatus.dwCurrentState = SERVICE_STOPPED; SetServiceStatus(gServiceStatusHandle, &gServiceStatus); - } + } } void OurService(void) From boxbackup-dev at fluffy.co.uk Wed Aug 9 13:32:20 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 12:32:20 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r731 - box/chris/merge/bin/bbackupd Message-ID: <20060809123220.4367C96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 12:32:16 +0000 (Wed, 09 Aug 2006) New Revision: 731 Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp Log: * bin/bbackupd/Win32ServiceFunctions.cpp - More cosmetic spacing fixes Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 10:00:17 UTC (rev 730) +++ box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 12:32:16 UTC (rev 731) @@ -114,8 +114,7 @@ SetServiceStatus(gServiceStatusHandle, &gServiceStatus); // do initialisation here - gStopServiceEvent = CreateEvent( 0, TRUE, FALSE, 0 ); - + gStopServiceEvent = CreateEvent(0, TRUE, FALSE, 0); if (!gStopServiceEvent) { gServiceStatus.dwControlsAccepted &= @@ -139,7 +138,7 @@ // we are now running so tell the SCM gServiceStatus.dwControlsAccepted |= - (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); + (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); gServiceStatus.dwCurrentState = SERVICE_RUNNING; SetServiceStatus(gServiceStatusHandle, &gServiceStatus); From boxbackup-dev at fluffy.co.uk Wed Aug 9 13:38:20 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 12:38:20 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r732 - box/chris/merge/bin/bbackupd Message-ID: <20060809123820.E8BFF96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 12:38:20 +0000 (Wed, 09 Aug 2006) New Revision: 732 Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp Log: * bin/bbackupd/Win32ServiceFunctions.cpp - Keep a static char pointer to hold onto the config file name to pass it to ServiceMain (over whose parameters we have no control). - ServiceMain passes the config file name as the parameter of the thread it creates. Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 12:32:16 UTC (rev 731) +++ box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 12:38:20 UTC (rev 732) @@ -93,6 +93,8 @@ // It also returns on any error because the // service cannot start if there is an eror. +static char* spConfigFileName; + VOID ServiceMain(DWORD argc, LPTSTR *argv) { // initialise service status @@ -129,7 +131,7 @@ NULL, 0, RunService, - 0, + spConfigFileName, CREATE_SUSPENDED, NULL); From boxbackup-dev at fluffy.co.uk Wed Aug 9 13:44:02 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 12:44:02 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r733 - box/chris/merge/bin/bbackupd Message-ID: <20060809124402.43EED96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 12:43:59 +0000 (Wed, 09 Aug 2006) New Revision: 733 Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp Log: * Win32ServiceFunctions.cpp - RemoveService() returns a status code, 0 for success, 1 for error - RemoveService() outputs better diagnostic messages on failure Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 12:38:20 UTC (rev 732) +++ box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 12:43:59 UTC (rev 733) @@ -236,42 +236,71 @@ CloseServiceHandle(scm); } -void RemoveService(void) +int RemoveService(void) { - SC_HANDLE service, scm; - SERVICE_STATUS status; + SC_HANDLE scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); - scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); - if (!scm) { syslog(LOG_ERR, "Failed to open service control manager: " "error %d", GetLastError()); - return; + return 1; } - service = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS|DELETE); - ControlService(service, SERVICE_CONTROL_STOP, &status); + SC_HANDLE service = OpenService(scm, SERVICE_NAME, + SERVICE_ALL_ACCESS|DELETE); + DWORD err = GetLastError(); + CloseServiceHandle(scm); if (!service) { - syslog(LOG_ERR, "Failed to open Box Backup service: " - "error %d", GetLastError()); - return; + if (err == ERROR_SERVICE_DOES_NOT_EXIST || + err == ERROR_IO_PENDING) + // hello microsoft? anyone home? + { + syslog(LOG_ERR, "Failed to open Box Backup service: " + "not installed or not found"); + } + else + { + syslog(LOG_ERR, "Failed to open Box Backup service: " + "error %d", err); + } + return 1; } - if (DeleteService(service)) + SERVICE_STATUS status; + if (!ControlService(service, SERVICE_CONTROL_STOP, &status)) { + err = GetLastError(); + if (err != ERROR_SERVICE_NOT_ACTIVE) + { + syslog(LOG_WARNING, "Failed to stop Box Backup " + "service: error %d", err); + } + } + + BOOL deleted = DeleteService(service); + err = GetLastError(); + CloseServiceHandle(service); + + if (deleted) + { syslog(LOG_INFO, "Box Backup service deleted"); + return 0; } + else if (err == ERROR_SERVICE_MARKED_FOR_DELETE) + { + syslog(LOG_ERR, "Failed to remove Box Backup service: " + "it is already being deleted"); + } else { syslog(LOG_ERR, "Failed to remove Box Backup service: " - "error %d", GetLastError()); + "error %d", err); } - CloseServiceHandle(service); - CloseServiceHandle(scm); + return 1; } #endif // WIN32 From boxbackup-dev at fluffy.co.uk Wed Aug 9 13:44:59 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 13:44:59 +0100 (BST) Subject: [Box Backup-dev] COMMIT r731 - box/chris/merge/bin/bbackupd In-Reply-To: <20060809123220.4367C96@s0g0.pems.testserver.co.uk> References: <20060809123220.4367C96@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review for merge: svn diff -r 730:731 http://bbdev.fluffy.co.uk/svn/box/chris/merge Cheers, Chris. On Wed, 9 Aug 2006, subversion at fluffy.co.uk wrote: > Author: chris > Date: 2006-08-09 12:32:16 +0000 (Wed, 09 Aug 2006) > New Revision: 731 > > Modified: > box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp > Log: > * bin/bbackupd/Win32ServiceFunctions.cpp > - More cosmetic spacing fixes -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 13:45:43 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 13:45:43 +0100 (BST) Subject: [Box Backup-dev] COMMIT r732 - box/chris/merge/bin/bbackupd In-Reply-To: <20060809123820.E8BFF96@s0g0.pems.testserver.co.uk> References: <20060809123820.E8BFF96@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review for merge: svn diff -r 731:732 http://bbdev.fluffy.co.uk/svn/box/chris/merge > * bin/bbackupd/Win32ServiceFunctions.cpp > - Keep a static char pointer to hold onto the config file name to > pass it to ServiceMain (over whose parameters we have no control). > - ServiceMain passes the config file name as the parameter of the > thread it creates. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 13:46:55 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 13:46:55 +0100 (BST) Subject: [Box Backup-dev] COMMIT r733 - box/chris/merge/bin/bbackupd In-Reply-To: <20060809124402.43EED96@s0g0.pems.testserver.co.uk> References: <20060809124402.43EED96@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review for merge: svn diff -r 732:733 http://bbdev.fluffy.co.uk/svn/box/chris/merge * Win32ServiceFunctions.cpp - RemoveService() returns a status code, 0 for success, 1 for error - RemoveService() outputs better diagnostic messages on failure - RemoveService() code layout cleanups, makes it clearer that resources are always freed. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 13:51:33 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 12:51:33 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r734 - box/chris/merge/bin/bbackupd Message-ID: <20060809125133.E041896@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 12:51:32 +0000 (Wed, 09 Aug 2006) New Revision: 734 Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h box/chris/merge/bin/bbackupd/bbackupd.cpp Log: * bbackupd.cpp * Win32ServiceFunctions.h - Revert to trunk Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h =================================================================== --- box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h 2006-08-09 12:43:59 UTC (rev 733) +++ box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h 2006-08-09 12:51:32 UTC (rev 734) @@ -12,8 +12,8 @@ #ifndef WIN32SERVICEFUNCTIONS_H #define WIN32SERVICEFUNCTIONS_H -int RemoveService(void); -int InstallService(const char* pConfigFilePath); -void OurService(char* pConfigFileName); +void RemoveService(void); +void InstallService(void); +void OurService(void); #endif Modified: box/chris/merge/bin/bbackupd/bbackupd.cpp =================================================================== --- box/chris/merge/bin/bbackupd/bbackupd.cpp 2006-08-09 12:43:59 UTC (rev 733) +++ box/chris/merge/bin/bbackupd/bbackupd.cpp 2006-08-09 12:51:32 UTC (rev 734) @@ -19,7 +19,7 @@ #include "Win32ServiceFunctions.h" #include "Win32BackupService.h" - extern Win32BackupService* gpDaemonService; + extern Win32BackupService gDaemonService; #endif int main(int argc, const char *argv[]) @@ -28,7 +28,7 @@ #ifdef WIN32 - ::openlog("Box Backup (bbackupd)", LOG_PID, LOG_LOCAL6); + ::openlog("Box Backup (bbackupd)", 0, 0); if(argc == 2 && (::strcmp(argv[1], "--help") == 0 || @@ -40,25 +40,32 @@ } if(argc == 2 && ::strcmp(argv[1], "-r") == 0) { - return RemoveService(); + RemoveService(); + return 0; } - if((argc == 2 || argc == 3) && ::strcmp(argv[1], "-i") == 0) + if(argc == 2 && ::strcmp(argv[1], "-i") == 0) { - const char* config = NULL; - if (argc == 3) - { - config = argv[2]; - } - return InstallService(config); + InstallService(); + return 0; } bool runAsWin32Service = false; - if (argc >= 2 && ::strcmp(argv[1], "--service") == 0) + if (argc == 2 && ::strcmp(argv[1], "--service") == 0) { runAsWin32Service = true; } + + // Under win32 we must initialise the Winsock library + // before using sockets + + WSADATA info; - gpDaemonService = new Win32BackupService(); + if (WSAStartup(0x0101, &info) == SOCKET_ERROR) + { + // box backup will not run without sockets + ::syslog(LOG_ERR, "Failed to initialise Windows Sockets"); + THROW_EXCEPTION(BackupStoreException, Internal) + } EnableBackupRights(); @@ -66,33 +73,20 @@ if (runAsWin32Service) { - syslog(LOG_INFO, "Box Backup service starting"); - - char* config = NULL; - if (argc >= 3) - { - config = strdup(argv[2]); - } - - OurService(config); - - if (config) - { - free(config); - } - - syslog(LOG_INFO, "Box Backup service shut down"); + syslog(LOG_INFO,"Starting Box Backup Service"); + OurService(); } else { - ExitCode = gpDaemonService->Main( + ExitCode = gDaemonService.Main( BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv); } + // Clean up our sockets + WSACleanup(); + ::closelog(); - delete gpDaemonService; - return ExitCode; #else // !WIN32 From boxbackup-dev at fluffy.co.uk Wed Aug 9 13:54:07 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 12:54:07 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r735 - box/chris/merge/bin/bbackupd Message-ID: <20060809125407.7F0EF96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 12:54:05 +0000 (Wed, 09 Aug 2006) New Revision: 735 Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h Log: * Win32ServiceFunctions.h - Header update Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h =================================================================== --- box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h 2006-08-09 12:51:32 UTC (rev 734) +++ box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h 2006-08-09 12:54:05 UTC (rev 735) @@ -12,7 +12,7 @@ #ifndef WIN32SERVICEFUNCTIONS_H #define WIN32SERVICEFUNCTIONS_H -void RemoveService(void); +int RemoveService(void); void InstallService(void); void OurService(void); From boxbackup-dev at fluffy.co.uk Wed Aug 9 13:54:31 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 13:54:31 +0100 (BST) Subject: [Box Backup-dev] COMMIT r733 - box/chris/merge/bin/bbackupd In-Reply-To: References: <20060809124402.43EED96@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, On Wed, 9 Aug 2006, Chris Wilson wrote: > Please review for merge: > > svn diff -r 732:733 http://bbdev.fluffy.co.uk/svn/box/chris/merge Also needs rev 733:734 for the matching header update. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 14:01:19 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Wed, 09 Aug 2006 14:01:19 +0100 Subject: [Box Backup-dev] COMMIT r731 - box/chris/merge/bin/bbackupd In-Reply-To: References: <20060809123220.4367C96@s0g0.pems.testserver.co.uk> Message-ID: <20060809140119.wzjaopk6w0k0gwgo@ebourne.me.uk> Chris Wilson wrote: > Please review for merge: > > svn diff -r 730:731 http://bbdev.fluffy.co.uk/svn/box/chris/merge > >> * bin/bbackupd/Win32ServiceFunctions.cpp >> - More cosmetic spacing fixes Looks fine. I don't think it is necessary to have code review on the spacing fixes, especially in the win32 code. You understand and use the Box coding style so as far as I'm concerned you could commit these straight to trunk - as long as they are whitespace only! Cheers, Martin. From boxbackup-dev at fluffy.co.uk Wed Aug 9 14:02:57 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Wed, 09 Aug 2006 14:02:57 +0100 Subject: [Box Backup-dev] COMMIT r732 - box/chris/merge/bin/bbackupd In-Reply-To: References: <20060809123820.E8BFF96@s0g0.pems.testserver.co.uk> Message-ID: <20060809140257.cmwwouxvgg8ss4ss@ebourne.me.uk> Chris Wilson wrote: > Please review for merge: > > svn diff -r 731:732 http://bbdev.fluffy.co.uk/svn/box/chris/merge > >> * bin/bbackupd/Win32ServiceFunctions.cpp >> - Keep a static char pointer to hold onto the config file name to >> pass it to ServiceMain (over whose parameters we have no control). >> - ServiceMain passes the config file name as the parameter of the >> thread it creates. I did wonder last night why there was a mixture of char* and const char* for the config file name. I'm guessing it's due to the prototypes on the windows api functions in which case that's all fine. Ok to merge. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Wed Aug 9 14:03:18 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 13:03:18 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r736 - box/trunk/bin/bbackupd Message-ID: <20060809130318.988F896@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 13:03:17 +0000 (Wed, 09 Aug 2006) New Revision: 736 Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp Log: * bin/bbackupd/Win32ServiceFunctions.cpp - Cosmetic white space fixes Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 12:54:05 UTC (rev 735) +++ box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 13:03:17 UTC (rev 736) @@ -114,8 +114,7 @@ SetServiceStatus(gServiceStatusHandle, &gServiceStatus); // do initialisation here - gStopServiceEvent = CreateEvent( 0, TRUE, FALSE, 0 ); - + gStopServiceEvent = CreateEvent(0, TRUE, FALSE, 0); if (!gStopServiceEvent) { gServiceStatus.dwControlsAccepted &= @@ -139,7 +138,7 @@ // we are now running so tell the SCM gServiceStatus.dwControlsAccepted |= - (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); + (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); gServiceStatus.dwCurrentState = SERVICE_RUNNING; SetServiceStatus(gServiceStatusHandle, &gServiceStatus); From boxbackup-dev at fluffy.co.uk Wed Aug 9 14:10:02 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Wed, 09 Aug 2006 14:10:02 +0100 Subject: [Box Backup-dev] COMMIT r733 - box/chris/merge/bin/bbackupd In-Reply-To: References: <20060809124402.43EED96@s0g0.pems.testserver.co.uk> Message-ID: <20060809141002.n4mpzfxwgkw080ww@ebourne.me.uk> Chris Wilson wrote: > Hi Martin, > > Please review for merge: > > svn diff -r 732:733 http://bbdev.fluffy.co.uk/svn/box/chris/merge > > * Win32ServiceFunctions.cpp > - RemoveService() returns a status code, 0 for success, 1 for error > - RemoveService() outputs better diagnostic messages on failure > - RemoveService() code layout cleanups, makes it clearer that resources > are always freed. How can we have a change in function signature and then have the cpp and h files in different commits? For now I wouldn't waste any more time trying to get these commits consistent. Lets just get the stuff into trunk and make sure it builds asap. :) Going forward though, we don't want to work like this. Ok to merge. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Wed Aug 9 14:12:13 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Wed, 09 Aug 2006 14:12:13 +0100 Subject: [Box Backup-dev] COMMIT r733 - box/chris/merge/bin/bbackupd In-Reply-To: References: <20060809124402.43EED96@s0g0.pems.testserver.co.uk> Message-ID: <20060809141213.ggio899ckck84kcc@ebourne.me.uk> Chris Wilson wrote: >> Please review for merge: >> >> svn diff -r 732:733 http://bbdev.fluffy.co.uk/svn/box/chris/merge > > Also needs rev 733:734 for the matching header update. Yes, merge this one of course. :) Martin. From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:21:42 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 17:21:42 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r737 - box/trunk/bin/bbackupd Message-ID: <20060809172142.4E0D196@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 17:21:40 +0000 (Wed, 09 Aug 2006) New Revision: 737 Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp Log: * bin/bbackupd/Win32ServiceFunctions.cpp - Keep a static char pointer to hold onto the config file name to pass it to ServiceMain (over whose parameters we have no control). - ServiceMain passes the config file name as the parameter of the thread it creates. Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 13:03:17 UTC (rev 736) +++ box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 17:21:40 UTC (rev 737) @@ -93,6 +93,8 @@ // It also returns on any error because the // service cannot start if there is an eror. +static char* spConfigFileName; + VOID ServiceMain(DWORD argc, LPTSTR *argv) { // initialise service status @@ -129,7 +131,7 @@ NULL, 0, RunService, - 0, + spConfigFileName, CREATE_SUSPENDED, NULL); From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:24:54 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 17:24:54 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r738 - box/trunk/bin/bbackupd Message-ID: <20060809172454.F1F4F96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 17:24:47 +0000 (Wed, 09 Aug 2006) New Revision: 738 Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp box/trunk/bin/bbackupd/Win32ServiceFunctions.h Log: * bin/bbackupd/Win32ServiceFunctions.cpp * bin/bbackupd/Win32ServiceFunctions.h - RemoveService() returns a status code, 0 for success, 1 for error - RemoveService() outputs better diagnostic messages on failure - RemoveService() code layout cleanups, makes it clearer that resources are always freed. Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 17:21:40 UTC (rev 737) +++ box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 17:24:47 UTC (rev 738) @@ -236,42 +236,71 @@ CloseServiceHandle(scm); } -void RemoveService(void) +int RemoveService(void) { - SC_HANDLE service, scm; - SERVICE_STATUS status; + SC_HANDLE scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); - scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); - if (!scm) { syslog(LOG_ERR, "Failed to open service control manager: " "error %d", GetLastError()); - return; + return 1; } - service = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS|DELETE); - ControlService(service, SERVICE_CONTROL_STOP, &status); + SC_HANDLE service = OpenService(scm, SERVICE_NAME, + SERVICE_ALL_ACCESS|DELETE); + DWORD err = GetLastError(); + CloseServiceHandle(scm); if (!service) { - syslog(LOG_ERR, "Failed to open Box Backup service: " - "error %d", GetLastError()); - return; + if (err == ERROR_SERVICE_DOES_NOT_EXIST || + err == ERROR_IO_PENDING) + // hello microsoft? anyone home? + { + syslog(LOG_ERR, "Failed to open Box Backup service: " + "not installed or not found"); + } + else + { + syslog(LOG_ERR, "Failed to open Box Backup service: " + "error %d", err); + } + return 1; } - if (DeleteService(service)) + SERVICE_STATUS status; + if (!ControlService(service, SERVICE_CONTROL_STOP, &status)) { + err = GetLastError(); + if (err != ERROR_SERVICE_NOT_ACTIVE) + { + syslog(LOG_WARNING, "Failed to stop Box Backup " + "service: error %d", err); + } + } + + BOOL deleted = DeleteService(service); + err = GetLastError(); + CloseServiceHandle(service); + + if (deleted) + { syslog(LOG_INFO, "Box Backup service deleted"); + return 0; } + else if (err == ERROR_SERVICE_MARKED_FOR_DELETE) + { + syslog(LOG_ERR, "Failed to remove Box Backup service: " + "it is already being deleted"); + } else { syslog(LOG_ERR, "Failed to remove Box Backup service: " - "error %d", GetLastError()); + "error %d", err); } - CloseServiceHandle(service); - CloseServiceHandle(scm); + return 1; } #endif // WIN32 Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.h =================================================================== --- box/trunk/bin/bbackupd/Win32ServiceFunctions.h 2006-08-09 17:21:40 UTC (rev 737) +++ box/trunk/bin/bbackupd/Win32ServiceFunctions.h 2006-08-09 17:24:47 UTC (rev 738) @@ -12,7 +12,7 @@ #ifndef WIN32SERVICEFUNCTIONS_H #define WIN32SERVICEFUNCTIONS_H -void RemoveService(void); +int RemoveService(void); void InstallService(void); void OurService(void); From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:27:50 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 17:27:50 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r739 - box/chris/merge/bin/bbackupd Message-ID: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 17:27:46 +0000 (Wed, 09 Aug 2006) New Revision: 739 Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h box/chris/merge/bin/bbackupd/bbackupd.cpp Log: * bin/bbackupd/Win32ServiceFunctions.h * bin/bbackupd/Win32ServiceFunctions.cpp - InstallService() and OurService() take the config file name as a parameter - InstallService() returns an integer status code like RemoveService() - OurService() sets the global static config file name to pass into the main thread later * bin/bbackupd/bbackupd.cpp - Call InstallService() and OurService() with the config file name as a parameter Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 17:24:47 UTC (rev 738) +++ box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 17:27:46 UTC (rev 739) @@ -161,8 +161,10 @@ } } -void OurService(void) +void OurService(char* pConfigFileName) { + spConfigFileName = pConfigFileName; + SERVICE_TABLE_ENTRY serviceTable[] = { { SERVICE_NAME, (LPSERVICE_MAIN_FUNCTION) ServiceMain }, @@ -181,7 +183,7 @@ } } -void InstallService(void) +int InstallService(const char* pConfigFileName) { SC_HANDLE newService, scm; @@ -191,7 +193,7 @@ { syslog(LOG_ERR, "Failed to open service control manager: " "error %d", GetLastError()); - return; + return 1; } char cmd[MAX_PATH]; @@ -217,7 +219,7 @@ { ::syslog(LOG_ERR, "Failed to create Box Backup service: " "error %d", GetLastError()); - return; + return 1; } ::syslog(LOG_INFO, "Created Box Backup service"); @@ -234,6 +236,8 @@ CloseServiceHandle(newService); CloseServiceHandle(scm); + + return 0; } int RemoveService(void) Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h =================================================================== --- box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h 2006-08-09 17:24:47 UTC (rev 738) +++ box/chris/merge/bin/bbackupd/Win32ServiceFunctions.h 2006-08-09 17:27:46 UTC (rev 739) @@ -12,8 +12,8 @@ #ifndef WIN32SERVICEFUNCTIONS_H #define WIN32SERVICEFUNCTIONS_H -int RemoveService(void); -void InstallService(void); -void OurService(void); +int RemoveService (void); +int InstallService (const char* pConfigFilePath); +void OurService (char* pConfigFileName); #endif Modified: box/chris/merge/bin/bbackupd/bbackupd.cpp =================================================================== --- box/chris/merge/bin/bbackupd/bbackupd.cpp 2006-08-09 17:24:47 UTC (rev 738) +++ box/chris/merge/bin/bbackupd/bbackupd.cpp 2006-08-09 17:27:46 UTC (rev 739) @@ -43,14 +43,19 @@ RemoveService(); return 0; } - if(argc == 2 && ::strcmp(argv[1], "-i") == 0) + if((argc == 2 || argc == 3) && ::strcmp(argv[1], "-i") == 0) { - InstallService(); + const char* config = NULL; + if (argc == 3) + { + config = argv[2]; + } + InstallService(config); return 0; } bool runAsWin32Service = false; - if (argc == 2 && ::strcmp(argv[1], "--service") == 0) + if (argc >= 2 && ::strcmp(argv[1], "--service") == 0) { runAsWin32Service = true; } @@ -73,8 +78,22 @@ if (runAsWin32Service) { - syslog(LOG_INFO,"Starting Box Backup Service"); - OurService(); + syslog(LOG_INFO, "Box Backup service starting"); + + char* config = NULL; + if (argc >= 3) + { + config = strdup(argv[2]); + } + + OurService(config); + + if (config) + { + free(config); + } + + syslog(LOG_INFO, "Box Backup service shut down"); } else { From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:30:05 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 17:30:05 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r740 - box/chris/merge/bin/bbackupd Message-ID: <20060809173005.B1D8C96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 17:29:59 +0000 (Wed, 09 Aug 2006) New Revision: 740 Modified: box/chris/merge/bin/bbackupd/bbackupd.cpp Log: * bbackupd.cpp - Return the status code from InstallService() and RemoveService() as exit code (0 on success, 1 on failure) Modified: box/chris/merge/bin/bbackupd/bbackupd.cpp =================================================================== --- box/chris/merge/bin/bbackupd/bbackupd.cpp 2006-08-09 17:27:46 UTC (rev 739) +++ box/chris/merge/bin/bbackupd/bbackupd.cpp 2006-08-09 17:29:59 UTC (rev 740) @@ -40,8 +40,7 @@ } if(argc == 2 && ::strcmp(argv[1], "-r") == 0) { - RemoveService(); - return 0; + return RemoveService(); } if((argc == 2 || argc == 3) && ::strcmp(argv[1], "-i") == 0) { @@ -50,8 +49,7 @@ { config = argv[2]; } - InstallService(config); - return 0; + return InstallService(config); } bool runAsWin32Service = false; From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:39:30 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 17:39:30 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r741 - box/chris/merge/bin/bbackupd Message-ID: <20060809173930.6DA0196@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 17:39:28 +0000 (Wed, 09 Aug 2006) New Revision: 741 Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp Log: * bin/bbackupd/Win32ServiceFunctions.cpp - Improved diagnostic output if InstallService() fails - Ensure that InstallService() cleans up all resources - Check that the requested configuration file is accessible - Include the configuration file in the service parameters Modified: box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 17:29:59 UTC (rev 740) +++ box/chris/merge/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 17:39:28 UTC (rev 741) @@ -185,10 +185,28 @@ int InstallService(const char* pConfigFileName) { - SC_HANDLE newService, scm; + if (pConfigFileName != NULL) + { + struct stat st; - scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); + if (emu_stat(pConfigFileName, &st) != 0) + { + syslog(LOG_ERR, "Failed to open configuration file: " + "%s: %s", pConfigFileName, strerror(errno)); + return 1; + } + if (! st.st_mode & S_IFREG) + { + + syslog(LOG_ERR, "Failed to open configuration file: " + "%s: not a file", pConfigFileName); + return 1; + } + } + + SC_HANDLE scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); + if (!scm) { syslog(LOG_ERR, "Failed to open service control manager: " @@ -200,11 +218,17 @@ GetModuleFileName(NULL, cmd, sizeof(cmd)-1); cmd[sizeof(cmd)-1] = 0; - char cmd_args[MAX_PATH]; - _snprintf(cmd_args, sizeof(cmd_args)-1, "%s --service", cmd); - cmd_args[sizeof(cmd_args)-1] = 0; + std::string cmdWithArgs(cmd); + cmdWithArgs += " --service"; - newService = CreateService( + if (pConfigFileName != NULL) + { + cmdWithArgs += " \""; + cmdWithArgs += pConfigFileName; + cmdWithArgs += "\""; + } + + SC_HANDLE newService = CreateService( scm, SERVICE_NAME, "Box Backup", @@ -212,13 +236,45 @@ SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, - cmd_args, + cmdWithArgs.c_str(), 0,0,0,0,0); + DWORD err = GetLastError(); + CloseServiceHandle(scm); + if (!newService) { - ::syslog(LOG_ERR, "Failed to create Box Backup service: " - "error %d", GetLastError()); + switch (err) + { + case ERROR_SERVICE_EXISTS: + { + ::syslog(LOG_ERR, "Failed to create Box Backup " + "service: it already exists"); + } + break; + + case ERROR_SERVICE_MARKED_FOR_DELETE: + { + ::syslog(LOG_ERR, "Failed to create Box Backup " + "service: it is waiting to be deleted"); + } + break; + + case ERROR_DUPLICATE_SERVICE_NAME: + { + ::syslog(LOG_ERR, "Failed to create Box Backup " + "service: a service with this name " + "already exists"); + } + break; + + default: + { + ::syslog(LOG_ERR, "Failed to create Box Backup " + "service: error %d", err); + } + } + return 1; } @@ -235,7 +291,6 @@ } CloseServiceHandle(newService); - CloseServiceHandle(scm); return 0; } From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:40:35 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 18:40:35 +0100 (BST) Subject: [Box Backup-dev] COMMIT r739 - box/chris/merge/bin/bbackupd In-Reply-To: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> References: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review 738:739 for merge. * bin/bbackupd/Win32ServiceFunctions.h * bin/bbackupd/Win32ServiceFunctions.cpp - InstallService() and OurService() take the config file name as a parameter - InstallService() returns an integer status code like RemoveService() - OurService() sets the global static config file name to pass into the main thread later * bin/bbackupd/bbackupd.cpp - Call InstallService() and OurService() with the config file name as a parameter Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:41:11 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 18:41:11 +0100 (BST) Subject: [Box Backup-dev] COMMIT r740 - box/chris/merge/bin/bbackupd In-Reply-To: <20060809173005.B1D8C96@s0g0.pems.testserver.co.uk> References: <20060809173005.B1D8C96@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review 739:740 for merge. * bbackupd.cpp - Return the status code from InstallService() and RemoveService() as exit code (0 on success, 1 on failure) Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:41:43 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 18:41:43 +0100 (BST) Subject: [Box Backup-dev] COMMIT r741 - box/chris/merge/bin/bbackupd In-Reply-To: <20060809173930.6DA0196@s0g0.pems.testserver.co.uk> References: <20060809173930.6DA0196@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review 740:741 for merge. * bin/bbackupd/Win32ServiceFunctions.cpp - Improved diagnostic output if InstallService() fails - Ensure that InstallService() cleans up all resources - Check that the requested configuration file is accessible - Include the configuration file in the service parameters Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:45:38 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 17:45:38 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r742 - box/chris/merge/bin/bbackupd Message-ID: <20060809174538.C618596@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 17:45:36 +0000 (Wed, 09 Aug 2006) New Revision: 742 Modified: box/chris/merge/bin/bbackupd/Win32BackupService.cpp Log: * bbackupd/Win32BackupService.cpp - Revert to trunk Modified: box/chris/merge/bin/bbackupd/Win32BackupService.cpp =================================================================== --- box/chris/merge/bin/bbackupd/Win32BackupService.cpp 2006-08-09 17:39:28 UTC (rev 741) +++ box/chris/merge/bin/bbackupd/Win32BackupService.cpp 2006-08-09 17:45:36 UTC (rev 742) @@ -12,51 +12,40 @@ #include "Win32BackupService.h" -Win32BackupService* gpDaemonService = NULL; +Win32BackupService gDaemonService; extern HANDLE gStopServiceEvent; unsigned int WINAPI RunService(LPVOID lpParameter) { - DWORD retVal = gpDaemonService->WinService((const char*) lpParameter); - SetEvent(gStopServiceEvent); + DWORD retVal = gDaemonService.WinService(); + SetEvent( gStopServiceEvent ); return retVal; } void TerminateService(void) { - gpDaemonService->SetTerminateWanted(); + gDaemonService.SetTerminateWanted(); } -DWORD Win32BackupService::WinService(const char* pConfigFileName) +DWORD Win32BackupService::WinService(void) { - char exepath[MAX_PATH]; - GetModuleFileName(NULL, exepath, sizeof(exepath)); - - std::string configfile; + int argc = 2; + //first off get the path name for the default + char buf[MAX_PATH]; - if (pConfigFileName != NULL) - { - configfile = pConfigFileName; - } - else - { - // make the default config file name, - // based on the program path - configfile = exepath; - configfile = configfile.substr(0, - configfile.rfind(DIRECTORY_SEPARATOR_ASCHAR)); - configfile += DIRECTORY_SEPARATOR "bbackupd.conf"; - } + GetModuleFileName(NULL, buf, sizeof(buf)); + std::string buffer(buf); + std::string conf( "-c"); + std::string cfile(buffer.substr(0,(buffer.find("bbackupd.exe"))) + + "bbackupd.conf"); - const char *argv[] = {exepath, "-c", configfile.c_str()}; - int argc = sizeof(argv) / sizeof(*argv); - DWORD ret; + const char *argv[] = {conf.c_str(), cfile.c_str()}; MAINHELPER_START - ret = this->Main(BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv); - MAINHELPER_END - return ret; + return this->Main(BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv); + + MAINHELPER_END } #endif // WIN32 From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:51:01 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 17:51:01 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r743 - box/chris/merge/bin/bbackupd Message-ID: <20060809175101.130A496@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 17:51:00 +0000 (Wed, 09 Aug 2006) New Revision: 743 Modified: box/chris/merge/bin/bbackupd/Win32BackupService.cpp Log: * bin/bbackupd/Win32BackupService.cpp - Made RunService() pass the configuration file name to Win32BackupService::WinService() - Made WinService() calculate the default configuration file name more sanely and safely - Made WinService() not return before MAINHELPER_END Modified: box/chris/merge/bin/bbackupd/Win32BackupService.cpp =================================================================== --- box/chris/merge/bin/bbackupd/Win32BackupService.cpp 2006-08-09 17:45:36 UTC (rev 742) +++ box/chris/merge/bin/bbackupd/Win32BackupService.cpp 2006-08-09 17:51:00 UTC (rev 743) @@ -17,8 +17,8 @@ unsigned int WINAPI RunService(LPVOID lpParameter) { - DWORD retVal = gDaemonService.WinService(); - SetEvent( gStopServiceEvent ); + DWORD retVal = gDaemonService.WinService((const char*) lpParameter); + SetEvent(gStopServiceEvent); return retVal; } @@ -27,25 +27,36 @@ gDaemonService.SetTerminateWanted(); } -DWORD Win32BackupService::WinService(void) +DWORD Win32BackupService::WinService(const char* pConfigFileName) { - int argc = 2; - //first off get the path name for the default - char buf[MAX_PATH]; + char exepath[MAX_PATH]; + GetModuleFileName(NULL, exepath, sizeof(exepath)); + + std::string configfile; - GetModuleFileName(NULL, buf, sizeof(buf)); - std::string buffer(buf); - std::string conf( "-c"); - std::string cfile(buffer.substr(0,(buffer.find("bbackupd.exe"))) - + "bbackupd.conf"); + if (pConfigFileName != NULL) + { + configfile = pConfigFileName; + } + else + { + // make the default config file name, + // based on the program path + configfile = exepath; + configfile = configfile.substr(0, + configfile.rfind(DIRECTORY_SEPARATOR_ASCHAR)); + configfile += DIRECTORY_SEPARATOR "bbackupd.conf"; + } - const char *argv[] = {conf.c_str(), cfile.c_str()}; + const char *argv[] = {exepath, "-c", configfile.c_str()}; + int argc = sizeof(argv) / sizeof(*argv); + DWORD ret; MAINHELPER_START + ret = this->Main(BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv); + MAINHELPER_END - return this->Main(BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv); - - MAINHELPER_END + return ret; } #endif // WIN32 From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:53:35 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 17:53:35 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r744 - box/chris/merge/bin/bbackupd Message-ID: <20060809175335.92B5C96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 17:53:34 +0000 (Wed, 09 Aug 2006) New Revision: 744 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Reverted to trunk Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-09 17:51:00 UTC (rev 743) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-09 17:53:34 UTC (rev 744) @@ -125,29 +125,6 @@ } #ifdef WIN32 - // Create the event object to signal from main thread to worker - // when new messages are queued to be sent to the command socket. - mhMessageToSendEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - if (mhMessageToSendEvent == INVALID_HANDLE_VALUE) - { - syslog(LOG_ERR, "Failed to create event object: error %d", - GetLastError); - exit(1); - } - - // Create the event object to signal from worker to main thread - // when a command has been received on the command socket. - mhCommandReceivedEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - if (mhCommandReceivedEvent == INVALID_HANDLE_VALUE) - { - syslog(LOG_ERR, "Failed to create event object: error %d", - GetLastError); - exit(1); - } - - // Create the critical section to protect the message queue - InitializeCriticalSection(&mMessageQueueLock); - // Create a thread to handle the named pipe HANDLE hThread; unsigned int dwThreadId; @@ -286,35 +263,16 @@ void BackupDaemon::RunHelperThread(void) { mpCommandSocketInfo = new CommandSocketInfo; - WinNamedPipeStream& rSocket(mpCommandSocketInfo->mListeningSocket); + this->mReceivedCommandConn = false; // loop until the parent process exits - while (!IsTerminateWanted()) + while (TRUE) { try { - rSocket.Accept(BOX_NAMED_PIPE_NAME); - } - catch (BoxException &e) - { - ::syslog(LOG_ERR, "Failed to open command socket: %s", - e.what()); - SetTerminateWanted(); - break; // this is fatal - } - catch (...) - { - ::syslog(LOG_ERR, "Failed to open command socket: " - "unknown error"); - SetTerminateWanted(); - break; // this is fatal - } + mpCommandSocketInfo->mListeningSocket.Accept( + BOX_NAMED_PIPE_NAME); - try - { - // Errors here do not kill the thread, - // only the current connection. - // This next section comes from Ben's original function // Log ::syslog(LOG_INFO, "Connection from command socket"); @@ -331,73 +289,18 @@ conf.GetKeyValueInt("MaxUploadWait"), mState); - rSocket.Write(summary, summarySize); - rSocket.Write("ping\n", 5); + mpCommandSocketInfo->mListeningSocket.Write(summary, summarySize); + mpCommandSocketInfo->mListeningSocket.Write("ping\n", 5); - // old queued messages are not useful - EnterCriticalSection(&mMessageQueueLock); - mMessageList.clear(); - ResetEvent(mhMessageToSendEvent); - LeaveCriticalSection(&mMessageQueueLock); - - IOStreamGetLine readLine(rSocket); + IOStreamGetLine readLine(mpCommandSocketInfo->mListeningSocket); std::string command; - while (rSocket.IsConnected() && !IsTerminateWanted()) + while (mpCommandSocketInfo->mListeningSocket.IsConnected() && + readLine.GetLine(command) ) { - HANDLE handles[2]; - handles[0] = mhMessageToSendEvent; - handles[1] = rSocket.GetReadableEvent(); + TRACE1("Receiving command '%s' over " + "command socket\n", command.c_str()); - DWORD result = WaitForMultipleObjects( - sizeof(handles)/sizeof(*handles), - handles, FALSE, 1000); - - if (result == 0) - { - ResetEvent(mhMessageToSendEvent); - - EnterCriticalSection(&mMessageQueueLock); - try - { - while (mMessageList.size() > 0) - { - std::string message = *(mMessageList.begin()); - mMessageList.erase(mMessageList.begin()); - printf("Sending '%s' to waiting client... ", message.c_str()); - message += "\n"; - rSocket.Write(message.c_str(), - message.length()); - - printf("done.\n"); - } - } - catch (...) - { - LeaveCriticalSection(&mMessageQueueLock); - throw; - } - LeaveCriticalSection(&mMessageQueueLock); - continue; - } - else if (result == WAIT_TIMEOUT) - { - continue; - } - else if (result != 1) - { - ::syslog(LOG_ERR, "WaitForMultipleObjects returned invalid result %d", result); - continue; - } - - if (!readLine.GetLine(command)) - { - ::syslog(LOG_ERR, "Failed to read line"); - continue; - } - - printf("Received command '%s' from client\n", command.c_str()); - bool sendOK = false; bool sendResponse = true; bool disconnect = false; @@ -435,18 +338,12 @@ SetTerminateWanted(); sendOK = true; } - else - { - ::syslog(LOG_ERR, "Received unknown command '%s' from client", command.c_str()); - sendResponse = true; - sendOK = false; - } // Send a response back? if (sendResponse) { const char* response = sendOK ? "ok\n" : "error\n"; - rSocket.Write( + mpCommandSocketInfo->mListeningSocket.Write( response, strlen(response)); } @@ -455,10 +352,10 @@ break; } - // this->mReceivedCommandConn = true; + this->mReceivedCommandConn = true; } - rSocket.Close(); + mpCommandSocketInfo->mListeningSocket.Close(); } catch (BoxException &e) { @@ -607,8 +504,8 @@ BackupClientContext::ClientStoreMarker_NotKnown; // haven't contacted the store yet - bool deleteStoreObjectInfoFile = DeserializeStoreObjectInfo( - clientStoreMarker, lastSyncTime, nextSyncTime); + bool deserialised = DeserializeStoreObjectInfo(clientStoreMarker, + lastSyncTime, nextSyncTime); // -------------------------------------------------------------------------------------------- @@ -714,8 +611,7 @@ // Delete the serialised store object file, // so that we don't try to reload it after a // partially completed backup - if(deleteStoreObjectInfoFile && - !DeleteStoreObjectInfo()) + if(deserialised && !DeleteStoreObjectInfo()) { ::syslog(LOG_ERR, "Failed to delete the " "StoreObjectInfoFile, backup cannot " @@ -725,11 +621,6 @@ ::sleep(60); continue; } - - // In case the backup throws an exception, - // we should not try to delete the store info - // object file again. - deleteStoreObjectInfoFile = false; // Do sync bool errorOccurred = false; @@ -838,15 +729,9 @@ // -------------------------------------------------------------------------------------------- - // We had a successful backup, save the store - // info. If we save successfully, we must - // delete the file next time we start a backup + // We had a successful backup, save the store info + SerializeStoreObjectInfo(clientStoreMarker, lastSyncTime, nextSyncTime); - deleteStoreObjectInfoFile = - SerializeStoreObjectInfo( - clientStoreMarker, - lastSyncTime, nextSyncTime); - // -------------------------------------------------------------------------------------------- } catch(BoxException &e) @@ -1017,27 +902,25 @@ void BackupDaemon::WaitOnCommandSocket(box_time_t RequiredDelay, bool &DoSyncFlagOut, bool &SyncIsForcedOut) { #ifdef WIN32 - DWORD requiredDelayMs = BoxTimeToMilliSeconds(RequiredDelay); + // Really could use some interprocess protection, mutex etc + // any side effect should be too bad???? :) + DWORD timeout = (DWORD)BoxTimeToMilliSeconds(RequiredDelay); - DWORD result = WaitForSingleObject(mhCommandReceivedEvent, - (DWORD)requiredDelayMs); - - if (result == WAIT_OBJECT_0) + while ( this->mReceivedCommandConn == false ) { - DoSyncFlagOut = this->mDoSyncFlagOut; - SyncIsForcedOut = this->mSyncIsForcedOut; - ResetEvent(mhCommandReceivedEvent); + Sleep(1); + + if ( timeout == 0 ) + { + DoSyncFlagOut = false; + SyncIsForcedOut = false; + return; + } + timeout--; } - else if (result == WAIT_TIMEOUT) - { - DoSyncFlagOut = false; - SyncIsForcedOut = false; - } - else - { - ::syslog(LOG_ERR, "Unexpected result from " - "WaitForSingleObject: error %d", GetLastError()); - } + this->mReceivedCommandConn = false; + DoSyncFlagOut = this->mDoSyncFlagOut; + SyncIsForcedOut = this->mSyncIsForcedOut; return; #else // ! WIN32 @@ -1070,7 +953,7 @@ { #ifdef PLATFORM_CANNOT_FIND_PEER_UID_OF_UNIX_SOCKET bool uidOK = true; - ::syslog(LOG_WARNING, "On this platform, no security check can be made on the credentials of peers connecting to the command socket. (bbackupctl)"); + ::syslog(LOG_WARNING, "On this platform, no security check can be made on the credientials of peers connecting to the command socket. (bbackupctl)"); #else // Security check -- does the process connecting to this socket have // the same UID as this process? @@ -1140,13 +1023,8 @@ while(mpCommandSocketInfo->mpGetLine != 0 && !mpCommandSocketInfo->mpGetLine->IsEOF() && mpCommandSocketInfo->mpGetLine->GetLine(command, false /* no preprocessing */, timeout)) { - TRACE1("Receiving command '%s' over command socket\n", - command.c_str()); - - #ifdef WIN32 - SetEvent(mhCommandReceivedEvent); - #endif - + TRACE1("Receiving command '%s' over command socket\n", command.c_str()); + bool sendOK = false; bool sendResponse = true; @@ -1259,9 +1137,13 @@ // -------------------------------------------------------------------------- void BackupDaemon::SendSyncStartOrFinish(bool SendStart) { - // The bbackupctl program can't rely on a state change, because it - // may never change if the server doesn't need to be contacted. + // The bbackupctl program can't rely on a state change, because it may never + // change if the server doesn't need to be contacted. +#ifdef __MINGW32__ +#warning race condition: what happens if socket is closed? +#endif + if (mpCommandSocketInfo != NULL && #ifdef WIN32 mpCommandSocketInfo->mListeningSocket.IsConnected() @@ -1270,18 +1152,15 @@ #endif ) { - std::string message = SendStart ? "start-sync" : "finish-sync"; + const char* message = SendStart ? "start-sync\n" : "finish-sync\n"; try { #ifdef WIN32 - EnterCriticalSection(&mMessageQueueLock); - mMessageList.push_back(message); - SetEvent(mhMessageToSendEvent); - LeaveCriticalSection(&mMessageQueueLock); + mpCommandSocketInfo->mListeningSocket.Write(message, + (int)strlen(message)); #else - message += "\n"; - mpCommandSocketInfo->mpConnectedSocket->Write( - message.c_str(), message.size()); + mpCommandSocketInfo->mpConnectedSocket->Write(message, + strlen(message)); #endif } catch(...) @@ -1877,37 +1756,40 @@ // command socket if there's an error char newState[64]; - sprintf(newState, "state %d", State); - std::string message = newState; + char newStateSize = sprintf(newState, "state %d\n", State); #ifdef WIN32 - EnterCriticalSection(&mMessageQueueLock); - mMessageList.push_back(newState); - SetEvent(mhMessageToSendEvent); - LeaveCriticalSection(&mMessageQueueLock); -#else - message += "\n"; + #ifndef _MSC_VER + #warning FIX ME: race condition + #endif - if(mpCommandSocketInfo == 0) + // what happens if the socket is closed by the other thread before + // we can write to it? Null pointer deref at best. + if (mpCommandSocketInfo && + mpCommandSocketInfo->mListeningSocket.IsConnected()) { - return; + try + { + mpCommandSocketInfo->mListeningSocket.Write(newState, newStateSize); + } + catch(...) + { + CloseCommandConnection(); + } } - - if (mpCommandSocketInfo->mpConnectedSocket.get() == 0) +#else + if(mpCommandSocketInfo != 0 && mpCommandSocketInfo->mpConnectedSocket.get() != 0) { - return; + // Something connected to the command socket, tell it about the new state + try + { + mpCommandSocketInfo->mpConnectedSocket->Write(newState, newStateSize); + } + catch(...) + { + CloseCommandConnection(); + } } - - // Something connected to the command socket, tell it about the new state - try - { - mpCommandSocketInfo->mpConnectedSocket->Write(message.c_str(), - message.length()); - } - catch(...) - { - CloseCommandConnection(); - } #endif } @@ -2291,11 +2173,11 @@ static const std::string STOREOBJECTINFO_MAGIC_ID_STRING = "BBACKUPD-STATE"; static const int STOREOBJECTINFO_VERSION = 1; -bool BackupDaemon::SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const +void BackupDaemon::SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const { if(!GetConfiguration().KeyExists("StoreObjectInfoFile")) { - return false; + return; } std::string StoreObjectInfoFile = @@ -2303,17 +2185,13 @@ if (StoreObjectInfoFile.size() <= 0) { - return false; + return; } - bool created = false; - try { FileStream aFile(StoreObjectInfoFile.c_str(), O_WRONLY | O_CREAT | O_TRUNC); - created = true; - Archive anArchive(aFile, 0); anArchive.Write(STOREOBJECTINFO_MAGIC_ID_VALUE); @@ -2358,8 +2236,6 @@ "not accessible or could not be created", StoreObjectInfoFile.c_str()); } - - return created; } // -------------------------------------------------------------------------- From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:55:24 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 17:55:24 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r745 - box/chris/merge/bin/bbackupd Message-ID: <20060809175524.A796496@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 17:55:23 +0000 (Wed, 09 Aug 2006) New Revision: 745 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.h Log: * bin/bbackupd/BackupDaemon.h - Revert to trunk Modified: box/chris/merge/bin/bbackupd/BackupDaemon.h =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.h 2006-08-09 17:53:34 UTC (rev 744) +++ box/chris/merge/bin/bbackupd/BackupDaemon.h 2006-08-09 17:55:23 UTC (rev 745) @@ -46,12 +46,9 @@ ~BackupDaemon(); private: - // methods below do partial (specialized) serialization of - // client state only - bool SerializeStoreObjectInfo(int64_t aClientStoreMarker, - box_time_t theLastSyncTime, box_time_t theNextSyncTime) const; - bool DeserializeStoreObjectInfo(int64_t & aClientStoreMarker, - box_time_t & theLastSyncTime, box_time_t & theNextSyncTime); + // methods below do partial (specialized) serialization of client state only + void SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const; + bool DeserializeStoreObjectInfo(int64_t & aClientStoreMarker, box_time_t & theLastSyncTime, box_time_t & theNextSyncTime); bool DeleteStoreObjectInfo() const; BackupDaemon(const BackupDaemon &); public: @@ -185,10 +182,7 @@ void RunHelperThread(void); private: - bool mDoSyncFlagOut, mSyncIsForcedOut; - HANDLE mhMessageToSendEvent, mhCommandReceivedEvent; - CRITICAL_SECTION mMessageQueueLock; - std::vector mMessageList; + bool mDoSyncFlagOut, mSyncIsForcedOut, mReceivedCommandConn; #endif }; From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:55:44 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 18:55:44 +0100 (BST) Subject: [Box Backup-dev] COMMIT r743 - box/chris/merge/bin/bbackupd In-Reply-To: <20060809175101.130A496@s0g0.pems.testserver.co.uk> References: <20060809175101.130A496@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review 742:743 for merge. * bin/bbackupd/Win32BackupService.cpp - Made RunService() pass the configuration file name to Win32BackupService::WinService() - Made WinService() calculate the default configuration file name more sanely and safely - Made WinService() not return before MAINHELPER_END Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 18:59:56 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 17:59:56 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r746 - box/chris/merge/bin/bbackupd Message-ID: <20060809175956.3532C96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 17:59:53 +0000 (Wed, 09 Aug 2006) New Revision: 746 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp box/chris/merge/bin/bbackupd/BackupDaemon.h Log: * bbackupd/BackupDaemon.h * bbackupd/BackupDaemon.cpp - Made SerializeStoreObjectInfo() return a boolean, true if it successfully saved the store object info file, false otherwise. Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-09 17:55:23 UTC (rev 745) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-09 17:59:53 UTC (rev 746) @@ -2173,11 +2173,11 @@ static const std::string STOREOBJECTINFO_MAGIC_ID_STRING = "BBACKUPD-STATE"; static const int STOREOBJECTINFO_VERSION = 1; -void BackupDaemon::SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const +bool BackupDaemon::SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const { if(!GetConfiguration().KeyExists("StoreObjectInfoFile")) { - return; + return false; } std::string StoreObjectInfoFile = @@ -2185,13 +2185,17 @@ if (StoreObjectInfoFile.size() <= 0) { - return; + return false; } + bool created = false; + try { FileStream aFile(StoreObjectInfoFile.c_str(), O_WRONLY | O_CREAT | O_TRUNC); + created = true; + Archive anArchive(aFile, 0); anArchive.Write(STOREOBJECTINFO_MAGIC_ID_VALUE); @@ -2236,6 +2240,8 @@ "not accessible or could not be created", StoreObjectInfoFile.c_str()); } + + return created; } // -------------------------------------------------------------------------- Modified: box/chris/merge/bin/bbackupd/BackupDaemon.h =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.h 2006-08-09 17:55:23 UTC (rev 745) +++ box/chris/merge/bin/bbackupd/BackupDaemon.h 2006-08-09 17:59:53 UTC (rev 746) @@ -46,9 +46,12 @@ ~BackupDaemon(); private: - // methods below do partial (specialized) serialization of client state only - void SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const; - bool DeserializeStoreObjectInfo(int64_t & aClientStoreMarker, box_time_t & theLastSyncTime, box_time_t & theNextSyncTime); + // methods below do partial (specialized) serialization of + // client state only + bool SerializeStoreObjectInfo(int64_t aClientStoreMarker, + box_time_t theLastSyncTime, box_time_t theNextSyncTime) const; + bool DeserializeStoreObjectInfo(int64_t & aClientStoreMarker, + box_time_t & theLastSyncTime, box_time_t & theNextSyncTime); bool DeleteStoreObjectInfo() const; BackupDaemon(const BackupDaemon &); public: From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:11:50 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 19:11:50 +0100 (BST) Subject: [Box Backup-dev] COMMIT r746 - box/chris/merge/bin/bbackupd In-Reply-To: <20060809175956.3532C96@s0g0.pems.testserver.co.uk> References: <20060809175956.3532C96@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review 745:746 for merge. * bin/bbackupd/BackupDaemon.h * bin/bbackupd/BackupDaemon.cpp - Made SerializeStoreObjectInfo() return a boolean, true if it successfully saved the store object info file, false otherwise. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:16:28 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 18:16:28 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r747 - box/chris/merge/bin/bbackupd Message-ID: <20060809181628.637B296@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 18:16:21 +0000 (Wed, 09 Aug 2006) New Revision: 747 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Use the result of SerializeStoreObjectInfo, if we failed to serialise (when no file existed) then no need to delete the file on the next run. Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-09 17:59:53 UTC (rev 746) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-09 18:16:21 UTC (rev 747) @@ -504,8 +504,8 @@ BackupClientContext::ClientStoreMarker_NotKnown; // haven't contacted the store yet - bool deserialised = DeserializeStoreObjectInfo(clientStoreMarker, - lastSyncTime, nextSyncTime); + bool deleteStoreObjectInfoFile = DeserializeStoreObjectInfo( + clientStoreMarker, lastSyncTime, nextSyncTime); // -------------------------------------------------------------------------------------------- @@ -611,7 +611,8 @@ // Delete the serialised store object file, // so that we don't try to reload it after a // partially completed backup - if(deserialised && !DeleteStoreObjectInfo()) + if(deleteStoreObjectInfoFile && + !DeleteStoreObjectInfo()) { ::syslog(LOG_ERR, "Failed to delete the " "StoreObjectInfoFile, backup cannot " @@ -621,6 +622,11 @@ ::sleep(60); continue; } + + // In case the backup throws an exception, + // we should not try to delete the store info + // object file again. + deleteStoreObjectInfoFile = false; // Do sync bool errorOccurred = false; @@ -729,9 +735,15 @@ // -------------------------------------------------------------------------------------------- - // We had a successful backup, save the store info - SerializeStoreObjectInfo(clientStoreMarker, lastSyncTime, nextSyncTime); + // We had a successful backup, save the store + // info. If we save successfully, we must + // delete the file next time we start a backup + deleteStoreObjectInfoFile = + SerializeStoreObjectInfo( + clientStoreMarker, + lastSyncTime, nextSyncTime); + // -------------------------------------------------------------------------------------------- } catch(BoxException &e) From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:17:37 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 18:17:37 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r748 - box/chris/merge/bin/bbackupd Message-ID: <20060809181737.9CFE896@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 18:17:36 +0000 (Wed, 09 Aug 2006) New Revision: 748 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp Log: * bbackupd/BackupDaemon.cpp - Cosmetic spelling and formatting fixes Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-09 18:16:21 UTC (rev 747) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-09 18:17:36 UTC (rev 748) @@ -965,7 +965,7 @@ { #ifdef PLATFORM_CANNOT_FIND_PEER_UID_OF_UNIX_SOCKET bool uidOK = true; - ::syslog(LOG_WARNING, "On this platform, no security check can be made on the credientials of peers connecting to the command socket. (bbackupctl)"); + ::syslog(LOG_WARNING, "On this platform, no security check can be made on the credentials of peers connecting to the command socket. (bbackupctl)"); #else // Security check -- does the process connecting to this socket have // the same UID as this process? @@ -1149,8 +1149,8 @@ // -------------------------------------------------------------------------- void BackupDaemon::SendSyncStartOrFinish(bool SendStart) { - // The bbackupctl program can't rely on a state change, because it may never - // change if the server doesn't need to be contacted. + // The bbackupctl program can't rely on a state change, because it + // may never change if the server doesn't need to be contacted. #ifdef __MINGW32__ #warning race condition: what happens if socket is closed? From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:20:07 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 19:20:07 +0100 (BST) Subject: [Box Backup-dev] COMMIT r747 - box/chris/merge/bin/bbackupd In-Reply-To: <20060809181628.637B296@s0g0.pems.testserver.co.uk> References: <20060809181628.637B296@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review 746:747 for merge. * bin/bbackupd/BackupDaemon.cpp - Use the result of SerializeStoreObjectInfo, if we failed to serialise (when no file existed) then no need to delete the file on the next run. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:20:34 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 19:20:34 +0100 (BST) Subject: [Box Backup-dev] COMMIT r748 - box/chris/merge/bin/bbackupd In-Reply-To: <20060809181737.9CFE896@s0g0.pems.testserver.co.uk> References: <20060809181737.9CFE896@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review 747:748 for merge. * bin/bbackupd/BackupDaemon.cpp - Cosmetic spelling and formatting fixes Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:28:38 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 18:28:38 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r749 - box/chris/merge/bin/bbackupd Message-ID: <20060809182838.3208996@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 18:28:35 +0000 (Wed, 09 Aug 2006) New Revision: 749 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Made the code more readable by defining a reference rSocket to mpCommandSocketInfo->mListeningSocket which is used several times. - Terminate the listening thread if it fails to bind a command socket. - Log any unrecognised commands received over the command socket. Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-09 18:17:36 UTC (rev 748) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-09 18:28:35 UTC (rev 749) @@ -263,16 +263,36 @@ void BackupDaemon::RunHelperThread(void) { mpCommandSocketInfo = new CommandSocketInfo; - this->mReceivedCommandConn = false; + WinNamedPipeStream& rSocket(mpCommandSocketInfo->mListeningSocket); - // loop until the parent process exits - while (TRUE) + // loop until the parent process exits, or we decide + // to kill the thread ourselves + while (!IsTerminateWanted()) { try { - mpCommandSocketInfo->mListeningSocket.Accept( - BOX_NAMED_PIPE_NAME); + rSocket.Accept(BOX_NAMED_PIPE_NAME); + } + catch (BoxException &e) + { + ::syslog(LOG_ERR, "Failed to open command socket: %s", + e.what()); + SetTerminateWanted(); + break; // this is fatal to listening thread + } + catch (...) + { + ::syslog(LOG_ERR, "Failed to open command socket: " + "unknown error"); + SetTerminateWanted(); + break; // this is fatal to listening thread + } + try + { + // Errors here do not kill the thread, + // only the current connection. + // This next section comes from Ben's original function // Log ::syslog(LOG_INFO, "Connection from command socket"); @@ -289,16 +309,17 @@ conf.GetKeyValueInt("MaxUploadWait"), mState); - mpCommandSocketInfo->mListeningSocket.Write(summary, summarySize); - mpCommandSocketInfo->mListeningSocket.Write("ping\n", 5); + rSocket.Write(summary, summarySize); + rSocket.Write("ping\n", 5); - IOStreamGetLine readLine(mpCommandSocketInfo->mListeningSocket); + IOStreamGetLine readLine(rSocket); std::string command; - while (mpCommandSocketInfo->mListeningSocket.IsConnected() && - readLine.GetLine(command) ) + while (rSocket.IsConnected() && + readLine.GetLine(command) && + !IsTerminateWanted()) { - TRACE1("Receiving command '%s' over " + TRACE1("Received command '%s' over " "command socket\n", command.c_str()); bool sendOK = false; @@ -338,12 +359,18 @@ SetTerminateWanted(); sendOK = true; } + else + { + ::syslog(LOG_ERR, "Received unknown command '%s' from client", command.c_str()); + sendResponse = true; + sendOK = false; + } // Send a response back? if (sendResponse) { const char* response = sendOK ? "ok\n" : "error\n"; - mpCommandSocketInfo->mListeningSocket.Write( + rSocket.Write( response, strlen(response)); } @@ -355,7 +382,7 @@ this->mReceivedCommandConn = true; } - mpCommandSocketInfo->mListeningSocket.Close(); + rSocket.Close(); } catch (BoxException &e) { From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:31:19 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 19:31:19 +0100 (BST) Subject: [Box Backup-dev] COMMIT r749 - box/chris/merge/bin/bbackupd In-Reply-To: <20060809182838.3208996@s0g0.pems.testserver.co.uk> References: <20060809182838.3208996@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review 748:749 for merge. * bin/bbackupd/BackupDaemon.cpp - Made the code more readable by defining a reference rSocket to mpCommandSocketInfo->mListeningSocket which is used several times. - Terminate the listening thread if it fails to bind a command socket. - Log any unrecognised commands received over the command socket. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:36:58 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 18:36:58 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r750 - in box/chris/merge/lib: server win32 Message-ID: <20060809183658.97D6A96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 18:36:54 +0000 (Wed, 09 Aug 2006) New Revision: 750 Added: box/chris/merge/lib/server/WinNamedPipeStream.cpp box/chris/merge/lib/server/WinNamedPipeStream.h Removed: box/chris/merge/lib/win32/WinNamedPipeStream.cpp box/chris/merge/lib/win32/WinNamedPipeStream.h Log: * lib/win32/WinNamedPipeStream.h * lib/win32/WinNamedPipeStream.cpp * lib/server/WinNamedPipeStream.h * lib/server/WinNamedPipeStream.cpp - Moved WinNamedPipeStream class from lib/win32 to lib/server, to resolve circular dependency between lib/common and lib/win32. Copied: box/chris/merge/lib/server/WinNamedPipeStream.cpp (from rev 717, box/chris/merge/lib/win32/WinNamedPipeStream.cpp) Copied: box/chris/merge/lib/server/WinNamedPipeStream.h (from rev 717, box/chris/merge/lib/win32/WinNamedPipeStream.h) Deleted: box/chris/merge/lib/win32/WinNamedPipeStream.cpp =================================================================== --- box/chris/merge/lib/win32/WinNamedPipeStream.cpp 2006-08-09 18:28:35 UTC (rev 749) +++ box/chris/merge/lib/win32/WinNamedPipeStream.cpp 2006-08-09 18:36:54 UTC (rev 750) @@ -1,312 +0,0 @@ -// -------------------------------------------------------------------------- -// -// File -// Name: WinNamedPipeStream.cpp -// Purpose: I/O stream interface for Win32 named pipes -// Created: 2005/12/07 -// -// -------------------------------------------------------------------------- - -#include "Box.h" - -#ifdef WIN32 - -#ifdef HAVE_UNISTD_H - #include -#endif - -#include -#include -#include - -#include "WinNamedPipeStream.h" -#include "ServerException.h" -#include "CommonException.h" -#include "Socket.h" - -#include "MemLeakFindOn.h" - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::WinNamedPipeStream() -// Purpose: Constructor (create stream ready for Open() call) -// Created: 2005/12/07 -// -// -------------------------------------------------------------------------- -WinNamedPipeStream::WinNamedPipeStream() - : mSocketHandle(NULL), - mReadClosed(false), - mWriteClosed(false), - mIsServer(false), - mIsConnected(false) -{ -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::~WinNamedPipeStream() -// Purpose: Destructor, closes stream if open -// Created: 2005/12/07 -// -// -------------------------------------------------------------------------- -WinNamedPipeStream::~WinNamedPipeStream() -{ - if (mSocketHandle != NULL) - { - Close(); - } -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::Accept(const char* Name) -// Purpose: Creates a new named pipe with the given name, -// and wait for a connection on it -// Created: 2005/12/07 -// -// -------------------------------------------------------------------------- -void WinNamedPipeStream::Accept(const wchar_t* pName) -{ - if (mSocketHandle != NULL || mIsConnected) - { - THROW_EXCEPTION(ServerException, SocketAlreadyOpen) - } - - mSocketHandle = CreateNamedPipeW( - pName, // pipe name - PIPE_ACCESS_DUPLEX, // read/write access - PIPE_TYPE_MESSAGE | // message type pipe - PIPE_READMODE_MESSAGE | // message-read mode - PIPE_WAIT, // blocking mode - 1, // max. instances - 4096, // output buffer size - 4096, // input buffer size - NMPWAIT_USE_DEFAULT_WAIT, // client time-out - NULL); // default security attribute - - if (mSocketHandle == NULL) - { - ::syslog(LOG_ERR, "CreateNamedPipeW failed: %d", - GetLastError()); - THROW_EXCEPTION(ServerException, SocketOpenError) - } - - bool connected = ConnectNamedPipe(mSocketHandle, (LPOVERLAPPED) NULL); - - if (!connected) - { - ::syslog(LOG_ERR, "ConnectNamedPipe failed: %d", - GetLastError()); - Close(); - THROW_EXCEPTION(ServerException, SocketOpenError) - } - - mReadClosed = false; - mWriteClosed = false; - mIsServer = true; // must flush and disconnect before closing - mIsConnected = true; -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::Connect(const char* Name) -// Purpose: Opens a connection to a listening named pipe -// Created: 2005/12/07 -// -// -------------------------------------------------------------------------- -void WinNamedPipeStream::Connect(const wchar_t* pName) -{ - if (mSocketHandle != NULL || mIsConnected) - { - THROW_EXCEPTION(ServerException, SocketAlreadyOpen) - } - - mSocketHandle = CreateFileW( - pName, // pipe name - GENERIC_READ | // read and write access - GENERIC_WRITE, - 0, // no sharing - NULL, // default security attributes - OPEN_EXISTING, - 0, // default attributes - NULL); // no template file - - if (mSocketHandle == INVALID_HANDLE_VALUE) - { - ::syslog(LOG_ERR, "Failed to connect to server's named pipe: " - "error %d", GetLastError()); - THROW_EXCEPTION(ServerException, SocketOpenError) - } - - mReadClosed = false; - mWriteClosed = false; - mIsServer = false; // just close the socket - mIsConnected = true; -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::Read(void *pBuffer, int NBytes) -// Purpose: Reads data from stream. Maybe returns less than asked for. -// Created: 2003/07/31 -// -// -------------------------------------------------------------------------- -int WinNamedPipeStream::Read(void *pBuffer, int NBytes, int Timeout) -{ - // TODO no support for timeouts yet - ASSERT(Timeout == IOStream::TimeOutInfinite) - - if (mSocketHandle == NULL || !mIsConnected) - { - THROW_EXCEPTION(ServerException, BadSocketHandle) - } - - DWORD NumBytesRead; - - bool Success = ReadFile( - mSocketHandle, // pipe handle - pBuffer, // buffer to receive reply - NBytes, // size of buffer - &NumBytesRead, // number of bytes read - NULL); // not overlapped - - if (!Success) - { - THROW_EXCEPTION(ConnectionException, Conn_SocketReadError) - } - - // Closed for reading at EOF? - if (NumBytesRead == 0) - { - mReadClosed = true; - } - - return NumBytesRead; -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::Write(void *pBuffer, int NBytes) -// Purpose: Writes data, blocking until it's all done. -// Created: 2003/07/31 -// -// -------------------------------------------------------------------------- -void WinNamedPipeStream::Write(const void *pBuffer, int NBytes) -{ - if (mSocketHandle == NULL || !mIsConnected) - { - THROW_EXCEPTION(ServerException, BadSocketHandle) - } - - // Buffer in byte sized type. - ASSERT(sizeof(char) == 1); - const char *pByteBuffer = (char *)pBuffer; - - int NumBytesWrittenTotal = 0; - - while (NumBytesWrittenTotal < NBytes) - { - DWORD NumBytesWrittenThisTime = 0; - - bool Success = WriteFile( - mSocketHandle, // pipe handle - pByteBuffer + NumBytesWrittenTotal, // message - NBytes - NumBytesWrittenTotal, // message length - &NumBytesWrittenThisTime, // bytes written this time - NULL); // not overlapped - - if (!Success) - { - mWriteClosed = true; // assume can't write again - THROW_EXCEPTION(ConnectionException, - Conn_SocketWriteError) - } - - NumBytesWrittenTotal += NumBytesWrittenThisTime; - } -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::Close() -// Purpose: Closes connection to remote socket -// Created: 2003/07/31 -// -// -------------------------------------------------------------------------- -void WinNamedPipeStream::Close() -{ - if (mSocketHandle == NULL && mIsConnected) - { - fprintf(stderr, "Inconsistent connected state\n"); - ::syslog(LOG_ERR, "Inconsistent connected state"); - mIsConnected = false; - } - - if (mSocketHandle == NULL) - { - THROW_EXCEPTION(ServerException, BadSocketHandle) - } - - if (mIsServer) - { - if (!FlushFileBuffers(mSocketHandle)) - { - ::syslog(LOG_INFO, "FlushFileBuffers failed: %d", - GetLastError()); - } - - if (!DisconnectNamedPipe(mSocketHandle)) - { - ::syslog(LOG_ERR, "DisconnectNamedPipe failed: %d", - GetLastError()); - } - - mIsServer = false; - } - - bool result = CloseHandle(mSocketHandle); - - mSocketHandle = NULL; - mIsConnected = false; - - if (!result) - { - ::syslog(LOG_ERR, "CloseHandle failed: %d", GetLastError()); - THROW_EXCEPTION(ServerException, SocketCloseError) - } -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::StreamDataLeft() -// Purpose: Still capable of reading data? -// Created: 2003/08/02 -// -// -------------------------------------------------------------------------- -bool WinNamedPipeStream::StreamDataLeft() -{ - return !mReadClosed; -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::StreamClosed() -// Purpose: Connection been closed? -// Created: 2003/08/02 -// -// -------------------------------------------------------------------------- -bool WinNamedPipeStream::StreamClosed() -{ - return mWriteClosed; -} - -#endif // WIN32 Deleted: box/chris/merge/lib/win32/WinNamedPipeStream.h =================================================================== --- box/chris/merge/lib/win32/WinNamedPipeStream.h 2006-08-09 18:28:35 UTC (rev 749) +++ box/chris/merge/lib/win32/WinNamedPipeStream.h 2006-08-09 18:36:54 UTC (rev 750) @@ -1,60 +0,0 @@ -// -------------------------------------------------------------------------- -// -// File -// Name: WinNamedPipeStream.h -// Purpose: I/O stream interface for Win32 named pipes -// Created: 2005/12/07 -// -// -------------------------------------------------------------------------- - -#if ! defined WINNAMEDPIPESTREAM__H && defined WIN32 -#define WINNAMEDPIPESTREAM__H - -#include "IOStream.h" - -// -------------------------------------------------------------------------- -// -// Class -// Name: WinNamedPipeStream -// Purpose: I/O stream interface for Win32 named pipes -// Created: 2003/07/31 -// -// -------------------------------------------------------------------------- -class WinNamedPipeStream : public IOStream -{ -public: - WinNamedPipeStream(); - ~WinNamedPipeStream(); - - // server side - create the named pipe and listen for connections - void Accept(const wchar_t* Name); - - // client side - connect to a waiting server - void Connect(const wchar_t* Name); - - // both sides - virtual int Read(void *pBuffer, int NBytes, - int Timeout = IOStream::TimeOutInfinite); - virtual void Write(const void *pBuffer, int NBytes); - virtual void Close(); - virtual bool StreamDataLeft(); - virtual bool StreamClosed(); - bool IsConnected() { return mIsConnected; } - -protected: - HANDLE GetSocketHandle(); - void MarkAsReadClosed() {mReadClosed = true;} - void MarkAsWriteClosed() {mWriteClosed = true;} - -private: - WinNamedPipeStream(const WinNamedPipeStream &rToCopy) - { /* do not call */ } - - HANDLE mSocketHandle; - bool mReadClosed; - bool mWriteClosed; - bool mIsServer; - bool mIsConnected; -}; - -#endif // WINNAMEDPIPESTREAM__H From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:40:56 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 18:40:56 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r751 - box/trunk/bin/bbackupd Message-ID: <20060809184056.74CAD96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 18:40:55 +0000 (Wed, 09 Aug 2006) New Revision: 751 Modified: box/trunk/bin/bbackupd/BackupClientContext.cpp Log: * bin/bbackupd/BackupClientContext.cpp - Increased severity of the "Exceeded storage limits on server -- not uploading changes to files" message, from INFO to WARNING. Modified: box/trunk/bin/bbackupd/BackupClientContext.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupClientContext.cpp 2006-08-09 18:36:54 UTC (rev 750) +++ box/trunk/bin/bbackupd/BackupClientContext.cpp 2006-08-09 18:40:55 UTC (rev 751) @@ -176,7 +176,7 @@ // no -- flag so only things like deletions happen mStorageLimitExceeded = true; // Log - ::syslog(LOG_INFO, "Exceeded storage limits on server -- not uploading changes to files"); + ::syslog(LOG_WARNING, "Exceeded storage limits on server -- not uploading changes to files"); } } catch(...) From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:41:38 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 18:41:38 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r752 - box/trunk/bin/bbackupd Message-ID: <20060809184138.24C0996@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 18:41:36 +0000 (Wed, 09 Aug 2006) New Revision: 752 Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: * BackupClientDirectoryRecord.cpp - Spelling fix Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-09 18:40:55 UTC (rev 751) +++ box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-09 18:41:36 UTC (rev 752) @@ -645,7 +645,7 @@ // Need to update? // // Condition for upload: - // modifiction time within sync period + // modification time within sync period // if it's been seen before but not uploaded, is the time from this first sight longer than the MaxUploadWait // and if we know about it from a directory listing, that it hasn't got the same upload time as on the store if( From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:46:29 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 18:46:29 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r753 - box/trunk/bin/bbackupquery Message-ID: <20060809184629.724BC96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 18:46:23 +0000 (Wed, 09 Aug 2006) New Revision: 753 Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp Log: * BackupQueries.cpp - Trivial comment fix Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/trunk/bin/bbackupquery/BackupQueries.cpp 2006-08-09 18:41:36 UTC (rev 752) +++ box/trunk/bin/bbackupquery/BackupQueries.cpp 2006-08-09 18:46:23 UTC (rev 753) @@ -362,7 +362,7 @@ // -------------------------------------------------------------------------- // // Function -// Name: BackupQueries::CommandList2(int64_t, const std::string &, const bool *) +// Name: BackupQueries::List(int64_t, const std::string &, const bool *) // Purpose: Do the actual listing of directories and files // Created: 2003/10/10 // From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:47:43 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 19:47:43 +0100 (BST) Subject: [Box Backup-dev] COMMIT r750 - in box/chris/merge/lib: server win32 In-Reply-To: <20060809183658.97D6A96@s0g0.pems.testserver.co.uk> References: <20060809183658.97D6A96@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review 749:750 for merge. Added: box/chris/merge/lib/server/WinNamedPipeStream.cpp box/chris/merge/lib/server/WinNamedPipeStream.h Removed: box/chris/merge/lib/win32/WinNamedPipeStream.cpp box/chris/merge/lib/win32/WinNamedPipeStream.h Log: * lib/win32/WinNamedPipeStream.h * lib/win32/WinNamedPipeStream.cpp * lib/server/WinNamedPipeStream.h * lib/server/WinNamedPipeStream.cpp - Moved WinNamedPipeStream class from lib/win32 to lib/server, to resolve circular dependency between lib/common and lib/win32. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:50:20 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 18:50:20 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r754 - box/chris/merge/bin/bbackupquery Message-ID: <20060809185020.4AB8D96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 18:50:19 +0000 (Wed, 09 Aug 2006) New Revision: 754 Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp Log: * bin/bbackupquery/BackupQueries.cpp - Revert to trunk Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/chris/merge/bin/bbackupquery/BackupQueries.cpp 2006-08-09 18:46:23 UTC (rev 753) +++ box/chris/merge/bin/bbackupquery/BackupQueries.cpp 2006-08-09 18:50:19 UTC (rev 754) @@ -70,11 +70,7 @@ mWarnedAboutOwnerAttributes(false), mReturnCode(0) // default return code { - #ifdef WIN32 - mRunningAsRoot = TRUE; - #else mRunningAsRoot = (::geteuid() == 0); - #endif } // -------------------------------------------------------------------------- @@ -89,12 +85,6 @@ { } -typedef struct cmd_info -{ - const char* name; - const char* opts; -} cmd_info_t; - // -------------------------------------------------------------------------- // // Function @@ -172,24 +162,8 @@ } // Data about commands - static cmd_info_t commands[] = - { - { "quit", "" }, - { "exit", "" }, - { "list", "rodIFtTsh", }, - { "pwd", "" }, - { "cd", "od" }, - { "lcd", "" }, - { "sh", "" }, - { "getobject", "" }, - { "get", "i" }, - { "compare", "alcqAE" }, - { "restore", "dri" }, - { "help", "" }, - { "usage", "" }, - { "undelete", "" }, - { NULL, NULL } - }; + static const char *commandNames[] = {"quit", "exit", "list", "pwd", "cd", "lcd", "sh", "getobject", "get", "compare", "restore", "help", "usage", "undelete", 0}; + static const char *validOptions[] = {"", "", "rodIFtsh", "", "od", "", "", "", "i", "alcqE", "dri", "", "", "", 0}; #define COMMAND_Quit 0 #define COMMAND_Exit 1 #define COMMAND_List 2 @@ -209,11 +183,11 @@ // Work out which command it is... int cmd = 0; - while(commands[cmd].name != 0 && ::strcmp(cmdElements[0].c_str(), commands[cmd].name) != 0) + while(commandNames[cmd] != 0 && ::strcmp(cmdElements[0].c_str(), commandNames[cmd]) != 0) { cmd++; } - if(commands[cmd].name == 0) + if(commandNames[cmd] == 0) { // Check for aliases int a; @@ -248,10 +222,9 @@ while(*c != 0) { // Valid option? - if(::strchr(commands[cmd].opts, *c) == NULL) + if(::strchr(validOptions[cmd], *c) == NULL) { - printf("Invalid option '%c' for command %s\n", - *c, commands[cmd].name); + printf("Invalid option '%c' for command %s\n", *c, commandNames[cmd]); return; } opts[(int)*c] = true; @@ -346,9 +319,8 @@ #define LIST_OPTION_ALLOWOLD 'o' #define LIST_OPTION_ALLOWDELETED 'd' #define LIST_OPTION_NOOBJECTID 'I' - #define LIST_OPTION_NOFLAGS 'F' - #define LIST_OPTION_TIMES_LOCAL 't' - #define LIST_OPTION_TIMES_UTC 'T' + #define LIST_OPTION_NOFLAGS 'F' + #define LIST_OPTION_TIMES 't' #define LIST_OPTION_SIZEINBLOCKS 's' #define LIST_OPTION_DISPLAY_HASH 'h' @@ -390,7 +362,7 @@ // -------------------------------------------------------------------------- // // Function -// Name: BackupQueries::List(int64_t, const std::string &, const bool *, bool) +// Name: BackupQueries::List(int64_t, const std::string &, const bool *) // Purpose: Do the actual listing of directories and files // Created: 2003/10/10 // @@ -465,9 +437,9 @@ } } - if(opts[LIST_OPTION_TIMES_LOCAL]) + if(opts[LIST_OPTION_TIMES]) { - // Show local times... + // Show times... std::string time = BoxTimeToISO8601String( en->GetModificationTime()); printf("%s ", time.c_str()); @@ -872,44 +844,13 @@ } // Find object ID somehow - int64_t fileId; - int64_t dirId = GetCurrentDirectoryID(); + int64_t id; std::string localName; - // BLOCK { -#ifdef WIN32 - std::string fileName; - if(!ConvertConsoleToUtf8(args[0].c_str(), fileName)) - return; -#else - std::string fileName(args[0]); -#endif - - if(!opts['i']) - { - // does this remote filename include a path? - std::string::size_type index = fileName.rfind('/'); - if(index != std::string::npos) - { - std::string dirName(fileName.substr(0, index)); - fileName = fileName.substr(index + 1); - - dirId = FindDirectoryObjectID(dirName); - if(dirId == 0) - { - printf("Directory '%s' not found\n", - dirName.c_str()); - return; - } - } - } - - BackupStoreFilenameClear fn(fileName); - // Need to look it up in the current directory mrConnection.QueryListDirectory( - dirId, + GetCurrentDirectoryID(), BackupProtocolClientListDirectory::Flags_File, // just files (opts['i'])?(BackupProtocolClientListDirectory::Flags_EXCLUDE_NOTHING):(BackupProtocolClientListDirectory::Flags_OldVersion | BackupProtocolClientListDirectory::Flags_Deleted), // only current versions false /* don't want attributes */); @@ -922,23 +863,17 @@ if(opts['i']) { // Specified as ID. - fileId = ::strtoll(args[0].c_str(), 0, 16); - if(fileId == std::numeric_limits::min() || - fileId == std::numeric_limits::max() || - fileId == 0) + id = ::strtoll(args[0].c_str(), 0, 16); + if(id == std::numeric_limits::min() || id == std::numeric_limits::max() || id == 0) { printf("Not a valid object ID (specified in hex)\n"); return; } // Check that the item is actually in the directory - if(dir.FindEntryByID(fileId) == 0) + if(dir.FindEntryByID(id) == 0) { - printf("ID '%08llx' not found in current " - "directory on store.\n" - "(You can only download objects by ID " - "from the current directory.)\n", - fileId); + printf("ID '%08llx' not found in current directory on store.\n(You can only download objects by ID from the current directory.)\n", id); return; } @@ -949,22 +884,26 @@ { // Specified by name, find the object in the directory to get the ID BackupStoreDirectory::Iterator i(dir); +#ifdef WIN32 + std::string fileName; + if(!ConvertConsoleToUtf8(args[0].c_str(), fileName)) + return; + BackupStoreFilenameClear fn(fileName); +#else + BackupStoreFilenameClear fn(args[0]); +#endif BackupStoreDirectory::Entry *en = i.FindMatchingClearName(fn); if(en == 0) { - printf("Filename '%s' not found in current " - "directory on store.\n" - "(Subdirectories in path not " - "searched.)\n", args[0].c_str()); + printf("Filename '%s' not found in current directory on store.\n(Subdirectories in path not searched.)\n", args[0].c_str()); return; } - fileId = en->GetObjectID(); + id = en->GetObjectID(); - // Local name is the last argument, which is either - // the looked up filename, or a filename specified - // by the user. + // Local name is the last argument, which is either the looked up filename, or + // a filename specified by the user. localName = args[args.size() - 1]; } } @@ -981,7 +920,7 @@ try { // Request object - mrConnection.QueryGetFile(dirId, fileId); + mrConnection.QueryGetFile(GetCurrentDirectoryID(), id); // Stream containing encoded file std::auto_ptr objectStream(mrConnection.ReceiveStream()); @@ -990,7 +929,7 @@ BackupStoreFile::DecodeFile(*objectStream, localName.c_str(), mrConnection.GetTimeout()); // Done. - printf("Object ID %08llx fetched sucessfully.\n", fileId); + printf("Object ID %08llx fetched sucessfully.\n", id); } catch(...) { @@ -1011,10 +950,8 @@ BackupQueries::CompareParams::CompareParams() : mQuickCompare(false), mIgnoreExcludes(false), - mIgnoreAttributes(false), mDifferences(0), mDifferencesExplainedByModTime(0), - mUncheckedFiles(0), mExcludedDirs(0), mExcludedFiles(0), mpExcludeFiles(0), @@ -1075,7 +1012,6 @@ BackupQueries::CompareParams params; params.mQuickCompare = opts['q']; params.mIgnoreExcludes = opts['E']; - params.mIgnoreAttributes = opts['A']; // Try and work out the time before which all files should be on the server { @@ -1138,29 +1074,13 @@ return; } - printf("\n[ %d (of %d) differences probably due to file " - "modifications after the last upload ]\n" - "Differences: %d (%d dirs excluded, %d files excluded, " - "%d files not checked)\n", - params.mDifferencesExplainedByModTime, params.mDifferences, - params.mDifferences, params.mExcludedDirs, - params.mExcludedFiles, params.mUncheckedFiles); + printf("\n[ %d (of %d) differences probably due to file modifications after the last upload ]\nDifferences: %d (%d dirs excluded, %d files excluded)\n", + params.mDifferencesExplainedByModTime, params.mDifferences, params.mDifferences, params.mExcludedDirs, params.mExcludedFiles); // Set return code? if(opts['c']) { - if (params.mUncheckedFiles != 0) - { - SetReturnCode(COMPARE_RETURN_ERROR); - } - else if (params.mDifferences != 0) - { - SetReturnCode(COMPARE_RETURN_DIFFERENT); - } - else - { - SetReturnCode(COMPARE_RETURN_SAME); - } + SetReturnCode((params.mDifferences == 0)?COMPARE_RETURN_SAME:COMPARE_RETURN_DIFFERENT); } } @@ -1294,13 +1214,11 @@ "(compared to server directory '%s')\n", localDirDisplay.c_str(), storeDirDisplay.c_str()); - rParams.mDifferences ++; } else { printf("ERROR: stat on local dir '%s'\n", localDirDisplay.c_str()); - rParams.mUncheckedFiles ++; } return; } @@ -1350,7 +1268,6 @@ { printf("ERROR: opendir on local dir '%s'\n", localDirDisplay.c_str()); - rParams.mUncheckedFiles ++; return; } try @@ -1538,12 +1455,11 @@ } // Compare attributes - box_time_t fileModTime = 0; BackupClientFileAttributes localAttr; + box_time_t fileModTime = 0; localAttr.ReadAttributes(localPath.c_str(), false /* don't zero mod times */, &fileModTime); modifiedAfterLastSync = (fileModTime > rParams.mLatestFileUploadTime); - if(!rParams.mIgnoreAttributes && - !localAttr.Compare(fileOnServerStream->GetAttributes(), + if(!localAttr.Compare(fileOnServerStream->GetAttributes(), true /* ignore attr mod time */, fileOnServerStream->IsSymLink() /* ignore modification time if it's a symlink */)) { @@ -1638,12 +1554,10 @@ e.GetType(), e.GetSubType(), storePathDisplay.c_str()); - rParams.mUncheckedFiles ++; } catch(...) - { + { printf("ERROR: (unknown) during file fetch and comparison for '%s'\n", storePathDisplay.c_str()); - rParams.mUncheckedFiles ++; } // Remove from set so that we know it's been compared @@ -1879,14 +1793,6 @@ printf("The target directory exists. You cannot restore over an existing directory.\n"); break; - #ifdef WIN32 - case Restore_TargetPathNotFound: - printf("The target directory path does not exist.\n" - "To restore to a directory whose parent " - "does not exist, create the parent first.\n"); - break; - #endif - default: printf("ERROR: Unknown restore result.\n"); break; From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:51:05 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 18:51:05 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r755 - box/chris/merge/bin/bbackupquery Message-ID: <20060809185105.373D396@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 18:50:58 +0000 (Wed, 09 Aug 2006) New Revision: 755 Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp Log: * bbackupquery/BackupQueries.cpp - Don't call geteuid() on Windows, since it lies to us anyway Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/chris/merge/bin/bbackupquery/BackupQueries.cpp 2006-08-09 18:50:19 UTC (rev 754) +++ box/chris/merge/bin/bbackupquery/BackupQueries.cpp 2006-08-09 18:50:58 UTC (rev 755) @@ -70,7 +70,11 @@ mWarnedAboutOwnerAttributes(false), mReturnCode(0) // default return code { + #ifdef WIN32 + mRunningAsRoot = TRUE; + #else mRunningAsRoot = (::geteuid() == 0); + #endif } // -------------------------------------------------------------------------- From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:53:36 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 18:53:36 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r756 - box/chris/merge/bin/bbackupquery Message-ID: <20060809185336.6E19F96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 18:53:34 +0000 (Wed, 09 Aug 2006) New Revision: 756 Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp Log: * bin/bbackupquery/BackupQueries.cpp - Use a nicer data structure for commands and their options. Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/chris/merge/bin/bbackupquery/BackupQueries.cpp 2006-08-09 18:50:58 UTC (rev 755) +++ box/chris/merge/bin/bbackupquery/BackupQueries.cpp 2006-08-09 18:53:34 UTC (rev 756) @@ -89,6 +89,12 @@ { } +typedef struct cmd_info +{ + const char* name; + const char* opts; +} cmd_info_t; + // -------------------------------------------------------------------------- // // Function @@ -166,8 +172,24 @@ } // Data about commands - static const char *commandNames[] = {"quit", "exit", "list", "pwd", "cd", "lcd", "sh", "getobject", "get", "compare", "restore", "help", "usage", "undelete", 0}; - static const char *validOptions[] = {"", "", "rodIFtsh", "", "od", "", "", "", "i", "alcqE", "dri", "", "", "", 0}; + static cmd_info_t commands[] = + { + { "quit", "" }, + { "exit", "" }, + { "list", "rodIFtTsh", }, + { "pwd", "" }, + { "cd", "od" }, + { "lcd", "" }, + { "sh", "" }, + { "getobject", "" }, + { "get", "i" }, + { "compare", "alcqAE" }, + { "restore", "dri" }, + { "help", "" }, + { "usage", "" }, + { "undelete", "" }, + { NULL, NULL } + }; #define COMMAND_Quit 0 #define COMMAND_Exit 1 #define COMMAND_List 2 @@ -187,11 +209,11 @@ // Work out which command it is... int cmd = 0; - while(commandNames[cmd] != 0 && ::strcmp(cmdElements[0].c_str(), commandNames[cmd]) != 0) + while(commands[cmd].name != 0 && ::strcmp(cmdElements[0].c_str(), commands[cmd].name) != 0) { cmd++; } - if(commandNames[cmd] == 0) + if(commands[cmd].name == 0) { // Check for aliases int a; @@ -226,9 +248,10 @@ while(*c != 0) { // Valid option? - if(::strchr(validOptions[cmd], *c) == NULL) + if(::strchr(commands[cmd].opts, *c) == NULL) { - printf("Invalid option '%c' for command %s\n", *c, commandNames[cmd]); + printf("Invalid option '%c' for command %s\n", + *c, commands[cmd].name); return; } opts[(int)*c] = true; From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:53:50 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 19:53:50 +0100 (BST) Subject: [Box Backup-dev] COMMIT r755 - box/chris/merge/bin/bbackupquery In-Reply-To: <20060809185105.373D396@s0g0.pems.testserver.co.uk> References: <20060809185105.373D396@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review 754:755 for merge. * bbackupquery/BackupQueries.cpp - Don't call geteuid() on Windows, since it lies to us anyway Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 19:55:01 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Wed, 9 Aug 2006 19:55:01 +0100 (BST) Subject: [Box Backup-dev] COMMIT r756 - box/chris/merge/bin/bbackupquery In-Reply-To: <20060809185336.6E19F96@s0g0.pems.testserver.co.uk> References: <20060809185336.6E19F96@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review 755:756 for merge. * bin/bbackupquery/BackupQueries.cpp - Use a nicer data structure for commands and their options. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Wed Aug 9 21:04:08 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Wed, 9 Aug 2006 21:04:08 +0100 Subject: [Box Backup-dev] Repository downtime Message-ID: <078B67BF-4CCF-461F-BDFA-82CBD8F6F1BA@fluffy.co.uk> Tomorrow (Thurs 10 Aug 06) at 5pm BST there's going to be a period of brief downtime for the Box Backup SVN repository. It's being moved to a new location kindly provided by James O'Gorman. I expect this downtime to be for a couple of hours or so, mainly for the DNS change to propagate. The repository URLs shouldn't change. The main reason for the move is to get a Trac installation to use, which will be handy and is long overdue. Ben From boxbackup-dev at fluffy.co.uk Wed Aug 9 21:39:52 2006 From: boxbackup-dev at fluffy.co.uk (Per Thomsen) Date: Wed, 09 Aug 2006 13:39:52 -0700 Subject: [Box Backup-dev] Repository downtime In-Reply-To: <078B67BF-4CCF-461F-BDFA-82CBD8F6F1BA@fluffy.co.uk> References: <078B67BF-4CCF-461F-BDFA-82CBD8F6F1BA@fluffy.co.uk> Message-ID: <44DA4818.7020903@reedtz.com> On 8/9/06 1:04 PM, Ben Summers wrote: > The main reason for the move is to get a Trac installation to use, > which will be handy and is long overdue. Yay! Thanks James! Looking forward to being able to use Trac. Thanks, Per -- Per Reedtz Thomsen | Reedtz Consulting, LLC | F: 209 883 4119 V: 209 883 4102 | pthomsen at reedtz.com | C: 209 996 9561 GPG ID: 1209784F | Yahoo! Chat: pthomsen | AIM: pthomsen From boxbackup-dev at fluffy.co.uk Wed Aug 9 21:54:16 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Wed, 09 Aug 2006 21:54:16 +0100 Subject: [Box Backup-dev] Repository downtime In-Reply-To: <44DA4818.7020903@reedtz.com> References: <078B67BF-4CCF-461F-BDFA-82CBD8F6F1BA@fluffy.co.uk> <44DA4818.7020903@reedtz.com> Message-ID: <44DA4B78.10302@netinertia.co.uk> Per Thomsen wrote: > On 8/9/06 1:04 PM, Ben Summers wrote: >> The main reason for the move is to get a Trac installation to use, >> which will be handy and is long overdue. > Yay! Thanks James! Looking forward to being able to use Trac. :-) Not quite sure what to do about the existing wiki pages though. Obviously the existing wiki will still be there, but I have no idea if it's possible to migrate from MediaWiki to Trac, save manually copying everything (thereby losing all revision history). I'm glad FreeBSD is capable of using ACLs now though. Granting users and Apache access to things without giving Apache too much access would be a nightmare without ACLs! James From boxbackup-dev at fluffy.co.uk Wed Aug 9 22:32:22 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Wed, 09 Aug 2006 22:32:22 +0100 Subject: [Box Backup-dev] Repository downtime In-Reply-To: <44DA4818.7020903@reedtz.com> References: <078B67BF-4CCF-461F-BDFA-82CBD8F6F1BA@fluffy.co.uk> <44DA4818.7020903@reedtz.com> Message-ID: <44DA5466.6070906@netinertia.co.uk> Per Thomsen wrote: > Yay! Thanks James! Looking forward to being able to use Trac. Just another thought actually - for the developers who are going to be using features like tickets/roadmaps/etc, can you tell me your desired usernames and I will add permissions appropriately. You'll be able to create your accounts either when DNS has changed, or I can point you at the temporary page. James From boxbackup-dev at fluffy.co.uk Wed Aug 9 23:20:29 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Wed, 09 Aug 2006 23:20:29 +0100 Subject: [Box Backup-dev] Repository downtime In-Reply-To: <44DA4B78.10302@netinertia.co.uk> References: <078B67BF-4CCF-461F-BDFA-82CBD8F6F1BA@fluffy.co.uk> <44DA4818.7020903@reedtz.com> <44DA4B78.10302@netinertia.co.uk> Message-ID: <1155162029.4280.9.camel@avenin.ebourne.me.uk> On Wed, 2006-08-09 at 21:54 +0100, James O'Gorman wrote: > Not quite sure what to do about the existing wiki pages though. > Obviously the existing wiki will still be there, but I have no idea if > it's possible to migrate from MediaWiki to Trac, save manually copying > everything (thereby losing all revision history). http://trac.edgewall.org/wiki/TracFaq#can-i-convert-mediawiki-pages-to-trac Not entirely helpful though. The python script looks uninspiring and no-one seems to have written a suitable Wiki Processor yet. I guess the main options are: 1. Leave the wiki where it is. Would moving it benefit us? 2. See how far you get with the script. 3. Group effort to cut & paste and convert. None of those strike me as clearly the best. Mediawiki's pretty good but we get a lot of spam trouble and it doesn't seem to be well maintained, so that could be a good reason to move. I don't think the history's all that important for the wiki. It's still pretty new anyway, so there's not much of it. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Wed Aug 9 23:51:24 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 22:51:24 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r757 - in box/chris/general: infrastructure lib/common lib/server Message-ID: <20060809225124.A192696@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 22:51:22 +0000 (Wed, 09 Aug 2006) New Revision: 757 Modified: box/chris/general/infrastructure/BoxPlatform.pm.in box/chris/general/infrastructure/makebuildenv.pl.in box/chris/general/lib/common/makeexception.pl.in box/chris/general/lib/server/makeprotocol.pl.in Log: * infrastructure/makebuildenv.pl.in * infrastructure/BoxPlatform.pm.in * lib/server/makeprotocol.pl.in * lib/common/makeexception.pl.in - Reverted "only rewrite if changed" code which doesn't work on Win32 native without Unix or Cygwin Modified: box/chris/general/infrastructure/BoxPlatform.pm.in =================================================================== --- box/chris/general/infrastructure/BoxPlatform.pm.in 2006-08-09 18:53:34 UTC (rev 756) +++ box/chris/general/infrastructure/BoxPlatform.pm.in 2006-08-09 22:51:22 UTC (rev 757) @@ -1,7 +1,7 @@ package BoxPlatform; use Exporter; @ISA = qw/Exporter/; - at EXPORT = qw/$build_os $build_cpu $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 update_if_changed/; + at EXPORT = qw/$build_os $build_cpu $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 { @@ -110,34 +110,5 @@ return $_[0].'=1'; } -sub update_if_changed ($) -{ - my ($file) = @_; - die "$file.new: not found" unless -r "$file.new"; - - if (-r $file) - { - die "$file.new: not found" unless -r "$file.new"; - if (system("diff --brief $file $file.new") == 0) - { - unlink "$file.new"; - return; - } - } - - if (system("cp $file.new $file") != 0) - { - die "failed to copy $file.new to $file"; - } - - if (system("diff --brief $file $file.new") != 0) - { - die "$file and $file.new are still different"; - } - - unlink "$file.new"; - return; -} - 1; Modified: box/chris/general/infrastructure/makebuildenv.pl.in =================================================================== --- box/chris/general/infrastructure/makebuildenv.pl.in 2006-08-09 18:53:34 UTC (rev 756) +++ box/chris/general/infrastructure/makebuildenv.pl.in 2006-08-09 22:51:22 UTC (rev 757) @@ -114,7 +114,7 @@ print "done\n\n"; -# open test main program template file +# open test mail program template file my $test_template_file = 'infrastructure/buildenv-testmain-template.cpp'; open FL,$test_template_file or die "Can't open test template file\n"; my $test_template; @@ -296,8 +296,7 @@ } # write a list of all the modules we've configured to use -open CONFIGURED_MODS,'>local/modules.h.new' or die - "Can't write configured modules list"; +open CONFIGURED_MODS,'>local/modules.h' or die "Can't write configured modules list"; print CONFIGURED_MODS <<__E; // automatically generated file, do not edit #ifndef _CONFIGURED_MODULES__H @@ -313,8 +312,8 @@ #endif // _CONFIGURED_MODULES__H __E close CONFIGURED_MODS; -update_if_changed("local/modules.h"); + # now make a list of all the .h files we can find, recording which module they're in my %hfiles; for my $mod (@modules, @implicit_deps) @@ -394,19 +393,15 @@ { my $testmain = $test_template; $testmain =~ s/TEST_NAME/$name/g; - open TESTMAIN,">$mod/_main.cpp.new" or die - "Can't open test main file for $mod for writing\n"; + open TESTMAIN,">$mod/_main.cpp" or die "Can't open test main file for $mod for writing\n"; print TESTMAIN $testmain; close TESTMAIN; - update_if_changed("$mod/_main.cpp"); # test file... sub writetestfile { my ($filename,$runcmd,$module) = @_; - open TESTFILE,">$filename.new" or die - "Can't open test script file for $module " . - "for writing\n"; + open TESTFILE,">$filename" or die "Can't open test script file for $module for writing\n"; print TESTFILE "#!/bin/sh\necho TEST: $module\n"; if(-d "$module/testfiles") { @@ -425,7 +420,6 @@ } print TESTFILE "$runcmd\n"; close TESTFILE; - update_if_changed($filename); } writetestfile("$mod/_t", @@ -493,8 +487,7 @@ # start the makefile my $mk_name_extra = ($bsd_make)?'':'X'; - open MAKE,">$mod/Makefile".$mk_name_extra.".new" or die - "Can't open Makefile for $mod\n"; + open MAKE,">$mod/Makefile".$mk_name_extra or die "Can't open Makefile for $mod\n"; my $debug_link_extra = ($target_is_library)?'':'../../debug/lib/debug/debug.a'; my $release_flags = "-O2"; @@ -792,8 +785,8 @@ if(!$bsd_make) { # need to post process this into a GNU makefile - open MAKE,">$mod/Makefile.new" or die $!; - open MAKEB,"$mod/MakefileX.new" or die $!; + open MAKE,">$mod/Makefile"; + open MAKEB,"$mod/MakefileX"; while() { @@ -805,10 +798,8 @@ close MAKEB; close MAKE; - unlink "$mod/MakefileX.new"; + unlink "$mod/MakefileX"; } - - update_if_changed("$mod/Makefile"); } print "\nType 'cd ; $make_command' to build a module\n\n"; Modified: box/chris/general/lib/common/makeexception.pl.in =================================================================== --- box/chris/general/lib/common/makeexception.pl.in 2006-08-09 18:53:34 UTC (rev 756) +++ box/chris/general/lib/common/makeexception.pl.in 2006-08-09 22:51:22 UTC (rev 757) @@ -1,11 +1,9 @@ #!@PERL@ -use lib "../../infrastructure"; -use BoxPlatform; - # global exception list file my $global_list = '../../ExceptionCodes.txt'; + my @exception; my @exception_desc; my $class; @@ -48,8 +46,8 @@ # write the code print "Generating $class exception...\n"; -open CPP,">autogen_${class}Exception.cpp.new" or die "Can't open cpp file for writing"; -open H,">autogen_${class}Exception.h.new" or die "Can't open h file for writing"; +open CPP,">autogen_${class}Exception.cpp" or die "Can't open cpp file for writing"; +open H,">autogen_${class}Exception.h" or die "Can't open h file for writing"; # write header file my $guardname = uc 'AUTOGEN_'.$class.'EXCEPTION_H'; @@ -202,9 +200,6 @@ close H; close CPP; -update_if_changed("autogen_${class}Exception.cpp"); -update_if_changed("autogen_${class}Exception.h"); - # update the global exception list my $list_before; my $list_after; Modified: box/chris/general/lib/server/makeprotocol.pl.in =================================================================== --- box/chris/general/lib/server/makeprotocol.pl.in 2006-08-09 18:53:34 UTC (rev 756) +++ box/chris/general/lib/server/makeprotocol.pl.in 2006-08-09 22:51:22 UTC (rev 757) @@ -170,8 +170,8 @@ # open files my $h_filename = 'autogen_'.$protocol_name.'Protocol'.$type.'.h'; -open CPP,'>autogen_'.$protocol_name.'Protocol'.$type.'.cpp.new'; -open H,">$h_filename.new"; +open CPP,'>autogen_'.$protocol_name.'Protocol'.$type.'.cpp'; +open H,">$h_filename"; print CPP <<__E; @@ -915,8 +915,6 @@ close H; close CPP; -update_if_changed('autogen_'.$protocol_name.'Protocol'.$type.'.cpp'); -update_if_changed($h_filename); sub obj_is_type { From boxbackup-dev at fluffy.co.uk Wed Aug 9 23:52:10 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 22:52:10 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r758 - box/chris/general Message-ID: <20060809225210.0416E96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 22:52:09 +0000 (Wed, 09 Aug 2006) New Revision: 758 Modified: box/chris/general/win32.bat Log: * win32.bat - Run the "pl.in" versions, since we can't autogenerate the real ones without autoconf Modified: box/chris/general/win32.bat =================================================================== --- box/chris/general/win32.bat 2006-08-09 22:51:22 UTC (rev 757) +++ box/chris/general/win32.bat 2006-08-09 22:52:09 UTC (rev 758) @@ -5,26 +5,25 @@ copy .\infrastructure\BoxPlatform.pm.in .\infrastructure\BoxPlatform.pm -cd .\bin\bbackupquery\ & perl ./../../bin/bbackupquery/makedocumentation.pl +cd .\bin\bbackupquery\ & perl ./../../bin/bbackupquery/makedocumentation.pl.in cd ..\..\ -cd .\lib\backupclient & perl ./../../lib/common/makeexception.pl BackupStoreException.txt -perl ./../../lib/server/makeprotocol.pl Client ./../../bin/bbstored/backupprotocol.txt +cd .\lib\backupclient & perl ./../../lib/common/makeexception.pl.in BackupStoreException.txt & perl ./../../lib/server/makeprotocol.pl.in Client ./../../bin/bbstored/backupprotocol.txt cd ..\..\ -cd .\lib\compress & perl ./../../lib/common/makeexception.pl CompressException.txt +cd .\lib\compress & perl ./../../lib/common/makeexception.pl.in CompressException.txt cd ..\..\ -cd .\lib\common & perl ./../../lib/common/makeexception.pl CommonException.txt & perl ./../../lib/common/makeexception.pl ConversionException.txt +cd .\lib\common & perl ./../../lib/common/makeexception.pl.in CommonException.txt & perl ./../../lib/common/makeexception.pl.in ConversionException.txt cd ..\..\ -cd .\lib\crypto & perl ./../../lib/common/makeexception.pl CipherException.txt +cd .\lib\crypto & perl ./../../lib/common/makeexception.pl.in CipherException.txt cd ..\..\ echo server parts - which appears as though some of the clients rely on -cd .\lib\server & perl ./../../lib/common/makeexception.pl ServerException.txt & perl ./../../lib/common/makeexception.pl ConnectionException.txt +cd .\lib\server & perl ./../../lib/common/makeexception.pl.in ServerException.txt & perl ./../../lib/common/makeexception.pl.in ConnectionException.txt cd ..\..\ -perl -i.orig -pe 's/@PERL@/perl/' ./test/bbackupd/testfiles/bbackupd.conf +perl -pe 's/@PERL@/perl/' ./test/bbackupd/testfiles/bbackupd.conf.in > .\test\bbackupd\testfiles\bbackupd.conf From boxbackup-dev at fluffy.co.uk Thu Aug 10 00:25:59 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 23:25:59 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r759 - box/chris/general/bin/bbackupd Message-ID: <20060809232559.94E7996@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 23:25:56 +0000 (Wed, 09 Aug 2006) New Revision: 759 Modified: box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp Log: * Win32ServiceFunctions.cpp - Fixed bracketing to avoid precedence problem, misinterpretation by MSVC Modified: box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 22:52:09 UTC (rev 758) +++ box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-09 23:25:56 UTC (rev 759) @@ -196,7 +196,7 @@ return 1; } - if (! st.st_mode & S_IFREG) + if (!(st.st_mode & S_IFREG)) { syslog(LOG_ERR, "Failed to open configuration file: " From boxbackup-dev at fluffy.co.uk Thu Aug 10 00:28:47 2006 From: boxbackup-dev at fluffy.co.uk (Charles Lecklider) Date: Thu, 10 Aug 2006 00:28:47 +0100 Subject: [Box Backup-dev] Win32 compile progress Message-ID: <44DA6FAF.5030705@invis.net> OK, I'm making some progress here after r758. First few things I've run into (all with VC++ 2k5 Express): We have O_BINARY; BoxConfig-MSVC.h needs to define HAVE_DECL_O_BINARY. In emu.h, "typedef uint32_t u_int32_t;" needs to come after the block that defines what uint32_t is.... What is mode_t? VC doesn't have it. That's it so far. If mode_t can be sorted out it looks like I'll get something out the end. I'd submit patches for the above, but the order of BoxConfig-MSVC.h/emu.h looks random to me, which means I probably don't understand the reasoning and will put things in the wrong place.... -C From boxbackup-dev at fluffy.co.uk Thu Aug 10 00:35:49 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 23:35:49 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r760 - box/chris/general/lib/common Message-ID: <20060809233549.EE44296@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 23:35:48 +0000 (Wed, 09 Aug 2006) New Revision: 760 Modified: box/chris/general/lib/common/BoxConfig-MSVC.h Log: * BoxConfig-MSVC.h - Don't define HAVE_SYS_TYPES_H, since we don't want to include because its _ino_t conflicts with our own Modified: box/chris/general/lib/common/BoxConfig-MSVC.h =================================================================== --- box/chris/general/lib/common/BoxConfig-MSVC.h 2006-08-09 23:25:56 UTC (rev 759) +++ box/chris/general/lib/common/BoxConfig-MSVC.h 2006-08-09 23:35:48 UTC (rev 760) @@ -268,7 +268,7 @@ // #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 +// #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_WAIT_H */ From boxbackup-dev at fluffy.co.uk Thu Aug 10 00:39:54 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 23:39:54 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r762 - box/chris/general/lib/common Message-ID: <20060809233954.E473E96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 23:39:54 +0000 (Wed, 09 Aug 2006) New Revision: 762 Modified: box/chris/general/lib/common/BoxPlatform.h Log: * BoxPlatform.h - Removed conflicting definition of pid_t on Win32 (now defined in emu.h) Modified: box/chris/general/lib/common/BoxPlatform.h =================================================================== --- box/chris/general/lib/common/BoxPlatform.h 2006-08-09 23:37:00 UTC (rev 761) +++ box/chris/general/lib/common/BoxPlatform.h 2006-08-09 23:39:54 UTC (rev 762) @@ -102,8 +102,6 @@ #define HAVE_U_INT16_T #define HAVE_U_INT32_T #define HAVE_U_INT64_T - - typedef int pid_t; #endif // WIN32 && !__MINGW32__ // Define missing types From boxbackup-dev at fluffy.co.uk Thu Aug 10 00:41:01 2006 From: boxbackup-dev at fluffy.co.uk (Charles Lecklider) Date: Thu, 10 Aug 2006 00:41:01 +0100 Subject: [Box Backup-dev] COMMIT r760 - box/chris/general/lib/common In-Reply-To: <20060809233549.EE44296@s0g0.pems.testserver.co.uk> References: <20060809233549.EE44296@s0g0.pems.testserver.co.uk> Message-ID: <44DA728D.70801@invis.net> subversion at fluffy.co.uk wrote: > Author: chris > Date: 2006-08-09 23:35:48 +0000 (Wed, 09 Aug 2006) > New Revision: 760 > > Modified: > box/chris/general/lib/common/BoxConfig-MSVC.h > Log: > * BoxConfig-MSVC.h > - Don't define HAVE_SYS_TYPES_H, since we don't want to include > because its _ino_t conflicts with our own It does? This change just broken things for me - VC++ 2k5 Express is now complaining about st_ino in stat.h where it was silent before.... -C From boxbackup-dev at fluffy.co.uk Thu Aug 10 00:41:49 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 23:41:49 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r763 - box/chris/general/lib/common Message-ID: <20060809234149.2B7F496@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 23:41:47 +0000 (Wed, 09 Aug 2006) New Revision: 763 Modified: box/chris/general/lib/common/BoxConfig-MSVC.h Log: * BoxConfig-MSVC.h - We do have O_BINARY on MSVC Modified: box/chris/general/lib/common/BoxConfig-MSVC.h =================================================================== --- box/chris/general/lib/common/BoxConfig-MSVC.h 2006-08-09 23:39:54 UTC (rev 762) +++ box/chris/general/lib/common/BoxConfig-MSVC.h 2006-08-09 23:41:47 UTC (rev 763) @@ -56,6 +56,10 @@ you don't. */ #define HAVE_DECL_XATTR_NOFOLLOW 0 +/* Define to 1 if you have the declaration of `O_BINARY', and to 0 if you + don't. */ +#define HAVE_DECL_O_BINARY 1 + /* Define to 1 if #define of pragmas works */ /* #undef HAVE_DEFINE_PRAGMA */ From boxbackup-dev at fluffy.co.uk Thu Aug 10 00:37:02 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 23:37:02 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r761 - box/chris/general/bin/bbackupquery Message-ID: <20060809233702.6990396@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 23:37:00 +0000 (Wed, 09 Aug 2006) New Revision: 761 Modified: box/chris/general/bin/bbackupquery/BackupQueries.cpp Log: * BackupQueries.cpp - Undefine min and max macros (Win32 stdlib.h) because they break std::numeric_limits Modified: box/chris/general/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/chris/general/bin/bbackupquery/BackupQueries.cpp 2006-08-09 23:35:48 UTC (rev 760) +++ box/chris/general/bin/bbackupquery/BackupQueries.cpp 2006-08-09 23:37:00 UTC (rev 761) @@ -49,6 +49,10 @@ #include "MemLeakFindOn.h" +// min() and max() macros from stdlib.h break numeric_limits<>::min(), etc. +#undef min +#undef max + #define COMPARE_RETURN_SAME 1 #define COMPARE_RETURN_DIFFERENT 2 #define COMPARE_RETURN_ERROR 3 From boxbackup-dev at fluffy.co.uk Thu Aug 10 00:45:06 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 10 Aug 2006 00:45:06 +0100 (BST) Subject: [Box Backup-dev] COMMIT r760 - box/chris/general/lib/common In-Reply-To: <44DA728D.70801@invis.net> References: <20060809233549.EE44296@s0g0.pems.testserver.co.uk> <44DA728D.70801@invis.net> Message-ID: Hi Charles, On Thu, 10 Aug 2006, Charles Lecklider wrote: >> * BoxConfig-MSVC.h >> - Don't define HAVE_SYS_TYPES_H, since we don't want to include >> because its _ino_t conflicts with our own > > It does? This change just broken things for me - VC++ 2k5 Express is > now complaining about st_ino in stat.h where it was silent before.... I thought you weren't able to compile? I wasn't, I'm trying to fix it now. I haven't checked in the updated emu.h yet. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 10 00:49:34 2006 From: boxbackup-dev at fluffy.co.uk (Charles Lecklider) Date: Thu, 10 Aug 2006 00:49:34 +0100 Subject: [Box Backup-dev] COMMIT r760 - box/chris/general/lib/common In-Reply-To: References: <20060809233549.EE44296@s0g0.pems.testserver.co.uk> <44DA728D.70801@invis.net> Message-ID: <44DA748E.3020205@invis.net> Chris Wilson wrote: > Hi Charles, > > On Thu, 10 Aug 2006, Charles Lecklider wrote: > >>> * BoxConfig-MSVC.h >>> - Don't define HAVE_SYS_TYPES_H, since we don't want to include >>> because its _ino_t conflicts with our own >> >> It does? This change just broken things for me - VC++ 2k5 Express is >> now complaining about st_ino in stat.h where it was silent before.... > > I thought you weren't able to compile? I wasn't, I'm trying to fix it > now. I haven't checked in the updated emu.h yet. I edited the files here to see how far I could get; TortoiseSVN has a functioning revert and update, it's just add and commit that cause problems. -C From boxbackup-dev at fluffy.co.uk Thu Aug 10 00:53:19 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 23:53:19 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r764 - box/chris/general/lib/win32 Message-ID: <20060809235319.3F54C96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 23:53:17 +0000 (Wed, 09 Aug 2006) New Revision: 764 Modified: box/chris/general/lib/win32/emu.cpp Log: * emu.cpp - Fixed one compiler warning Modified: box/chris/general/lib/win32/emu.cpp =================================================================== --- box/chris/general/lib/win32/emu.cpp 2006-08-09 23:41:47 UTC (rev 763) +++ box/chris/general/lib/win32/emu.cpp 2006-08-09 23:53:17 UTC (rev 764) @@ -1544,7 +1544,7 @@ return -1; } - int WideSize = BufferSize / 5; + size_t WideSize = BufferSize / 5; WCHAR* pWideBuffer = new WCHAR [WideSize]; if (!pWideBuffer) From boxbackup-dev at fluffy.co.uk Thu Aug 10 00:54:06 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 9 Aug 2006 23:54:06 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r765 - box/chris/general/infrastructure/msvc/2005 Message-ID: <20060809235406.A110296@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-09 23:54:04 +0000 (Wed, 09 Aug 2006) New Revision: 765 Modified: box/chris/general/infrastructure/msvc/2005/common.vcproj Log: * common.vcproj - Replaced the original BoxConfig.h with our customised version Modified: box/chris/general/infrastructure/msvc/2005/common.vcproj =================================================================== --- box/chris/general/infrastructure/msvc/2005/common.vcproj 2006-08-09 23:53:17 UTC (rev 764) +++ box/chris/general/infrastructure/msvc/2005/common.vcproj 2006-08-09 23:54:04 UTC (rev 765) @@ -29,6 +29,9 @@ CommandLine="perl $(InputDir)..\getversion.pl" /> + Author: chris Date: 2006-08-09 23:56:38 +0000 (Wed, 09 Aug 2006) New Revision: 766 Modified: box/chris/general/lib/win32/emu.h Log: * emu.h - First attempt to achieve a more logical order in this chaos - Ensure that _ino_t is consistent everywhere on MSVC - Fixed mode_t not defined before being used Modified: box/chris/general/lib/win32/emu.h =================================================================== --- box/chris/general/lib/win32/emu.h 2006-08-09 23:54:04 UTC (rev 765) +++ box/chris/general/lib/win32/emu.h 2006-08-09 23:56:38 UTC (rev 766) @@ -3,14 +3,46 @@ #if ! defined EMU_INCLUDE && defined WIN32 #define EMU_INCLUDE -#define _INO_T_DEFINED +// basic types, may be required by other headers since we +// don't include sys/types.h +#ifndef __MINGW32__ + typedef unsigned __int64 u_int64_t; + typedef unsigned __int64 uint64_t; + typedef __int64 int64_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int32 u_int32_t; + typedef __int32 int32_t; + typedef unsigned __int16 uint16_t; + typedef __int16 int16_t; + typedef unsigned __int8 uint8_t; + typedef __int8 int8_t; +#endif + +// emulated types, present on MinGW but not MSVC or vice versa + +#ifdef __MINGW32__ + typedef uint32_t u_int32_t; +#else + typedef unsigned int mode_t; + typedef unsigned int pid_t; + + // must define _INO_T_DEFINED before including + // to replace it with our own. + typedef u_int64_t _ino_t; + #define _INO_T_DEFINED +#endif + +// set up to include the necessary parts of Windows headers + #define WIN32_LEAN_AND_MEAN #ifndef __MSVCRT_VERSION__ #define __MSVCRT_VERSION__ 0x0601 #endif +// Windows headers + #include #include #include @@ -25,6 +57,8 @@ #include +// emulated functions + #define gmtime_r( _clock, _result ) \ ( *(_result) = *gmtime( (_clock) ), \ (_result) ) @@ -42,8 +76,6 @@ #define fileno(struct_file) _fileno(struct_file) #endif -typedef uint32_t u_int32_t; - int SetTimerHandler(void (__cdecl *func ) (int)); int setitimer(int type, struct itimerval *timeout, void *arg); void InitTimer(void); @@ -91,7 +123,6 @@ #define S_ISDIR(x) (S_IFDIR & x) #endif - inline int chown(const char * Filename, u_int32_t uid, u_int32_t gid) { //important - this needs implementing @@ -165,17 +196,6 @@ #define tv_nsec tv_usec #ifndef __MINGW32__ - typedef unsigned __int64 u_int64_t; - typedef unsigned __int64 uint64_t; - typedef __int64 int64_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int32 u_int32_t; - typedef __int32 int32_t; - typedef unsigned __int16 uint16_t; - typedef __int16 int16_t; - typedef unsigned __int8 uint8_t; - typedef __int8 int8_t; - typedef int socklen_t; #endif @@ -191,10 +211,6 @@ #define vsnprintf _vsnprintf -#ifndef __MINGW32__ -typedef unsigned int mode_t; -#endif - int emu_mkdir(const char* pPathName); inline int mkdir(const char *pPathName, mode_t mode) @@ -308,11 +324,7 @@ time_t st_mtime; time_t st_ctime; }; - -#ifndef __MINGW32__ -typedef u_int64_t _ino_t; #endif -#endif int emu_stat(const char * name, struct stat * st); int emu_fstat(HANDLE file, struct stat * st); From boxbackup-dev at fluffy.co.uk Thu Aug 10 00:58:56 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 10 Aug 2006 00:58:56 +0100 (BST) Subject: [Box Backup-dev] COMMIT r760 - box/chris/general/lib/common In-Reply-To: <44DA748E.3020205@invis.net> References: <20060809233549.EE44296@s0g0.pems.testserver.co.uk> <44DA728D.70801@invis.net> <44DA748E.3020205@invis.net> Message-ID: Hi Charles, On Thu, 10 Aug 2006, Charles Lecklider wrote: > I edited the files here to see how far I could get; TortoiseSVN has a > functioning revert and update, it's just add and commit that cause > problems. Project now builds for me, and all changes checked in. Feel free to improve emu.h if you can. The order of BoxConfig-MSVC.h matches BoxConfig.h generated by autoconf from configure.in; it shouldn't actually matter at all, although the results of each different type of check done by autoconf should be grouped together (e.g. declaration checks, structure member checks). Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 10 00:59:00 2006 From: boxbackup-dev at fluffy.co.uk (Charles Lecklider) Date: Thu, 10 Aug 2006 00:59:00 +0100 Subject: [Box Backup-dev] COMMIT r766 - box/chris/general/lib/win32 In-Reply-To: <20060809235640.299DA96@s0g0.pems.testserver.co.uk> References: <20060809235640.299DA96@s0g0.pems.testserver.co.uk> Message-ID: <44DA76C4.60605@invis.net> subversion at fluffy.co.uk wrote: > Author: chris > Date: 2006-08-09 23:56:38 +0000 (Wed, 09 Aug 2006) > New Revision: 766 > > Modified: > box/chris/general/lib/win32/emu.h > Log: > * emu.h > - First attempt to achieve a more logical order in this chaos > - Ensure that _ino_t is consistent everywhere on MSVC > - Fixed mode_t not defined before being used OK, that's got it - compiling now. -C From boxbackup-dev at fluffy.co.uk Thu Aug 10 01:22:17 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 10 Aug 2006 01:22:17 +0100 Subject: [Box Backup-dev] COMMIT r759 - box/chris/general/bin/bbackupd In-Reply-To: <20060809232559.94E7996@s0g0.pems.testserver.co.uk> References: <20060809232559.94E7996@s0g0.pems.testserver.co.uk> Message-ID: <1155169337.4280.30.camel@avenin.ebourne.me.uk> On Wed, 2006-08-09 at 23:25 +0000, subversion at fluffy.co.uk wrote: > * Win32ServiceFunctions.cpp > - Fixed bracketing to avoid precedence problem, misinterpretation by MSVC > > - if (! st.st_mode & S_IFREG) > + if (!(st.st_mode & S_IFREG)) MSVC is correct here. ! is higher precedence than &, and ! is of course the logical not operator rather than the bitwise not operator. if (~st.st_mode & S_IFREG) would have worked too, but what you have is probably clearer. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 10 01:49:43 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 10 Aug 2006 01:49:43 +0100 (BST) Subject: [Box Backup-dev] Win32 file attributes of locked files Message-ID: Hi all (especially Charles), I have a bit of a problem with file attributes on Win32. I want people to be able to exclude files like pagefile.sys which are locked, and avoid the usual warnings in the event log whenever we can't open a file for some reason. At the moment, people have to specify either ExcludeFile or ExcludeDir in the Box config, but I can't find a way to find out if such a file is really a file, or a directory. Even GetFileAttributes() returns a sharing violation on pagefile.sys. What can I do? Is there a magic API call that does work? Should I check against both exclude lists, and exclude it without errors if either list matches? Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 10 02:10:06 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 10 Aug 2006 01:10:06 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r767 - box/chris/general/bin/bbackupd Message-ID: <20060810011006.A95FA96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-10 01:10:03 +0000 (Thu, 10 Aug 2006) New Revision: 767 Modified: box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: * bin/bbackupd/BackupClientDirectoryRecord.cpp - Fixed exclusion of files, and display of path names, when backing up the root directory of a drive, or the UNIX root. Modified: box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-09 23:56:38 UTC (rev 766) +++ box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-10 01:10:03 UTC (rev 767) @@ -97,6 +97,32 @@ // -------------------------------------------------------------------------- // // Function +// Name: MakeFullPath(const std::string& rDir, const std::string& rFile) +// Purpose: Combine directory and file name +// Created: 2006/08/10 +// +// -------------------------------------------------------------------------- +static std::string MakeFullPath(const std::string& rDir, + const std::string& rFile) +{ + std::string result; + + if (rDir[rDir.size()-1] == DIRECTORY_SEPARATOR_ASCHAR) + { + result = rDir + rFile; + } + else + { + result = rDir + DIRECTORY_SEPARATOR + rFile; + } + + return result; +} + + +// -------------------------------------------------------------------------- +// +// Function // Name: BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::SyncParams &, int64_t, const std::string &, bool) // Purpose: Syncronise, recusively, a local directory with the server. // Created: 2003/10/08 @@ -207,8 +233,7 @@ } // Stat file to get info - filename = rLocalPath + DIRECTORY_SEPARATOR + - en->d_name; + filename = MakeFullPath(rLocalPath, en->d_name); if(::lstat(filename.c_str(), &st) != 0) { @@ -254,7 +279,7 @@ { continue; } - + // Here if the object is something to back up (file, symlink or dir, not excluded) // So make the information for adding to the checksum checksum_info.mModificationTime = FileModificationTime(st); @@ -512,7 +537,7 @@ f != rFiles.end(); ++f) { // Filename of this file - std::string filename(rLocalPath + DIRECTORY_SEPARATOR + *f); + std::string filename = MakeFullPath(rLocalPath, *f); // Get relevant info about file box_time_t modTime = 0; @@ -859,7 +884,7 @@ d != rDirs.end(); ++d) { // Get the local filename - std::string dirname(rLocalPath + DIRECTORY_SEPARATOR + *d); + std::string dirname = MakeFullPath(rLocalPath, *d); // See if it's in the listing (if we have one) BackupStoreFilenameClear storeFilename(*d); @@ -1063,10 +1088,13 @@ BackupClientDirectoryRecord *rec = e->second; mSubDirectories.erase(e); delete rec; - TRACE2("Deleted directory record for " - "%s" DIRECTORY_SEPARATOR "%s\n", - rLocalPath.c_str(), - dirname.GetClearFilename().c_str()); + + std::string name = MakeFullPath( + rLocalPath, + dirname.GetClearFilename()); + + TRACE1("Deleted directory record for " + "%s\n", name.c_str()); } } } From boxbackup-dev at fluffy.co.uk Thu Aug 10 02:14:13 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 10 Aug 2006 02:14:13 +0100 (BST) Subject: [Box Backup-dev] COMMIT r767 - box/chris/general/bin/bbackupd In-Reply-To: <20060810011006.A95FA96@s0g0.pems.testserver.co.uk> References: <20060810011006.A95FA96@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please consider 766:767 for merge. * bin/bbackupd/BackupClientDirectoryRecord.cpp - Fixed exclusion of files, and display of path names, when backing up the root directory of a drive, or the UNIX root. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 10 02:17:41 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 10 Aug 2006 02:17:41 +0100 (BST) Subject: [Box Backup-dev] COMMIT r758 - box/chris/general In-Reply-To: <20060809225210.0416E96@s0g0.pems.testserver.co.uk> References: <20060809225210.0416E96@s0g0.pems.testserver.co.uk> Message-ID: Hi Martin, Please review 757:758 (from http://bbdev.fluffy.co.uk/svn/box/chris/general) for merge. * win32.bat - Run the "pl.in" versions, since we can't autogenerate the real ones without autoconf Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 10 02:19:54 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 10 Aug 2006 02:19:54 +0100 (BST) Subject: [Box Backup-dev] COMMIT r759 - box/chris/general/bin/bbackupd In-Reply-To: <1155169337.4280.30.camel@avenin.ebourne.me.uk> References: <20060809232559.94E7996@s0g0.pems.testserver.co.uk> <1155169337.4280.30.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, On Thu, 10 Aug 2006, Martin Ebourne wrote: > MSVC is correct here. > > ! is higher precedence than &, and ! is of course the logical not > operator rather than the bitwise not operator. > > if (~st.st_mode & S_IFREG) > would have worked too, but what you have is probably clearer. Thanks for the lesson :-) OK to merge? (after the other patches to Win32ServiceFunctions.cpp) Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 10 02:43:39 2006 From: boxbackup-dev at fluffy.co.uk (Charles Lecklider) Date: Thu, 10 Aug 2006 02:43:39 +0100 Subject: [Box Backup-dev] Win32 file attributes of locked files In-Reply-To: References: Message-ID: <44DA8F4B.1000705@invis.net> Chris Wilson wrote: > Hi all (especially Charles), > > I have a bit of a problem with file attributes on Win32. I want people > to be able to exclude files like pagefile.sys which are locked, and > avoid the usual warnings in the event log whenever we can't open a file > for some reason. At what point in the cycle does box try to get the attributes? I've not got time to dig into this tonight (pile of evil SQL to write for tomorrow...), but: In order to find the file in the first place, surely something like FindFirstFile/FindNextFile was called? In which case the dwFileAttributes field in WIN32_FIND_DATA should have what you need. -C From boxbackup-dev at fluffy.co.uk Thu Aug 10 09:10:38 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 10 Aug 2006 08:10:38 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r768 - box/chris/win32/releases Message-ID: <20060810081038.EB93796@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-10 08:09:28 +0000 (Thu, 10 Aug 2006) New Revision: 768 Added: box/chris/win32/releases/boxbackup-chris_general_767M-backup-client-mingw32.zip Log: * boxbackup-chris_general_767M-backup-client-mingw32.zip - Fixed path problems when backing up root directory of drive Copied: box/chris/win32/releases/boxbackup-chris_general_767M-backup-client-mingw32.zip (from rev 717, box/chris/win32/releases/boxbackup-chris_general_716-backup-client-mingw32.zip) =================================================================== (Binary files differ) From boxbackup-dev at fluffy.co.uk Thu Aug 10 10:11:14 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 10 Aug 2006 09:11:14 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r769 - box/chris/general/test/backupstore Message-ID: <20060810091114.632E996@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-10 09:11:13 +0000 (Thu, 10 Aug 2006) New Revision: 769 Modified: box/chris/general/test/backupstore/testbackupstore.cpp Log: * testbackupstore.cpp - Unix compile fix Modified: box/chris/general/test/backupstore/testbackupstore.cpp =================================================================== --- box/chris/general/test/backupstore/testbackupstore.cpp 2006-08-10 08:09:28 UTC (rev 768) +++ box/chris/general/test/backupstore/testbackupstore.cpp 2006-08-10 09:11:13 UTC (rev 769) @@ -1927,8 +1927,10 @@ return 0; } +#ifdef WIN32 WCHAR* ConvertUtf8ToWideString(const char* pString); std::string ConvertPathToAbsoluteUnicode(const char *pFileName); +#endif int test(int argc, const char *argv[]) { From boxbackup-dev at fluffy.co.uk Thu Aug 10 10:11:37 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 10 Aug 2006 09:11:37 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r770 - box/chris/general/lib/common Message-ID: <20060810091137.B155C96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-10 09:11:37 +0000 (Thu, 10 Aug 2006) New Revision: 770 Modified: box/chris/general/lib/common/Test.h Log: * Test.h - Unix fix Modified: box/chris/general/lib/common/Test.h =================================================================== --- box/chris/general/lib/common/Test.h 2006-08-10 09:11:13 UTC (rev 769) +++ box/chris/general/lib/common/Test.h 2006-08-10 09:11:37 UTC (rev 770) @@ -184,8 +184,14 @@ { if (TestFileExists(pidFile)) break; + + #ifdef WIN32 if (!ServerIsAlive((int)procInfo.dwProcessId)) + #else + if (!ServerIsAlive(pid)) + #endif break; + ::fprintf(stdout, "."); ::fflush(stdout); ::sleep(1); From boxbackup-dev at fluffy.co.uk Thu Aug 10 10:12:18 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 10 Aug 2006 09:12:18 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r771 - box/chris/general/bin/bbstored Message-ID: <20060810091218.0973C96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-10 09:12:17 +0000 (Thu, 10 Aug 2006) New Revision: 771 Modified: box/chris/general/bin/bbstored/BackupStoreDaemon.h Log: * BackupStoreDaemon.h - Hide mHousekeepingInited under Unix (only needed on Win32) Modified: box/chris/general/bin/bbstored/BackupStoreDaemon.h =================================================================== --- box/chris/general/bin/bbstored/BackupStoreDaemon.h 2006-08-10 09:11:37 UTC (rev 770) +++ box/chris/general/bin/bbstored/BackupStoreDaemon.h 2006-08-10 09:12:17 UTC (rev 771) @@ -72,14 +72,14 @@ BackupStoreAccounts *mpAccounts; bool mExtendedLogging; bool mHaveForkedHousekeeping; - bool mIsHousekeepingProcess; #ifdef WIN32 + bool mHousekeepingInited; virtual void OnIdle(); - bool mHousekeepingInited; #else SocketStream mInterProcessCommsSocket; IOStreamGetLine mInterProcessComms; + bool mIsHousekeepingProcess; #endif void HousekeepingInit(); From boxbackup-dev at fluffy.co.uk Thu Aug 10 10:12:40 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 10 Aug 2006 09:12:40 +0000 (GMT) Subject: [Box Backup-dev] COMMIT r772 - box/chris/general/bin/bbstored Message-ID: <20060810091240.0957C96@s0g0.pems.testserver.co.uk> Author: chris Date: 2006-08-10 09:12:39 +0000 (Thu, 10 Aug 2006) New Revision: 772 Modified: box/chris/general/bin/bbstored/BackupStoreDaemon.cpp Log: * BackupStoreDaemon.cpp - Don't initialise mHousekeepingInited on Unix (not needed) Modified: box/chris/general/bin/bbstored/BackupStoreDaemon.cpp =================================================================== --- box/chris/general/bin/bbstored/BackupStoreDaemon.cpp 2006-08-10 09:12:17 UTC (rev 771) +++ box/chris/general/bin/bbstored/BackupStoreDaemon.cpp 2006-08-10 09:12:39 UTC (rev 772) @@ -42,10 +42,11 @@ mExtendedLogging(false), mHaveForkedHousekeeping(false), mIsHousekeepingProcess(false), -#ifndef WIN32 - mInterProcessComms(mInterProcessCommsSocket), +#ifdef WIN32 + mHousekeepingInited(false) +#else + mInterProcessComms(mInterProcessCommsSocket) #endif - mHousekeepingInited(false) { } From boxbackup-dev at fluffy.co.uk Thu Aug 10 10:18:38 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 10 Aug 2006 10:18:38 +0100 (BST) Subject: [Box Backup-dev] Win32 file attributes of locked files In-Reply-To: <44DA8F4B.1000705@invis.net> References: <44DA8F4B.1000705@invis.net> Message-ID: Hi Charles, > At what point in the cycle does box try to get the attributes? > > I've not got time to dig into this tonight (pile of evil SQL to write > for tomorrow...), but: > > In order to find the file in the first place, surely something like > FindFirstFile/FindNextFile was called? In which case the > dwFileAttributes field in WIN32_FIND_DATA should have what you need. You're right, thanks! We're using readdir, but struct dirent has a d_type member. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 10 10:37:11 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 10 Aug 2006 10:37:11 +0100 Subject: [Box Backup-dev] Win32 file attributes of locked files In-Reply-To: References: <44DA8F4B.1000705@invis.net> Message-ID: <20060810103711.v8hg6eby0wg4oow4@ebourne.me.uk> Chris Wilson wrote: > You're right, thanks! We're using readdir, but struct dirent has a > d_type member. Ah, but does it work? Some platforms have the struct member but populate it with the "unknown" value. Hence we have an autoconf check to see if it really works. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 10 18:39:23 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Thu, 10 Aug 2006 18:39:23 +0100 Subject: [Box Backup-dev] Subversion repository moved / Trac now online Message-ID: <44DB6F4B.6020408@netinertia.co.uk> Following yesterday's announcement by Ben, the Subversion repository has now been transferred and is integrated into Trac. The Subversion repository can still be accessed in the normal way, via: http://bbdev.fluffy.co.uk/svn/box Trac is available at: http://bbdev.fluffy.co.uk/trac You can register your account for Trac by using the Register link at the top-right of the page. For developers, if you need enhanced privileges (i.e. modify tickets, etc) then let myself or Ben know. James From boxbackup-dev at fluffy.co.uk Thu Aug 10 18:48:39 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 10 Aug 2006 18:48:39 +0100 (BST) Subject: [Box Backup-dev] [PATCH] Win32 merge [05] bbackupd In-Reply-To: <1155079478.17799.19.camel@avenin.ebourne.me.uk> References: <1155079478.17799.19.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, On Wed, 9 Aug 2006, Martin Ebourne wrote: > There seems to be a change from "Win32BackupService gDaemonService" to > "Win32BackupService* gDaemonService", not sure which of the above that > relates to. Is it this memory leak fix? Yes, if I remember correctly the problem is that Win32BackupService allocates memory in its constructor, which is tracked by Box memory leak detection, but this memory is not deallocated (because the object has not yet been destroyed) by the time we check for memory leaks, so it's reported as an error. I wonder if there's a cleaner solution than making the global object into a global pointer? > I don't like this defining globals in a .cpp file and then declaring > them extern in another .cpp to get access. At the minimum the first .cpp > file's .h file should be declaring them. Encapsulation would be even > nicer if appropriate, I don't know anything about the windows API here > apart from what I can guess from the code, so not sure on this. Well, it was actually an attempt at encapsulation - the global variable is only accessed from one other file, so I didn't want to make it a publicly visible part of the API. By encapsulation, did you mean creating a separate header file for this declaration, or a separate cpp/h file combination for the class in question, or something else? > These should be part of the same changeset that adds the code back into > Daemon.cpp. Then there would be no breakage and everything would be > consistent. Prefer change based merge to file based merge. :) OK, will do when appropriate. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 10 18:49:27 2006 From: boxbackup-dev at fluffy.co.uk (Per Thomsen) Date: Thu, 10 Aug 2006 10:49:27 -0700 Subject: [Box Backup-dev] Subversion repository moved / Trac now online In-Reply-To: <44DB6F4B.6020408@netinertia.co.uk> References: <44DB6F4B.6020408@netinertia.co.uk> Message-ID: <44DB71A7.2030104@reedtz.com> On 8/10/06 10:39 AM, James O'Gorman wrote: > Following yesterday's announcement by Ben, the Subversion repository has > now been transferred and is integrated into Trac. > > The Subversion repository can still be accessed in the normal way, via: > http://bbdev.fluffy.co.uk/svn/box > > Trac is available at: > http://bbdev.fluffy.co.uk/trac > > You can register your account for Trac by using the Register link at the > top-right of the page. For developers, if you need enhanced privileges > (i.e. modify tickets, etc) then let myself or Ben know. > James, It seems that HTTP authentication is in place for the registration. After I type in my desired username/password, I am presented with an HTTP authetication prompt. Please advise. Thanks, Per -- Per Reedtz Thomsen | Reedtz Consulting, LLC | F: 209 883 4119 V: 209 883 4102 | pthomsen at reedtz.com | C: 209 996 9561 GPG ID: 1209784F | Yahoo! Chat: pthomsen | AIM: pthomsen From boxbackup-dev at fluffy.co.uk Thu Aug 10 18:52:00 2006 From: boxbackup-dev at fluffy.co.uk (Per Thomsen) Date: Thu, 10 Aug 2006 10:52:00 -0700 Subject: Never mind! Re: [Box Backup-dev] Subversion repository moved / Trac now online In-Reply-To: <44DB6F4B.6020408@netinertia.co.uk> References: <44DB6F4B.6020408@netinertia.co.uk> Message-ID: <44DB7240.1020804@reedtz.com> On 8/10/06 10:39 AM, James O'Gorman wrote: > Following yesterday's announcement by Ben, the Subversion repository has > now been transferred and is integrated into Trac. > > The Subversion repository can still be accessed in the normal way, via: > http://bbdev.fluffy.co.uk/svn/box > > Trac is available at: > http://bbdev.fluffy.co.uk/trac > > You can register your account for Trac by using the Register link at the > top-right of the page. For developers, if you need enhanced privileges > (i.e. modify tickets, etc) then let myself or Ben know. > Sorry all... I was mistaken... Creating a user was simpler than I thought, and I should have just tried to log in, after I got the prompt. All is well. Sorry again. Thanks, Per -- Per Reedtz Thomsen | Reedtz Consulting, LLC | F: 209 883 4119 V: 209 883 4102 | pthomsen at reedtz.com | C: 209 996 9561 GPG ID: 1209784F | Yahoo! Chat: pthomsen | AIM: pthomsen From boxbackup-dev at fluffy.co.uk Thu Aug 10 18:51:04 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Thu, 10 Aug 2006 18:51:04 +0100 Subject: [Box Backup-dev] Subversion repository moved / Trac now online In-Reply-To: <44DB71A7.2030104@reedtz.com> References: <44DB6F4B.6020408@netinertia.co.uk> <44DB71A7.2030104@reedtz.com> Message-ID: <44DB7208.1030901@netinertia.co.uk> Per Thomsen wrote: > James, > It seems that HTTP authentication is in place for the registration. > After I type in my desired username/password, I am presented with an > HTTP authetication prompt. > > Please advise. That's correct -- it wants you to login, so just enter the username and password you registered. James From boxbackup-dev at fluffy.co.uk Thu Aug 10 20:22:37 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 10 Aug 2006 20:22:37 +0100 (BST) Subject: [Box Backup-dev] Subversion repository moved / Trac now online In-Reply-To: <44DB6F4B.6020408@netinertia.co.uk> References: <44DB6F4B.6020408@netinertia.co.uk> Message-ID: Hi James, On Thu, 10 Aug 2006, James O'Gorman wrote: > Following yesterday's announcement by Ben, the Subversion repository has > now been transferred and is integrated into Trac. > > The Subversion repository can still be accessed in the normal way, via: > http://bbdev.fluffy.co.uk/svn/box Thanks for this. I have a problem, though: I can't log in to Subversion to commit changes. Are the user accounts still valid? I tried to register a new user account with Trac, but it doesn't let me commit with that login either. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 10 20:40:47 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Thu, 10 Aug 2006 20:40:47 +0100 Subject: [Box Backup-dev] Subversion repository moved / Trac now online In-Reply-To: References: <44DB6F4B.6020408@netinertia.co.uk> Message-ID: <44DB8BBF.8090800@netinertia.co.uk> Chris Wilson wrote: > Hi James, > > On Thu, 10 Aug 2006, James O'Gorman wrote: > >> Following yesterday's announcement by Ben, the Subversion repository has >> now been transferred and is integrated into Trac. >> >> The Subversion repository can still be accessed in the normal way, via: >> http://bbdev.fluffy.co.uk/svn/box > > Thanks for this. I have a problem, though: I can't log in to Subversion > to commit changes. Are the user accounts still valid? Yes, it should all be the same... all I can see in the Apache logs is "Password mismatch". Does it work for anyone else? If not, I can change the passwords but I don't see why it wouldn't work. I basically copied Ben's Apache config! > I tried to register a new user account with Trac, but it doesn't let me > commit with that login either. No, trac is only for viewing the repository, not committing. James From boxbackup-dev at fluffy.co.uk Thu Aug 10 20:53:59 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 10 Aug 2006 20:53:59 +0100 Subject: [Box Backup-dev] Subversion repository moved / Trac now online In-Reply-To: <44DB8BBF.8090800@netinertia.co.uk> References: <44DB6F4B.6020408@netinertia.co.uk> <44DB8BBF.8090800@netinertia.co.uk> Message-ID: <1155239639.31087.1.camel@avenin.ebourne.me.uk> On Thu, 2006-08-10 at 20:40 +0100, James O'Gorman wrote: > Chris Wilson wrote: > > Hi James, > > > > On Thu, 10 Aug 2006, James O'Gorman wrote: > > > >> Following yesterday's announcement by Ben, the Subversion repository has > >> now been transferred and is integrated into Trac. > >> > >> The Subversion repository can still be accessed in the normal way, via: > >> http://bbdev.fluffy.co.uk/svn/box > > > > Thanks for this. I have a problem, though: I can't log in to Subversion > > to commit changes. Are the user accounts still valid? > > Yes, it should all be the same... all I can see in the Apache logs is > "Password mismatch". Does it work for anyone else? Doesn't work for me either, even on a fresh checkout. Though I can log into trac now which seems fine. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 10 21:03:25 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Thu, 10 Aug 2006 21:03:25 +0100 Subject: [Box Backup-dev] Subversion repository moved / Trac now online In-Reply-To: <1155239639.31087.1.camel@avenin.ebourne.me.uk> References: <44DB6F4B.6020408@netinertia.co.uk> <44DB8BBF.8090800@netinertia.co.uk> <1155239639.31087.1.camel@avenin.ebourne.me.uk> Message-ID: <44DB910D.4050101@netinertia.co.uk> Martin Ebourne wrote: > Doesn't work for me either, even on a fresh checkout. OK, on a hunch I've disabled authz_svn_module. Can you (both) try again? > Though I can log into trac now which seems fine. Yeah, I figured out what it was earlier - difference of configuration in the vhosts. now that it's all on bbdev it magically started working :-) James From boxbackup-dev at fluffy.co.uk Thu Aug 10 21:07:25 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 10 Aug 2006 21:07:25 +0100 (BST) Subject: [Box Backup-dev] Subversion repository moved / Trac now online In-Reply-To: <44DB910D.4050101@netinertia.co.uk> References: <44DB6F4B.6020408@netinertia.co.uk> <44DB8BBF.8090800@netinertia.co.uk> <1155239639.31087.1.camel@avenin.ebourne.me.uk> <44DB910D.4050101@netinertia.co.uk> Message-ID: Hi James, On Thu, 10 Aug 2006, James O'Gorman wrote: > Martin Ebourne wrote: >> Doesn't work for me either, even on a fresh checkout. > > OK, on a hunch I've disabled authz_svn_module. Can you (both) try again? Sorry, still no dice for me (using old password). Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 10 21:17:59 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 10 Aug 2006 21:17:59 +0100 Subject: [Box Backup-dev] Subversion repository moved / Trac now online In-Reply-To: <44DB6F4B.6020408@netinertia.co.uk> References: <44DB6F4B.6020408@netinertia.co.uk> Message-ID: <1155241079.31087.18.camel@avenin.ebourne.me.uk> On Thu, 2006-08-10 at 18:39 +0100, James O'Gorman wrote: > Following yesterday's announcement by Ben, the Subversion repository has > now been transferred and is integrated into Trac. > > The Subversion repository can still be accessed in the normal way, via: > http://bbdev.fluffy.co.uk/svn/box > > Trac is available at: > http://bbdev.fluffy.co.uk/trac Fantastic, thanks! Now we've got trac I think it's worth getting some ground rules in place for people raising tickets etc. On many open source systems the bug tracker turns into a morass of not real bugs and esoteric feature requests. With some control though this doesn't need to happen. I would like to suggest the following, please shout if you've got a different idea: 1. trac tickets should only be used for tracking real work, it is not a place for wishlists. ie. We should not accept tickets with random feature requests unless they are accompanied by a patch, or a developer assigns them for active work themselves (ticket type task). The wiki is a much better place for wishlists to develop. 2. people should only raise tickets for real bugs, not their own configuration problems. If unsure people should discuss on the mailing list to get confirmation before raising a ticket. 3. discussions should be discouraged in trac, they work much better on mailing lists. 4. the raiser should leave priority and milestone alone, that should be up to the developer. 5. Assigning to developers. Should we give a list of devs for each area of interest so the raiser can assign it or should we assign it ourselves? Given that there's not really clear boundaries on who does what for box then I think we should ask raisers to leave the assignee blank. I don't think there's anything drastic in there, and if we apply these or similar rules (politely!) trac should remain very manageable and useful for developers and users alike. If there is a consensus on these I'll write a ticket submission page in the trac wiki and we can link to it from the new ticket page. Do the trac tickets mail to boxbackup-dev like the commit messages? Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 10 21:21:54 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 10 Aug 2006 21:21:54 +0100 (BST) Subject: [Box Backup-dev] Subversion repository moved / Trac now online In-Reply-To: <1155241079.31087.18.camel@avenin.ebourne.me.uk> References: <44DB6F4B.6020408@netinertia.co.uk> <1155241079.31087.18.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, On Thu, 10 Aug 2006, Martin Ebourne wrote: > I don't think there's anything drastic in there, and if we apply these > or similar rules (politely!) trac should remain very manageable and > useful for developers and users alike. > > If there is a consensus on these I'll write a ticket submission page in > the trac wiki and we can link to it from the new ticket page. OK to all. I'm happy to handle anything Win32-related as a first port of call, although I may delegate to someone else with their agreement. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 10 21:26:59 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Thu, 10 Aug 2006 21:26:59 +0100 Subject: [Box Backup-dev] Subversion repository moved / Trac now online In-Reply-To: <1155241079.31087.18.camel@avenin.ebourne.me.uk> References: <44DB6F4B.6020408@netinertia.co.uk> <1155241079.31087.18.camel@avenin.ebourne.me.uk> Message-ID: <44DB9693.5090700@netinertia.co.uk> Martin Ebourne wrote: > Do the trac tickets mail to boxbackup-dev like the commit messages? They should do, yes. James From boxbackup-dev at fluffy.co.uk Thu Aug 10 21:59:09 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 10 Aug 2006 21:59:09 +0100 Subject: [Box Backup-dev] COMMIT r773 - box/martin Message-ID: Author: martin Date: 2006-08-10 21:59:08 +0100 (Thu, 10 Aug 2006) New Revision: 773 Added: box/martin/test Log: Just testing Added: box/martin/test =================================================================== From boxbackup-dev at fluffy.co.uk Fri Aug 11 08:50:35 2006 From: boxbackup-dev at fluffy.co.uk (E.W. Peter Jalajas) Date: Fri, 11 Aug 2006 00:50:35 -0700 (PDT) Subject: [Box Backup-dev] DocProject editing setup In-Reply-To: <44DBCD4C.5060805@reedtz.com> Message-ID: <20060811075035.76719.qmail@web60621.mail.yahoo.com> Moving off of boxbackup mailing list to boxbackup-dev... Sorry, Per, but I just don't have any experience with xml, so I'm gonna need a lot more hand-holding. Rather than quitting and running away, let me try a couple of baby steps. Maybe this thread will help others join the doc team. 1) Here's what I have for xml editors: I'm on gnome on ubuntu dapper linux (debian). I have screem and bluefish which both seem to have xml functions built in. I'll try them both after we get the rest of this thing set up. (I'm fairly proficient at vi/vim, if that helps. gedit has xml highlighting, fwiw.) 2) Here's what I have for xsltproc and docbook: $ dpkg -l | grep xsltproc ii xsltproc 1.1.15-1ubuntu1 XSLT command line processor $ dpkg -l | grep docbook ii docbook-dsssl 1.79-3 modular DocBook DSSSL stylesheets, for print ii docbook-utils 0.6.14-1 Convert Docbook files to other formats (HTML ii docbook-xml 4.4-4 standard XML documentation system, for softw ii docbook-xsl 1.68.1-0.1ubuntu1 stylesheets for processing DocBook XML files How does that look? 1.68 looks bad per the DocProject page. I'm not sure I want to start messing with a dependency hell, but I'm open to suggestions. Maybe I can just stay away from man pages? 3) Here's what I have for stylesheets: The DocProject page mentions getting stylesheets. I see stylesheets in the listing above; do I need anything else re that? I have no clue how to use them yet. 4) Here's what I have for subversion: I didn't have it installed, so I ran sudo apt-get install subversion and so now I have: $ dpkg -l | grep -e subversion -e svn ii libnl1-pre6 1.0~pre5+svn21-2ubuntu2 Library for dealing with netlink sockets ii libsvn0 1.3.1-3ubuntu1 shared libraries used by Subversion (aka. sv ii subversion 1.3.1-3ubuntu1 advanced version control system (aka. svn) The boxbackup-dev mailing list mentions transferring the svn repository and integrating with trac. Do I need to do anything with that info? 5) Editing a doc: Say I want to add content re windows regex in bbackupd.conf (like I was gonna do in the wiki). I found: http://bbdev.fluffy.co.uk/trac/browser/box/trunk/documentation/boxbackup/adminguide.xml and http://bbdev.fluffy.co.uk/svn/box/trunk/documentation/boxbackup/adminguide.xml I registered as petej on the trac page, so is it safe to presume the trac file is the one I should checkout/edit/checkin? I'll need some instructions on how to checkout/checkin that file. Thanks for your patience, Per! Pete --- Per Thomsen wrote: > On 8/10/06 1:57 PM, E.W. Peter Jalajas wrote: > The instructions are on the Wiki: > http://boxbackup.hostworks.ca/index.php/DocProject > > If you have questions about any of this, please feel free to contact > me. > > Thanks, > Per ASK ME about the EXCITING new TebucoSafe(TM) web-based automated secure off-site backup service! Never think about backups again! As low as $19/mo. http://tebuco.com/bu/ E.W. Peter Jalajas Tebuco, Inc. | Technical Business Consulting pjalajas at tebuco.com | http://tebuco.com/ cell: 978-495-2062 | (secondary phone: 978-465-7047 x27) PO Box 1223, Newburyport, MA 01950-8223 Automated, secure, off-site, on-line backup service. On-site and remote technical support. From boxbackup-dev at fluffy.co.uk Fri Aug 11 09:33:15 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 11 Aug 2006 09:33:15 +0100 Subject: [Box Backup-dev] COMMIT r774 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2006-08-11 09:33:15 +0100 (Fri, 11 Aug 2006) New Revision: 774 Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Set the 'Command Received' Event to signalled when a command requiring action by the main thread is received (how did this ever work before?) - Close (destroy) events when command socket thread quits - Removed useless disabled Win32 code Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.cpp 2006-08-10 20:59:08 UTC (rev 773) +++ box/chris/general/bin/bbackupd/BackupDaemon.cpp 2006-08-11 08:33:15 UTC (rev 774) @@ -415,6 +415,7 @@ this->mDoSyncFlagOut = true; this->mSyncIsForcedOut = false; sendOK = true; + SetEvent(mhCommandReceivedEvent); } else if(command == "force-sync") { @@ -422,18 +423,21 @@ this->mDoSyncFlagOut = true; this->mSyncIsForcedOut = true; sendOK = true; + SetEvent(mhCommandReceivedEvent); } else if(command == "reload") { // Reload the configuration SetReloadConfigWanted(); sendOK = true; + SetEvent(mhCommandReceivedEvent); } else if(command == "terminate") { // Terminate the daemon cleanly SetTerminateWanted(); sendOK = true; + SetEvent(mhCommandReceivedEvent); } else { @@ -454,8 +458,6 @@ { break; } - - // this->mReceivedCommandConn = true; } rSocket.Close(); @@ -470,6 +472,9 @@ ::syslog(LOG_ERR, "Communication error with control client"); } } + + CloseHandle(mhCommandReceivedEvent); + CloseHandle(mhMessageToSendEvent); } #endif @@ -1143,10 +1148,6 @@ TRACE1("Receiving command '%s' over command socket\n", command.c_str()); - #ifdef WIN32 - SetEvent(mhCommandReceivedEvent); - #endif - bool sendOK = false; bool sendResponse = true; From boxbackup-dev at fluffy.co.uk Fri Aug 11 09:34:20 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 11 Aug 2006 09:34:20 +0100 Subject: [Box Backup-dev] COMMIT r775 - box/chris/general/lib/win32 Message-ID: Author: chris Date: 2006-08-11 09:34:19 +0100 (Fri, 11 Aug 2006) New Revision: 775 Modified: box/chris/general/lib/win32/emu.cpp box/chris/general/lib/win32/emu.h Log: * lib/win32/emu.cpp * lib/win32/emu.h - Added d_type member to struct dirent, initialise with S_IFDIR or S_IFREG - MinGW compile fix Modified: box/chris/general/lib/win32/emu.cpp =================================================================== --- box/chris/general/lib/win32/emu.cpp 2006-08-11 08:33:15 UTC (rev 774) +++ box/chris/general/lib/win32/emu.cpp 2006-08-11 08:34:19 UTC (rev 775) @@ -1000,7 +1000,7 @@ if (!dp->result.d_name || _wfindnext(dp->fd, &dp->info) != -1) { - den = &dp->result; + den = &dp->result; std::wstring input(dp->info.name); memset(tempbuff, 0, sizeof(tempbuff)); WideCharToMultiByte(CP_UTF8, 0, dp->info.name, @@ -1008,6 +1008,14 @@ NULL, NULL); //den->d_name = (char *)dp->info.name; den->d_name = &tempbuff[0]; + if (dp->info.attrib & FILE_ATTRIBUTE_DIRECTORY) + { + den->d_type = S_IFDIR; + } + else + { + den->d_type = S_IFREG; + } } } else Modified: box/chris/general/lib/win32/emu.h =================================================================== --- box/chris/general/lib/win32/emu.h 2006-08-11 08:33:15 UTC (rev 774) +++ box/chris/general/lib/win32/emu.h 2006-08-11 08:34:19 UTC (rev 775) @@ -6,7 +6,9 @@ // basic types, may be required by other headers since we // don't include sys/types.h -#ifndef __MINGW32__ +#ifdef __MINGW32__ + #include +#else // MSVC typedef unsigned __int64 u_int64_t; typedef unsigned __int64 uint64_t; typedef __int64 int64_t; @@ -232,6 +234,7 @@ struct dirent { char *d_name; + unsigned long d_type; }; struct DIR From boxbackup-dev at fluffy.co.uk Fri Aug 11 09:35:03 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 11 Aug 2006 09:35:03 +0100 Subject: [Box Backup-dev] COMMIT r776 - box/chris/general/bin/bbstored Message-ID: Author: chris Date: 2006-08-11 09:35:03 +0100 (Fri, 11 Aug 2006) New Revision: 776 Modified: box/chris/general/bin/bbstored/BackupStoreDaemon.cpp Log: * BackupStoreDaemon.cpp - Win32 compile fix Modified: box/chris/general/bin/bbstored/BackupStoreDaemon.cpp =================================================================== --- box/chris/general/bin/bbstored/BackupStoreDaemon.cpp 2006-08-11 08:34:19 UTC (rev 775) +++ box/chris/general/bin/bbstored/BackupStoreDaemon.cpp 2006-08-11 08:35:03 UTC (rev 776) @@ -41,10 +41,10 @@ mpAccounts(0), mExtendedLogging(false), mHaveForkedHousekeeping(false), - mIsHousekeepingProcess(false), #ifdef WIN32 mHousekeepingInited(false) #else + mIsHousekeepingProcess(false), mInterProcessComms(mInterProcessCommsSocket) #endif { From boxbackup-dev at fluffy.co.uk Fri Aug 11 09:35:59 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 11 Aug 2006 09:35:59 +0100 Subject: [Box Backup-dev] COMMIT r777 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2006-08-11 09:35:59 +0100 (Fri, 11 Aug 2006) New Revision: 777 Modified: box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: * BackupClientDirectoryRecord.cpp - Use en->d_type field on Windows to determine file type, and thus whether to include or exclude, without statting it first (in case it's locked). Modified: box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-11 08:35:03 UTC (rev 776) +++ box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-11 08:35:59 UTC (rev 777) @@ -235,6 +235,9 @@ // Stat file to get info filename = MakeFullPath(rLocalPath, en->d_name); + #ifdef WIN32 + int type = en->d_type; + #else if(::lstat(filename.c_str(), &st) != 0) { // Report the error (logs and @@ -247,6 +250,8 @@ } int type = st.st_mode & S_IFMT; + #endif + if(type == S_IFREG || type == S_IFLNK) { // File or symbolic link @@ -277,11 +282,31 @@ } else { + #ifdef WIN32 + ::syslog(LOG_ERR, "Unknown file type: " + "%d (%s)", type, + filename.c_str()); + #endif continue; } // Here if the object is something to back up (file, symlink or dir, not excluded) // So make the information for adding to the checksum + + #ifdef WIN32 + if(::lstat(filename.c_str(), &st) != 0) + { + // Report the error (logs and + // eventual email to administrator) + SetErrorWhenReadingFilesystemObject( + rParams, filename.c_str()); + + // Ignore this entry for now. + continue; + } + #endif + + checksum_info.mModificationTime = FileModificationTime(st); checksum_info.mAttributeModificationTime = FileAttrModificationTime(st); checksum_info.mSize = st.st_size; From boxbackup-dev at fluffy.co.uk Fri Aug 11 09:50:28 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 11 Aug 2006 09:50:28 +0100 Subject: [Box Backup-dev] COMMIT r778 - box/chris/win32/releases Message-ID: Author: chris Date: 2006-08-11 09:50:28 +0100 (Fri, 11 Aug 2006) New Revision: 778 Added: box/chris/win32/releases/boxbackup-chris_general_777M-backup-client-mingw32.zip Log: * boxbackup-chris_general_777M-backup-client-mingw32.zip - Fixed warnings when scanning excluded locked files (e.g. pagefile.sys) Copied: box/chris/win32/releases/boxbackup-chris_general_777M-backup-client-mingw32.zip (from rev 768, box/chris/win32/releases/boxbackup-chris_general_767M-backup-client-mingw32.zip) =================================================================== (Binary files differ) From boxbackup-dev at fluffy.co.uk Fri Aug 11 09:56:21 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Fri, 11 Aug 2006 09:56:21 +0100 Subject: [Box Backup-dev] DocProject editing setup In-Reply-To: <20060811075035.76719.qmail@web60621.mail.yahoo.com> References: <20060811075035.76719.qmail@web60621.mail.yahoo.com> Message-ID: <1155286581.31087.35.camel@avenin.ebourne.me.uk> On Fri, 2006-08-11 at 00:50 -0700, E.W. Peter Jalajas wrote: > 1) Here's what I have for xml editors: Of course, XML is just a text file. You can use absolutely any editor to edit XML so if you're proficient with vim then that would be perfectly ok. The only advantage of a real xml editor is that it should make it easier for you by automating some of the tag entry etc. If you're just making small changes it's easier to use your favourite editor. If you're doing a lot of xml work it's worth learning a new tool. > 2) Here's what I have for xsltproc and docbook: > How does that look? 1.68 looks bad per the DocProject page. I'm not > sure I want to start messing with a dependency hell, but I'm open to > suggestions. Maybe I can just stay away from man pages? I've not tried it but Per just reports excessive whitespace in man pages. From a point of view of just contributing to the docs I doubt that's really an issue. > 4) Here's what I have for subversion: > The boxbackup-dev mailing list mentions transferring the svn repository > and integrating with trac. Do I need to do anything with that info? Ok, you're sorted with svn now. No, there's nothing you need to do different now the trac move has completed. Just execute: svn co http://bbdev.fluffy.co.uk/svn/box/trunk boxbackup Then edit away. Use: svn st or svn diff to keep track of your changes. You won't be able to commit since the svn committer accounts are different to the trac ones. But that's not an issue. Simply svn diff from the top of the working copy and attach the result to an email or a new ticket in trac. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Fri Aug 11 10:22:20 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Fri, 11 Aug 2006 10:22:20 +0100 Subject: [Box Backup-dev] Ticket submision howto Message-ID: <1155288140.31087.40.camel@avenin.ebourne.me.uk> I've created a first attempt of the ticket submission guidelines here: http://bbdev.fluffy.co.uk/trac/wiki/TicketHowto Feel free to log in and improve it. James: Can you edit the http://bbdev.fluffy.co.uk/trac/newticket page to add a link to the above page near the top? Preferably in some kind of bold or large type that says please read this howto before creating a ticket. Cheers, Martin? From boxbackup-dev at fluffy.co.uk Fri Aug 11 15:13:41 2006 From: boxbackup-dev at fluffy.co.uk (Box Backup) Date: Fri, 11 Aug 2006 14:13:41 -0000 Subject: [Box Backup-dev] =?utf-8?q?=5BBox_Backup=5D_=231=3A_When_restoring_a_dir=2C_if_that_dir_do?= =?utf-8?q?es_not_have_write_permissions=2C_restoration_of_files_fails?= Message-ID: <072.25ab3ab90181caa41b85f2799c7cf4cf@fluffy.co.uk> --===============0935283984== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzE6IFdoZW4gcmVzdG9yaW5nIGEgZGlyLCBpZiB0aGF0IGRpciBkb2VzIG5vdCBoYXZlIHdyaXRl IHBlcm1pc3Npb25zLA0KcmVzdG9yYXRpb24gb2YgZmlsZXMgZmFpbHMNCi0tLS0tLS0tLS0tLS0t LS0tLS0tLS0rLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0NCiBSZXBvcnRlcjogIGJlbiAgICAgICB8ICAgICAgIE93bmVyOiAgYmVuIA0KICAgICBU eXBlOiAgZGVmZWN0ICAgIHwgICAgICBTdGF0dXM6ICBuZXcgDQogUHJpb3JpdHk6ICBtYWpvciAg ICAgfCAgIE1pbGVzdG9uZTogICAgICANCkNvbXBvbmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJz aW9uOiAgMC4wOQ0KIEtleXdvcmRzOiAgICAgICAgICAgIHwgIA0KLS0tLS0tLS0tLS0tLS0tLS0t LS0tLSstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LQ0KIFJlc3RvcmF0aW9uIHdpbGwgc2V0IHBlcm1pc3Npb25zIG9uIGEgZGlyLCB0aGVuIGJlIHN1 cnByaXNlZCBpZiB0aGVzZSBzdG9wDQogaXQgZnJvbSB3cml0aW5nIGEgZmlsZSBpbiBpdCBsYXRl ci4gRm9yIGV4YW1wbGUsIGhlcmUncyBzb21lIHN0cmFjZQ0KIG91dHB1dDoNCg0KIGNobW9kKCJz b21lL2RpcmVjdG9yeSIsIDA1NTUpID0gMA0KIC4uLg0KIG9wZW4oInNvbWUvZGlyZWN0b3J5L2Zp bGUuZXh0IiwgT19XUk9OTFl8T19DUkVBVHxPX0VYQ0x8T19MQVJHRUZJTEUsIDA2NjYpDQogPSAt MSBFQUNDRVMgKFBlcm1pc3Npb24gZGVuaWVkKQ0KDQogb29wcy4NCg0KIE9mIGNvdXJzZSwgdGhp cyBvbmx5IGFmZmVjdHMgbm9uLXJvb3QgdXNlcnMuDQoNCi0tIA0KVGlja2V0IFVSTDogPGh0dHA6 Ly9iYmRldi5mbHVmZnkuY28udWsvdHJhYy90aWNrZXQvMT4NCkJveCBCYWNrdXAgPGh0dHA6Ly93 d3cuZmx1ZmZ5LmNvLnVrL2JveGJhY2t1cC8+DQpBbiBvcGVuIHNvdXJjZSwgY29tcGxldGVseSBh dXRvbWF0aWMgb24tbGluZSBiYWNrdXAgc3lzdGVtIGZvciBVTklYLg== --===============0935283984==-- From boxbackup-dev at fluffy.co.uk Fri Aug 11 15:18:15 2006 From: boxbackup-dev at fluffy.co.uk (Box Backup) Date: Fri, 11 Aug 2006 14:18:15 -0000 Subject: [Box Backup-dev] =?utf-8?q?=5BBox_Backup=5D_=232=3A_When_downloading_a_large_file_=28=3E0x?= =?utf-8?q?7fffffff=29_from_server=2C_connection_is_aborted?= Message-ID: <072.c53c8bbe07d805038ee4ba08472d1391@fluffy.co.uk> --===============0093493232== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzI6IFdoZW4gZG93bmxvYWRpbmcgYSBsYXJnZSBmaWxlICg+MHg3ZmZmZmZmZikgZnJvbSBzZXJ2 ZXIsIGNvbm5lY3Rpb24gaXMNCmFib3J0ZWQNCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCiBSZXBvcnRl cjogIGJlbiAgICAgICB8ICAgICAgIE93bmVyOiAgYmVuIA0KICAgICBUeXBlOiAgZGVmZWN0ICAg IHwgICAgICBTdGF0dXM6ICBuZXcgDQogUHJpb3JpdHk6ICBtYWpvciAgICAgfCAgIE1pbGVzdG9u ZTogICAgICANCkNvbXBvbmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgMC4xMA0KIEtl eXdvcmRzOiAgICAgICAgICAgIHwgIA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSstLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KIFBhcnRpYWxSZWFk U3RyZWFtIGlzIHVzZWQgdG8gZ3JhYiBhIHBvcnRpb24gb2YgdGhlIGluY29taW5nIGRhdGEuIEhv d2V2ZXIsDQogaXQgdXNlcyBzaWduZWQgaW50cyB3aGVyZSBpdCBzaG91bGRuJ3QsIGFuZCBpdCBh bGwgZ29lcyBob3JyaWJseSB3cm9uZy4NCg0KIFRvIGZpeDoNCg0KIHRlc3QvY29tbW9uL3Rlc3Rj b21tb24uY3BwIC4uLiB3cml0ZSBzdHJlYW0gY2xhc3Mgd2hpY2ggZ2l2ZXMgPiAweDdmZmZmZmZm DQogYnl0ZXMgb2YgemVyb3MuIFRoZW4gY3JlYXRlIGEgUGFydGlhbFJlYWRTdHJlYW0gZnJvbSBp dCwgYXNraW5nIGZvciA+DQogMHg3ZmZmZmZmZiwgYW5kIGNoZWNrIHRvIHNlZSBpZiB0aGUgcmVz dWx0cyBhcmUgYXMgZXhwZWN0ZWQuIFdpdGggdGhlDQogY3VycmVudCBjb2RlLCB0aGlzIHNob3Vs ZCBmYWlsLg0KDQogbGliL2NvbW1vbi9QYXJ0aWFsUmVhZFN0cmVhbS4qDQoNCiBDaGFuZ2UNCg0K ICAgICAgICAgaW50IG1CeXRlc0xlZnQ7DQoNCiB0bw0KDQogICAgICAgICBwb3NfdHlwZSBtQnl0 ZXNMZWZ0Ow0KDQogdGhlbiBhbGwgdmFycyB3aGljaCBhcmUgcmVsYXRlZCAoZWcgQnl0ZXNUb1Jl YWQgaW4gY29uc3RydWN0b3IpIHRvDQogcG9zX3R5cGUgdG9vLiAoRG9uJ3QgY2hhbmdlIHRoZSBh cmdzIHRvIFJlYWQgb3RoZXJ3aXNlIGl0IHdvbid0IGltcGxlbWVudA0KIHRoZSBJT1N0cmVhbSBp bnRlcmZhY2UuKQ0KDQotLSANClRpY2tldCBVUkw6IDxodHRwOi8vYmJkZXYuZmx1ZmZ5LmNvLnVr L3RyYWMvdGlja2V0LzI+DQpCb3ggQmFja3VwIDxodHRwOi8vd3d3LmZsdWZmeS5jby51ay9ib3hi YWNrdXAvPg0KQW4gb3BlbiBzb3VyY2UsIGNvbXBsZXRlbHkgYXV0b21hdGljIG9uLWxpbmUgYmFj a3VwIHN5c3RlbSBmb3IgVU5JWC4= --===============0093493232==-- From boxbackup-dev at fluffy.co.uk Fri Aug 11 15:18:38 2006 From: boxbackup-dev at fluffy.co.uk (Box Backup) Date: Fri, 11 Aug 2006 14:18:38 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=5BBox_Backup=5D_=231=3A_When_restoring_a_dir=2C_if_that_?= =?utf-8?q?dir_does_not_have_write_permissions=2C_restoration_of_files_fai?= =?utf-8?q?ls?= In-Reply-To: <072.25ab3ab90181caa41b85f2799c7cf4cf@fluffy.co.uk> References: <072.25ab3ab90181caa41b85f2799c7cf4cf@fluffy.co.uk> Message-ID: <081.1183ad42c230347b86a9d05db28bf731@fluffy.co.uk> --===============0772415012== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzE6IFdoZW4gcmVzdG9yaW5nIGEgZGlyLCBpZiB0aGF0IGRpciBkb2VzIG5vdCBoYXZlIHdyaXRl IHBlcm1pc3Npb25zLA0KcmVzdG9yYXRpb24gb2YgZmlsZXMgZmFpbHMNCi0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0NCiAgUmVwb3J0ZXI6ICBiZW4gICAgICAgfCAgICAgICBPd25lcjogIGJlbiANCiAgICAg IFR5cGU6ICBkZWZlY3QgICAgfCAgICAgIFN0YXR1czogIG5ldyANCiAgUHJpb3JpdHk6ICBtYWpv ciAgICAgfCAgIE1pbGVzdG9uZTogICAgICANCiBDb21wb25lbnQ6ICBiYmFja3VwZCAgfCAgICAg VmVyc2lvbjogIDAuMDkNClJlc29sdXRpb246ICAgICAgICAgICAgfCAgICBLZXl3b3JkczogICAg ICANCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCk9sZCBkZXNjcmlwdGlvbjoNCg0KPiBSZXN0b3JhdGlv biB3aWxsIHNldCBwZXJtaXNzaW9ucyBvbiBhIGRpciwgdGhlbiBiZSBzdXJwcmlzZWQgaWYgdGhl c2UNCj4gc3RvcCBpdCBmcm9tIHdyaXRpbmcgYSBmaWxlIGluIGl0IGxhdGVyLiBGb3IgZXhhbXBs ZSwgaGVyZSdzIHNvbWUgc3RyYWNlDQo+IG91dHB1dDoNCj4NCj4gY2htb2QoInNvbWUvZGlyZWN0 b3J5IiwgMDU1NSkgPSAwDQo+IC4uLg0KPiBvcGVuKCJzb21lL2RpcmVjdG9yeS9maWxlLmV4dCIs IE9fV1JPTkxZfE9fQ1JFQVR8T19FWENMfE9fTEFSR0VGSUxFLA0KPiAwNjY2KSA9IC0xIEVBQ0NF UyAoUGVybWlzc2lvbiBkZW5pZWQpDQo+DQo+IG9vcHMuDQo+DQo+IE9mIGNvdXJzZSwgdGhpcyBv bmx5IGFmZmVjdHMgbm9uLXJvb3QgdXNlcnMuDQoNCk5ldyBkZXNjcmlwdGlvbjoNCg0KIFJlc3Rv cmF0aW9uIHdpbGwgc2V0IHBlcm1pc3Npb25zIG9uIGEgZGlyLCB0aGVuIGJlIHN1cnByaXNlZCBp ZiB0aGVzZSBzdG9wDQogaXQgZnJvbSB3cml0aW5nIGEgZmlsZSBpbiBpdCBsYXRlci4gRm9yIGV4 YW1wbGUsIGhlcmUncyBzb21lIHN0cmFjZQ0KIG91dHB1dDoNCg0KDQoge3t7DQogY2htb2QoInNv bWUvZGlyZWN0b3J5IiwgMDU1NSkgPSAwDQogLi4uDQogb3Blbigic29tZS9kaXJlY3RvcnkvZmls ZS5leHQiLCBPX1dST05MWXxPX0NSRUFUfE9fRVhDTHxPX0xBUkdFRklMRSwgMDY2NikNCiA9IC0x IEVBQ0NFUyAoUGVybWlzc2lvbiBkZW5pZWQpDQogfX19DQoNCg0KIG9vcHMuDQoNCiBPZiBjb3Vy c2UsIHRoaXMgb25seSBhZmZlY3RzIG5vbi1yb290IHVzZXJzLg0KDQotLSANClRpY2tldCBVUkw6 IDxodHRwOi8vYmJkZXYuZmx1ZmZ5LmNvLnVrL3RyYWMvdGlja2V0LzE+DQpCb3ggQmFja3VwIDxo dHRwOi8vd3d3LmZsdWZmeS5jby51ay9ib3hiYWNrdXAvPg0KQW4gb3BlbiBzb3VyY2UsIGNvbXBs ZXRlbHkgYXV0b21hdGljIG9uLWxpbmUgYmFja3VwIHN5c3RlbSBmb3IgVU5JWC4= --===============0772415012==-- From boxbackup-dev at fluffy.co.uk Fri Aug 11 17:11:13 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Fri, 11 Aug 2006 17:11:13 +0100 Subject: [Box Backup-dev] Ticket submision howto In-Reply-To: <1155288140.31087.40.camel@avenin.ebourne.me.uk> References: <1155288140.31087.40.camel@avenin.ebourne.me.uk> Message-ID: <44DCAC21.3030605@netinertia.co.uk> On 11/8/06 10:22, Martin Ebourne wrote: > James: > > Can you edit the http://bbdev.fluffy.co.uk/trac/newticket page to add a > link to the above page near the top? Preferably in some kind of bold or > large type that says please read this howto before creating a ticket. Done. Let me know if you want it changed at all. I'm also trying to find out if it's possible to customise the ticket notification emails... James From boxbackup-dev at fluffy.co.uk Fri Aug 11 18:19:46 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 11 Aug 2006 17:19:46 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=231=3A_When_restoring_a_dir=2C_if_that_dir_does_not_have?= =?utf-8?q?_write_permissions=2C_restoration_of_files_fails?= In-Reply-To: <072.25ab3ab90181caa41b85f2799c7cf4cf@fluffy.co.uk> References: <072.25ab3ab90181caa41b85f2799c7cf4cf@fluffy.co.uk> Message-ID: <081.d67d6001feabb50d00bf1e4e100ebc0e@fluffy.co.uk> --===============0867244390== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzE6IFdoZW4gcmVzdG9yaW5nIGEgZGlyLCBpZiB0aGF0IGRpciBkb2VzIG5vdCBoYXZlIHdyaXRl IHBlcm1pc3Npb25zLA0KcmVzdG9yYXRpb24gb2YgZmlsZXMgZmFpbHMNCi0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0NCiAgUmVwb3J0ZXI6ICBiZW4gICAgICAgfCAgICAgICBPd25lcjogIGJlbiANCiAgICAg IFR5cGU6ICBkZWZlY3QgICAgfCAgICAgIFN0YXR1czogIG5ldyANCiAgUHJpb3JpdHk6ICBtYWpv ciAgICAgfCAgIE1pbGVzdG9uZTogICAgICANCiBDb21wb25lbnQ6ICBiYmFja3VwZCAgfCAgICAg VmVyc2lvbjogIDAuMDkNClJlc29sdXRpb246ICAgICAgICAgICAgfCAgICBLZXl3b3JkczogICAg ICANCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGphbWVzb2cpOg0KDQogVGVzdGlu ZyA0DQoNCi0tIA0KVGlja2V0IFVSTDogPGh0dHA6Ly9iYmRldi5mbHVmZnkuY28udWsvdHJhYy90 aWNrZXQvMT4NCkJveCBCYWNrdXAgPGh0dHA6Ly93d3cuZmx1ZmZ5LmNvLnVrL2JveGJhY2t1cC8+ DQpBbiBvcGVuIHNvdXJjZSwgY29tcGxldGVseSBhdXRvbWF0aWMgb24tbGluZSBiYWNrdXAgc3lz dGVtIGZvciBVTklYLg== --===============0867244390==-- From boxbackup-dev at fluffy.co.uk Fri Aug 11 18:28:23 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Fri, 11 Aug 2006 18:28:23 +0100 Subject: [Box Backup-dev] Ticket submision howto In-Reply-To: <44DCAC21.3030605@netinertia.co.uk> References: <1155288140.31087.40.camel@avenin.ebourne.me.uk> <44DCAC21.3030605@netinertia.co.uk> Message-ID: <1155317303.31087.48.camel@avenin.ebourne.me.uk> On Fri, 2006-08-11 at 17:11 +0100, James O'Gorman wrote: > On 11/8/06 10:22, Martin Ebourne wrote: > > James: > > > > Can you edit the http://bbdev.fluffy.co.uk/trac/newticket page to add a > > link to the above page near the top? Preferably in some kind of bold or > > large type that says please read this howto before creating a ticket. > > Done. Let me know if you want it changed at all. Looks good thanks. > I'm also trying to find out if it's possible to customise the ticket > notification emails... Ooh, pray tell. Can we customise the fields on the form? eg. We'll be needing 'trunk' in the version field at some point. There's more components than bbackupd and bbstored in box. bbackupctl, bbackupquery, scripts, all sorts depending on how far you want to go. Might be worth having one for the self tests? Not sure about all the priority levels. blocker, critical, major, minor, trivial. Don't see the need for both critical and blocker - surely one implies the other? Be nice for priority to default to normal or something, most bugs aren't major. :) The milestones want updating. 0.11, 0.12 and 0.20 would seem to be good bets at the moment. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Fri Aug 11 18:45:55 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Fri, 11 Aug 2006 18:45:55 +0100 Subject: [Box Backup-dev] Ticket submision howto In-Reply-To: <1155317303.31087.48.camel@avenin.ebourne.me.uk> References: <1155288140.31087.40.camel@avenin.ebourne.me.uk> <44DCAC21.3030605@netinertia.co.uk> <1155317303.31087.48.camel@avenin.ebourne.me.uk> Message-ID: <44DCC253.5060501@netinertia.co.uk> On 11/8/06 18:28, Martin Ebourne wrote: > On Fri, 2006-08-11 at 17:11 +0100, James O'Gorman wrote: >> I'm also trying to find out if it's possible to customise the ticket >> notification emails... > > Ooh, pray tell. Well, I noticed that it was setting the subject to [Project name] #TicketNo: Description. I've just hacked the python to remove the project name. It looked unreadable given that the mailing list adds a similar thing. I also removed the "name" from the From: header, so it's just trac at fluffy.co.uk. > Can we customise the fields on the form? In more than one way - you can add your own custom fields to the form if you like. I guess I'd have to update the database schema to match though. I've not checked that too much yet :-) > eg. We'll be needing 'trunk' in the version field at some point. > There's more components than bbackupd and bbstored in box. bbackupctl, > bbackupquery, scripts, all sorts depending on how far you want to go. > Might be worth having one for the self tests? Ben actually put those current values in. I think it's only restricted to admins so myself or Ben can put those in (or I can grant more people TRAC_ADMIN). > Not sure about all the priority levels. blocker, critical, major, minor, > trivial. Don't see the need for both critical and blocker - surely one > implies the other? Be nice for priority to default to normal or > something, most bugs aren't major. :) Again, changeable by admins. > The milestones want updating. 0.11, 0.12 and 0.20 would seem to be good > bets at the moment. You should be able to change/delete the existing ones? It's hard to know what restrictions are in place when you can do everything :-) James From boxbackup-dev at fluffy.co.uk Fri Aug 11 18:51:16 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Fri, 11 Aug 2006 17:51:16 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=231=3A_When_restoring_a_dir=2C_if_that_dir_does_not_have?= =?utf-8?q?_write_permissions=2C_restoration_of_files_fails?= In-Reply-To: <072.25ab3ab90181caa41b85f2799c7cf4cf@fluffy.co.uk> References: <072.25ab3ab90181caa41b85f2799c7cf4cf@fluffy.co.uk> Message-ID: <081.81716142b104f1343f1ec71756793e84@fluffy.co.uk> --===============0285061501== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzE6IFdoZW4gcmVzdG9yaW5nIGEgZGlyLCBpZiB0aGF0IGRpciBkb2VzIG5vdCBoYXZlIHdyaXRl IHBlcm1pc3Npb25zLA0KcmVzdG9yYXRpb24gb2YgZmlsZXMgZmFpbHMNCi0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLSstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0NCiAgUmVwb3J0ZXI6ICBiZW4gICAgICAgICAgIHwgICAgICAgT3duZXI6ICAgICAgDQog ICAgICBUeXBlOiAgZGVmZWN0ICAgICAgICB8ICAgICAgU3RhdHVzOiAgbmV3IA0KICBQcmlvcml0 eTogIG1ham9yICAgICAgICAgfCAgIE1pbGVzdG9uZTogIDAuMTENCiBDb21wb25lbnQ6ICBiYmFj a3VwcXVlcnkgIHwgICAgIFZlcnNpb246ICAwLjA5DQpSZXNvbHV0aW9uOiAgICAgICAgICAgICAg ICB8ICAgIEtleXdvcmRzOiAgICAgIA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KQ2hhbmdlcyAoYnkg YmVuKToNCg0KICAqIG1pbGVzdG9uZTogID0+IDAuMTENCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0 cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL3RpY2tldC8xPg0KQm94IEJhY2t1cCA8aHR0cDov L3d3dy5mbHVmZnkuY28udWsvYm94YmFja3VwLz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5 IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBzeXN0ZW0gZm9yIFVOSVgu --===============0285061501==-- From boxbackup-dev at fluffy.co.uk Fri Aug 11 18:53:00 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Fri, 11 Aug 2006 18:53:00 +0100 Subject: [Box Backup-dev] Ticket submision howto In-Reply-To: <1155317303.31087.48.camel@avenin.ebourne.me.uk> References: <1155288140.31087.40.camel@avenin.ebourne.me.uk> <44DCAC21.3030605@netinertia.co.uk> <1155317303.31087.48.camel@avenin.ebourne.me.uk> Message-ID: On 11 Aug 2006, at 18:28, Martin Ebourne wrote: > > > Can we customise the fields on the form? > eg. We'll be needing 'trunk' in the version field at some point. But that changes in meaning over time! Maybe we should have a convention that you start the subject (R1234) if you mean a particular revision? I notice that 'owner' has vanished. Was that deliberate by anyone? Ben From boxbackup-dev at fluffy.co.uk Fri Aug 11 19:02:05 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Fri, 11 Aug 2006 19:02:05 +0100 Subject: [Box Backup-dev] Ticket submision howto In-Reply-To: References: <1155288140.31087.40.camel@avenin.ebourne.me.uk> <44DCAC21.3030605@netinertia.co.uk> <1155317303.31087.48.camel@avenin.ebourne.me.uk> Message-ID: <44DCC61D.1040901@netinertia.co.uk> On 11/8/06 18:53, Ben Summers wrote: > I notice that 'owner' has vanished. Was that deliberate by anyone? On the newticket form? Was it ever there? "Assign to" is still there... James From boxbackup-dev at fluffy.co.uk Fri Aug 11 19:06:09 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Fri, 11 Aug 2006 19:06:09 +0100 Subject: [Box Backup-dev] Ticket submision howto In-Reply-To: References: <1155288140.31087.40.camel@avenin.ebourne.me.uk> <44DCAC21.3030605@netinertia.co.uk> <1155317303.31087.48.camel@avenin.ebourne.me.uk> Message-ID: <1155319569.31087.53.camel@avenin.ebourne.me.uk> On Fri, 2006-08-11 at 18:53 +0100, Ben Summers wrote: > On 11 Aug 2006, at 18:28, Martin Ebourne wrote: > > > > > > > Can we customise the fields on the form? > > eg. We'll be needing 'trunk' in the version field at some point. > > But that changes in meaning over time! Yes, it does. But bugs occur in the trunk version and need to be tracked. :) > Maybe we should have a convention that you start the subject (R1234) > if you mean a particular revision? Does it need to be in the subject? I think it's ok to put the revision in the description. If we intentionally put out a release with the bug in it we can always update the version field. > I notice that 'owner' has vanished. Was that deliberate by anyone? You can select action 'reassign' and give a person. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Fri Aug 11 19:07:12 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Fri, 11 Aug 2006 19:07:12 +0100 Subject: [Box Backup-dev] Ticket submision howto In-Reply-To: <44DCC61D.1040901@netinertia.co.uk> References: <1155288140.31087.40.camel@avenin.ebourne.me.uk> <44DCAC21.3030605@netinertia.co.uk> <1155317303.31087.48.camel@avenin.ebourne.me.uk> <44DCC61D.1040901@netinertia.co.uk> Message-ID: On 11 Aug 2006, at 19:02, James O'Gorman wrote: > On 11/8/06 18:53, Ben Summers wrote: >> I notice that 'owner' has vanished. Was that deliberate by anyone? > > On the newticket form? Was it ever there? "Assign to" is still > there... Oh yes, I'm getting confused. So why does it say "owner deleted" when I change things? Probably not important. Ben From boxbackup-dev at fluffy.co.uk Fri Aug 11 19:13:57 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Fri, 11 Aug 2006 19:13:57 +0100 Subject: [Box Backup-dev] Ticket submision howto In-Reply-To: References: <1155288140.31087.40.camel@avenin.ebourne.me.uk> <44DCAC21.3030605@netinertia.co.uk> <1155317303.31087.48.camel@avenin.ebourne.me.uk> <44DCC61D.1040901@netinertia.co.uk> Message-ID: <44DCC8E5.4060908@netinertia.co.uk> On 11/8/06 19:07, Ben Summers wrote: > On 11 Aug 2006, at 19:02, James O'Gorman wrote: >> On the newticket form? Was it ever there? "Assign to" is still there... > > Oh yes, I'm getting confused. > > So why does it say "owner deleted" when I change things? Probably not > important. Oh, I see what you mean now. Not entirely sure! I'm hoping it's not to do with me fiddling with the database. I added some comments to ticket #1 to test the notifications and then deleted them directly from the database (being careful to reset the last modified time to before I started fiddling). James From boxbackup-dev at fluffy.co.uk Fri Aug 11 20:18:51 2006 From: boxbackup-dev at fluffy.co.uk (Per Thomsen) Date: Fri, 11 Aug 2006 12:18:51 -0700 Subject: [Box Backup-dev] DocProject editing setup In-Reply-To: <20060811075035.76719.qmail@web60621.mail.yahoo.com> References: <20060811075035.76719.qmail@web60621.mail.yahoo.com> Message-ID: <44DCD81B.7090701@reedtz.com> On 8/11/06 12:50 AM, E.W. Peter Jalajas wrote: > Moving off of boxbackup mailing list to boxbackup-dev... > > Sorry, Per, but I just don't have any experience with xml, so I'm gonna > need a lot more hand-holding. Rather than quitting and running away, > let me try a couple of baby steps. Maybe this thread will help others > join the doc team. > I will answer your questions on the mailing list to the best of my ability, and then take that info to the Wiki... As you said, hopefully this will help others get over the hurdle as well... > 1) Here's what I have for xml editors: > > I'm on gnome on ubuntu dapper linux (debian). I have screem and > bluefish which both seem to have xml functions built in. I'll try them > both after we get the rest of this thing set up. (I'm fairly > proficient at vi/vim, if that helps. gedit has xml highlighting, fwiw.) > You can certainly edit in a text editor, but the DTD (the rules that govern the structure of a DocBook document) are complicated, and errors in a document can be hard to find. I am exclusively using XMLMind's XXE (Standard Edition). It is a WYSIWYG DocBook editor, and can be downloaded here: http://www.xmlmind.com/xmleditor/download.shtml I highly recommend using this editor, since it takes care of all the (highly complicated) rules of the DocBook DTD, and will only let you create correct DocBook XML. No XML editing... The user interface looks like a word processor. Especially since you don't have experience with XML, I would recommend trying XXE. It is also the only such editor that I have found that is free. It is written in Java, and I have not had problems running it on Linux (FC4 and 5), Windows or Mac OSX. > 2) Here's what I have for xsltproc and docbook: > > $ dpkg -l | grep xsltproc > ii xsltproc 1.1.15-1ubuntu1 XSLT > command line processor > $ dpkg -l | grep docbook > ii docbook-dsssl 1.79-3 modular DocBook > DSSSL stylesheets, for print > ii docbook-utils 0.6.14-1 Convert Docbook > files to other formats (HTML > ii docbook-xml 4.4-4 standard XML > documentation system, for softw > ii docbook-xsl 1.68.1-0.1ubuntu1 > stylesheets for processing DocBook XML files > > How does that look? 1.68 looks bad per the DocProject page. I'm not > sure I want to start messing with a dependency hell, but I'm open to > suggestions. Maybe I can just stay away from man pages? > It doesn't mean that man pages won't work, they will just look quite ugly, but can still be read. If you aren't going to be editing man-pages don't worry about the versions for now. That said, I did install 1.69.1 on Fedora, without incident (ie. no dependency issues). > 3) Here's what I have for stylesheets: > > The DocProject page mentions getting stylesheets. I see stylesheets in > the listing above; do I need anything else re that? I have no clue how > to use them yet. > The stylesheets I'm talking about are the docbook-xsl ones, so nothing else is needed for that. > 4) Here's what I have for subversion: > > I didn't have it installed, so I ran > > sudo apt-get install subversion > > and so now I have: > > $ dpkg -l | grep -e subversion -e svn > ii libnl1-pre6 1.0~pre5+svn21-2ubuntu2 > Library for dealing with netlink sockets > ii libsvn0 1.3.1-3ubuntu1 shared > libraries used by Subversion (aka. sv > ii subversion 1.3.1-3ubuntu1 advanced > version control system (aka. svn) > > The boxbackup-dev mailing list mentions transferring the svn repository > and integrating with trac. Do I need to do anything with that info? > No. The SVN repository hasn't changed. Martin responded to most of your SVN concerns in a separate mail. Keep the questions coming! Thanks, Per -- Per Reedtz Thomsen | Reedtz Consulting, LLC | F: 209 883 4119 V: 209 883 4102 | pthomsen at reedtz.com | C: 209 996 9561 GPG ID: 1209784F | Yahoo! Chat: pthomsen | AIM: pthomsen From boxbackup-dev at fluffy.co.uk Fri Aug 11 20:25:46 2006 From: boxbackup-dev at fluffy.co.uk (Per Thomsen) Date: Fri, 11 Aug 2006 12:25:46 -0700 Subject: [Box Backup-dev] Re: [Box Backup] Documentation writing tools In-Reply-To: <34C0E9D8-8DB4-402C-A70F-44FFDACBD50E@fluffy.co.uk> References: <20060810205720.13822.qmail@web60612.mail.yahoo.com> <44DBCD4C.5060805@reedtz.com> <34C0E9D8-8DB4-402C-A70F-44FFDACBD50E@fluffy.co.uk> Message-ID: <44DCD9BA.106@reedtz.com> On 8/11/06 1:46 AM, Ben Summers wrote: > > On 11 Aug 2006, at 01:20, Per Thomsen wrote: > >> The instructions are on the Wiki: >> http://boxbackup.hostworks.ca/index.php/DocProject >> >> Briefly: Documents are created in DocBook, using XMLMinds free (beer) >> version of XXE, and checked into SVN. A baseline of docs (mostly >> gathered from the Wiki) have been created, but some of the books >> could do with some TLC. >> >> To make the documents from the DocBook sources, xsltproc is needed. > > > XML isn't too difficult to write by hand. Is it sensible to try > editing them by hand and getting someone else to check they validate > properly? > > I'm just wondering how the barrier to participation can be reduced. Moving to '-dev'... The problem with writing the DocBook by hand is, as you mention, the validation. While I think it's fine to hand-edit the XML, the DTD rules are quite complex for DocBook, and I've found that debugging a flawed document when hand-editing can be quite tricky. XXE takes care of that completely. Even though XXE is WYSIWIG, using it can feel awkward at first, I readily admit, and if there is a tool that works better for you, it's fine to use it, as long as it generates valid DocBook XML. That said, XXE was easy to install. It took about 10 minutes to get going for me. Xsltproc is quite simple to download and install, and it appears that it is preinstalled on some Linux distros. I checked Ubuntu and FC5. WRT xsl-docbook 1.69.1, you can get by without using it, but if you're editing man-pages, you will quickly grow annoyed with 1.68.1. On Fedora, I simply installed the 1.69.1 RPM over the 1.68.1 one, and there were no conflicts. Based on the discussions on the list, I will be expanding the instructions on the Wiki, to hopefully ease the minds of those overwhelmed with the amount of stuff to learn when starting with DocBook. In conclusion, the use of DocBook (as opposed to POD, or other formats) might be the biggest barrier to entry for potential contributors, but I feel strongly that the flexibility we gain by using it, gives us the right set of tools to create the best and most relevant documentation we can. If there are other ideas to how we can get more people to help, I'm eager to hear them. Thanks, Per -- Per Reedtz Thomsen | Reedtz Consulting, LLC | F: 209 883 4119 V: 209 883 4102 | pthomsen at reedtz.com | C: 209 996 9561 GPG ID: 1209784F | Yahoo! Chat: pthomsen | AIM: pthomsen From boxbackup-dev at fluffy.co.uk Sat Aug 12 05:57:23 2006 From: boxbackup-dev at fluffy.co.uk (E.W. Peter Jalajas) Date: Fri, 11 Aug 2006 21:57:23 -0700 (PDT) Subject: [Box Backup-dev] DocProject editing setup In-Reply-To: <44DCD81B.7090701@reedtz.com> Message-ID: <20060812045723.95101.qmail@web60624.mail.yahoo.com> Thanks, Per. I already had java on my ubuntu dapper box by downloading and running automatix. (Debian and ubuntu don't like sun java because it is not free as in freedom.) I downloaded xxe from the website http://www.xmlmind.com/xmleditor/download.shtml specifically xxe-std-3_4_0.tar.gz and followed the simple instructions under Description on that page. Per Martin, I ran svn co http://bbdev.fluffy.co.uk/svn/box/trunk boxbackup and that downloaded the entire box backup product (revision 778; 3327 files) in just a few seconds. In the xxe bin directory, I ran ./xxe and the java window opened. I then tried to open the svn-downloaded file: boxbackup/documentation/boxbackup/adminguide.xml but I get error Cannot open boxbackup/documentation/boxbackup/adminguide.xml" .../boxbackup/documentation/boxbackup/ExceptionCodes.xml (No such file or directory) {Gosh I wish error messages were all swipe-able for copying and pasting...Chris, please take note for Boxi.) Can you please help me past that error? Opening boxbackup/documentation/boxbackup/instguide.xml worked perfectly, and I'm poking around that now. I made a junk change to that file in xxe and saved it. I also ran the menu option, DocBook, Convert Document, and made an html file; it wasn't pretty, but quite useable. How do I make a pretty html page like http://www.reedtz.com/boxdoc/instguide/ ? In the svn-downloaded .../boxbackup/ directory, I then ran, per Martin, svn diff and it reported exactly the change that I made. And then, svn st showed a list of the changed filename(s). I'll try to make a real change and submit it to trac, perhaps over the weekend. Progress! Thanks again, Per and Martin, Pete --- Per Thomsen wrote: > On 8/11/06 12:50 AM, E.W. Peter Jalajas wrote: > Especially since you don't have experience with XML, I would > recommend > trying XXE. > From boxbackup-dev at fluffy.co.uk Sat Aug 12 07:10:40 2006 From: boxbackup-dev at fluffy.co.uk (Per Thomsen) Date: Fri, 11 Aug 2006 23:10:40 -0700 Subject: [Box Backup-dev] DocProject editing setup In-Reply-To: <20060812045723.95101.qmail@web60624.mail.yahoo.com> References: <20060812045723.95101.qmail@web60624.mail.yahoo.com> Message-ID: <44DD70E0.3020204@reedtz.com> On 8/11/06 9:57 PM, E.W. Peter Jalajas wrote: > Thanks, Per. > > I already had java on my ubuntu dapper box by downloading and running > automatix. (Debian and ubuntu don't like sun java because it is not > free as in freedom.) > > I downloaded xxe from the website > http://www.xmlmind.com/xmleditor/download.shtml > specifically xxe-std-3_4_0.tar.gz > and followed the simple instructions under Description on that page. > > Per Martin, I ran > > svn co http://bbdev.fluffy.co.uk/svn/box/trunk boxbackup > > and that downloaded the entire box backup product (revision 778; 3327 > files) in just a few seconds. > > In the xxe bin directory, I ran > > ./xxe > > and the java window opened. I then tried to open the svn-downloaded > file: > > boxbackup/documentation/boxbackup/adminguide.xml > > but I get error > > Cannot open boxbackup/documentation/boxbackup/adminguide.xml" > .../boxbackup/documentation/boxbackup/ExceptionCodes.xml (No such file > or directory) > > {Gosh I wish error messages were all swipe-able for copying and > pasting...Chris, please take note for Boxi.) > > Can you please help me past that error? > Sure. Type 'make' in the boxbackup/documentation/boxbackup directory. That creates the ExceptionCodes.xml file, and you can then open adminguide.xml. This also generates the nicer looking HTML pages for you, as well as the man-pages. Basically, I only use XXE for editing. 'make' and the other tools are used to generate the actual readable docs. > Opening boxbackup/documentation/boxbackup/instguide.xml worked > perfectly, and I'm poking around that now. I made a junk change to > that file in xxe and saved it. I also ran the menu option, DocBook, > Convert Document, and made an html file; it wasn't pretty, but quite > useable. > > How do I make a pretty html page like > http://www.reedtz.com/boxdoc/instguide/ ? > 'make' is your friend... Look at the Makefile, to see what I'm doing. Thanks, Per -- Per Reedtz Thomsen | Reedtz Consulting, LLC | F: 209 883 4119 V: 209 883 4102 | pthomsen at reedtz.com | C: 209 996 9561 GPG ID: 1209784F | Yahoo! Chat: pthomsen | AIM: pthomsen From boxbackup-dev at fluffy.co.uk Sat Aug 12 14:05:42 2006 From: boxbackup-dev at fluffy.co.uk (E.W. Peter Jalajas) Date: Sat, 12 Aug 2006 06:05:42 -0700 (PDT) Subject: [Box Backup-dev] DocProject editing setup In-Reply-To: <44DD70E0.3020204@reedtz.com> Message-ID: <20060812130542.74786.qmail@web60625.mail.yahoo.com> Thanks, Per. Maybe these are bugs: 1) No rule to make target `../../ExceptionCodes.txt 2) Error: no ID for constraint linkend: 3) Missing box-html images. 4) Low priority: no index.html in man-pages dir. 5) Low priority: .there file in man-page dirs. Slightly edited screen swipes as follows: kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ date Sat Aug 12 08:12:22 EDT 2006 kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ pwd /home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ ls adminguide.xml bb-book.xsl bbstoreaccounts.xml generate_except_xml.pl instguide.xml~ bbackupctl.xml bb-man.xsl bbstored-certs.xml html Makefile bbackupquery.xml bb-nochunk-book.xsl bbstored-config.xml instguide.xml raidfile-config.xml kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ make make: *** No rule to make target `../../ExceptionCodes.txt', needed by `ExceptionCodes.xml'. Stop. kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ grep -i except Makefile $(HTMLPREFIX)/adminguide/index.html: adminguide.xml ExceptionCodes.xml $(BOOKXSL) ExceptionCodes.xml: ../../ExceptionCodes.txt perl ./generate_except_xml.pl if [ -f ExceptionCodes.xml ]; then rm ExceptionCodes.xml; fi kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ grep ExceptionCodes ./generate_except_xml.pl open (EXCEPT, "<../../ExceptionCodes.txt") or die "Can't open ../../ExceptionCodes.txt: $!\n"; open (DOCBOOK, ">ExceptionCodes.xml") or die "Can't open Exceptioncodes.xml for writing: $!\n"; kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ find ../../../ | grep -i except | wc -l 95 kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ find ../../../ | grep -i exceptioncode | wc -l 0 I happened to have a random version of ExceptionCodes.txt available so I did: kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ cp /home/petjal/doc/teb/bu/boxbackup-0.10/ExceptionCodes.txt ../../ Then I ran make and saw these errors: kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ make perl ./generate_except_xml.pl # docname=`echo box-html/adminguide/index.html | sed -e 's/\/index.html//'` /usr/bin/xsltproc -o box-html/adminguide/ bb-book.xsl adminguide.xml Writing pr01.html for preface Error: no ID for constraint linkend: instguide.xml. Error: no ID for constraint linkend: instguide.sgml. Writing ch01.html for chapter Error: no ID for constraint linkend: bbackupquery.xml. Writing ch02.html for chapter Writing apa.html for appendix Writing apb.html for appendix Writing index.html for book /usr/bin/xsltproc -o box-html/instguide/ bb-book.xsl instguide.xml Writing pr01.html for preface Writing ch01.html for chapter Writing ch02.html for chapter Writing apa.html for appendix Writing apb.html for appendix Writing apc.html for appendix Writing index.html for book if [ ! -d man-pages ]; then mkdir man-pages; touch man-pages/.there; fi if [ ! -d man-html ]; then mkdir -p box-html/man-html; touch box-html/man-html/.there; fi /usr/bin/xsltproc -o bbackupquery.1 bb-man.xsl bbackupquery.xml Writing bbackupquery.1 for refentry mv bbackupquery.1 man-pages/. gzip -f -9 man-pages/bbackupquery.1 /usr/bin/xsltproc -o bbackupctl.1 bb-man.xsl bbackupctl.xml Writing bbackupctl.1 for refentry mv bbackupctl.1 man-pages/. gzip -f -9 man-pages/bbackupctl.1 /usr/bin/xsltproc -o bbstoreaccounts.1 bb-man.xsl bbstoreaccounts.xml Writing bbstoreaccounts.1 for refentry mv bbstoreaccounts.1 man-pages/. gzip -f -9 man-pages/bbstoreaccounts.1 /usr/bin/xsltproc -o bbstored-config.1 bb-man.xsl bbstored-config.xml Writing bbstored-config.1 for refentry mv bbstored-config.1 man-pages/. gzip -f -9 man-pages/bbstored-config.1 /usr/bin/xsltproc -o raidfile-config.1 bb-man.xsl raidfile-config.xml Writing raidfile-config.1 for refentry mv raidfile-config.1 man-pages/. gzip -f -9 man-pages/raidfile-config.1 /usr/bin/xsltproc -o bbstored-certs.1 bb-man.xsl bbstored-certs.xml Writing bbstored-certs.1 for refentry mv bbstored-certs.1 man-pages/. gzip -f -9 man-pages/bbstored-certs.1 /usr/bin/xsltproc -o bbackupquery.html bb-nochunk-book.xsl bbackupquery.xml mv bbackupquery.html box-html/man-html/. /usr/bin/xsltproc -o bbackupctl.html bb-nochunk-book.xsl bbackupctl.xml mv bbackupctl.html box-html/man-html/. /usr/bin/xsltproc -o bbstoreaccounts.html bb-nochunk-book.xsl bbstoreaccounts.xml mv bbstoreaccounts.html box-html/man-html/. /usr/bin/xsltproc -o bbstored-config.html bb-nochunk-book.xsl bbstored-config.xml mv bbstored-config.html box-html/man-html/. /usr/bin/xsltproc -o raidfile-config.html bb-nochunk-book.xsl raidfile-config.xml mv raidfile-config.html box-html/man-html/. /usr/bin/xsltproc -o bbstored-certs.html bb-nochunk-book.xsl bbstored-certs.xml mv bbstored-certs.html box-html/man-html/. I then did cd to the xxe bin directory, ran ./xxe, opened the adminguide.xml, got an ignorable, I think, Information window about ExceptionCodes needing to be edited separately if desired, and then the adminguide.xml opened fine. Next, I tried to open the just-created adminguide.html in a browser, file:///home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup/box-html/adminguide/index.html but it was missing images and wasn't much better than the one I made from inside xxe. kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ find | grep png$ ./html/images/stepahead.png ./html/images/bblogo.png ./html/images/arrow.png Then man pages in ./box-html/man-html/bbstored-config.html seemed fine, but maybe with an extra carriage return after every line. Would be nice to have: an index.html in the man-pages directory. Otherwise, opening file:///home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup/box-html/man-html/ provides the man-pages folder listing; ugly but useable (clickable, with back-button available for navigation between man pages). kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ find . | grep there ./box-html/man-html/.there ./man-pages/.there For the record: kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ grep xsltproc Makefile DBPROC=/usr/bin/xsltproc kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ which xsltproc /usr/bin/xsltproc --- Per Thomsen wrote: > On 8/11/06 9:57 PM, E.W. Peter Jalajas wrote: > Sure. Type 'make' in the boxbackup/documentation/boxbackup directory. > That creates the ExceptionCodes.xml file, and you can then open > adminguide.xml. This also generates the nicer looking HTML pages for > you, as well as the man-pages. > 'make' is your friend... Look at the Makefile, to see what I'm doing. From boxbackup-dev at fluffy.co.uk Sat Aug 12 18:50:21 2006 From: boxbackup-dev at fluffy.co.uk (Per Thomsen) Date: Sat, 12 Aug 2006 10:50:21 -0700 Subject: [Box Backup-dev] DocProject editing setup In-Reply-To: <20060812130542.74786.qmail@web60625.mail.yahoo.com> References: <20060812130542.74786.qmail@web60625.mail.yahoo.com> Message-ID: <44DE14DD.4010402@reedtz.com> On 8/12/06 6:05 AM, E.W. Peter Jalajas wrote: > Thanks, Per. > > Maybe these are bugs: > 1) No rule to make target `../../ExceptionCodes.txt > I am making the assumption that the development environment has been bootstrapped. That may be a bad assumption. To resolve, go to the top-level directory (trunk or the like), and type ./bootstrap && ./configure That gets the development environment ready for building, including creating ExceptionCodes.txt. I require ExceptionCodes.txt, so I have the latest error messages from the code directly. I suppose there is a way to make that happen from within my Makefile. I will look into that. > 2) Error: no ID for constraint linkend: > 3) Missing box-html images. > 4) Low priority: no index.html in man-pages dir. > 5) Low priority: .there file in man-page dirs. > Not sure I understand what your comment is here. Is there a problem with the .there files? > Slightly edited screen swipes as follows: [snip] > Then I ran make and saw these errors: > > [snip] > Error: no ID for constraint linkend: instguide.xml. > Error: no ID for constraint linkend: instguide.sgml. > Writing ch01.html for chapter > Error: no ID for constraint linkend: bbackupquery.xml. > Writing ch02.html for chapter > Writing apa.html for appendix > [snip] Yeah, I get these errors, too. Have to admit that I did not notice them before. Will look into. Has to do with the cross-linking of separate documents. > I then did cd to the xxe bin directory, ran ./xxe, opened the > adminguide.xml, got an ignorable, I think, Information window about > ExceptionCodes needing to be edited separately if desired, and then the > adminguide.xml opened fine. > > Next, I tried to open the just-created adminguide.html in a browser, > file:///home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup/box-html/adminguide/index.html > but it was missing images and wasn't much better than the one I made > from inside xxe. > Hmmmmm... This could definitely do with some improvement for the doc developer... What I did, was to create a make target (dockit) which creates a tar file with all the stuff you need to install the HTML documentation on a web server. Unfortunately, that doesn't help you when trying to look at the changes you've made. I will fix that this weekend, and check in a new Makefile that will build you a place where you can look at the HTML using a file:/// URL. > kids at brick:/home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup$ > find | grep png$ > ./html/images/stepahead.png > ./html/images/bblogo.png > ./html/images/arrow.png > > Then man pages in ./box-html/man-html/bbstored-config.html > seemed fine, but maybe with an extra carriage return after every line. > > Would be nice to have: an index.html in the man-pages directory. > Yes. Thats' on my list. > Otherwise, opening > file:///home/public/pete/teb/cli/bu/doc/boxbackup/documentation/boxbackup/box-html/man-html/ > [snip] Thanks for trying it out. Glad you're on board! Thanks, Per -- Per Reedtz Thomsen | Reedtz Consulting, LLC | F: 209 883 4119 V: 209 883 4102 | pthomsen at reedtz.com | C: 209 996 9561 GPG ID: 1209784F | Yahoo! Chat: pthomsen | AIM: pthomsen From boxbackup-dev at fluffy.co.uk Sat Aug 19 13:25:52 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 19 Aug 2006 13:25:52 +0100 Subject: [Box Backup-dev] COMMIT r779 - box/chris/general/test/backupdiff Message-ID: Author: chris Date: 2006-08-19 13:25:52 +0100 (Sat, 19 Aug 2006) New Revision: 779 Modified: box/chris/general/test/backupdiff/testbackupdiff.cpp Log: * testbackupdiff.cpp - Added debugging for failure to create sparse file for test Modified: box/chris/general/test/backupdiff/testbackupdiff.cpp =================================================================== --- box/chris/general/test/backupdiff/testbackupdiff.cpp 2006-08-11 08:50:28 UTC (rev 778) +++ box/chris/general/test/backupdiff/testbackupdiff.cpp 2006-08-19 12:25:52 UTC (rev 779) @@ -71,7 +71,12 @@ TEST_THAT(handle != INVALID_HANDLE_VALUE); SetFilePointer(handle, size, NULL, FILE_BEGIN); TEST_THAT(GetLastError() == NO_ERROR); - TEST_THAT(SetEndOfFile(handle) == true); + bool result = SetEndOfFile(handle); + if (!result) + { + printf("Error %d\n", (int)GetLastError()); + } + TEST_THAT(result == true); TEST_THAT(CloseHandle(handle) == true); #else int fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0600); From boxbackup-dev at fluffy.co.uk Sat Aug 19 16:13:57 2006 From: boxbackup-dev at fluffy.co.uk (Charles Lecklider) Date: Sat, 19 Aug 2006 16:13:57 +0100 Subject: [Box Backup-dev] COMMIT r779 - box/chris/general/test/backupdiff In-Reply-To: References: Message-ID: <44E72AB5.9000805@invis.net> subversion at fluffy.co.uk wrote: > Author: chris > Date: 2006-08-19 13:25:52 +0100 (Sat, 19 Aug 2006) > New Revision: 779 > > Modified: > box/chris/general/test/backupdiff/testbackupdiff.cpp > Log: > * testbackupdiff.cpp > - Added debugging for failure to create sparse file for test OK, I know this is debug code, but.... > Modified: box/chris/general/test/backupdiff/testbackupdiff.cpp > =================================================================== > --- box/chris/general/test/backupdiff/testbackupdiff.cpp 2006-08-11 08:50:28 UTC (rev 778) > +++ box/chris/general/test/backupdiff/testbackupdiff.cpp 2006-08-19 12:25:52 UTC (rev 779) > @@ -71,7 +71,12 @@ > TEST_THAT(handle != INVALID_HANDLE_VALUE); > SetFilePointer(handle, size, NULL, FILE_BEGIN); Why not just check for INVALID_SET_FILE_POINTER being returned here? > TEST_THAT(GetLastError() == NO_ERROR); > - TEST_THAT(SetEndOfFile(handle) == true); This should always fail; TRUE != true. > + bool result = SetEndOfFile(handle); No! It's a BOOL, not a bool. > + if (!result) > + { > + printf("Error %d\n", (int)GetLastError()); What's wrong with %u and no cast? > + } > + TEST_THAT(result == true); > TEST_THAT(CloseHandle(handle) == true); Should always fail; TRUE != true. The latest PSDK has "typedef int BOOL;", so there's all sorts of implicit conversions going on here, and for no good reason that I can see. Sorry to jump on this, but it's indicative of the first round of compiler warnings I'm still trying to find time to trawl through and fix before I get started on the real work. No-one likes Microsoft for inconsistent use of INVALID_HANDLE_VALUE and NULL, or BOOL, or any number of other things, but that's the way it is.... -C From boxbackup-dev at fluffy.co.uk Sat Aug 19 16:31:48 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 19 Aug 2006 16:31:48 +0100 Subject: [Box Backup-dev] COMMIT r781 - box/chris/general/lib/common Message-ID: Author: chris Date: 2006-08-19 16:31:48 +0100 (Sat, 19 Aug 2006) New Revision: 781 Modified: box/chris/general/lib/common/FileStream.cpp box/chris/general/lib/common/FileStream.h Log: * FileStream.h FileStream.cpp - Replaced fd/HANDLE constructor, used by LocalProcessStream Modified: box/chris/general/lib/common/FileStream.cpp =================================================================== --- box/chris/general/lib/common/FileStream.cpp 2006-08-19 15:30:46 UTC (rev 780) +++ box/chris/general/lib/common/FileStream.cpp 2006-08-19 15:31:48 UTC (rev 781) @@ -43,9 +43,57 @@ #endif } + // -------------------------------------------------------------------------- // // Function +// Name: FileStream::FileStream(tOSFileHandle) +// Purpose: Constructor, using existing file descriptor +// Created: 2003/08/28 +// +// -------------------------------------------------------------------------- +FileStream::FileStream(tOSFileHandle FileDescriptor) + : mOSFileHandle(FileDescriptor), + mIsEOF(false) +{ +#ifdef WIN32 + if(mOSFileHandle == INVALID_HANDLE_VALUE) +#else + if(mOSFileHandle < 0) +#endif + { + MEMLEAKFINDER_NOT_A_LEAK(this); + THROW_EXCEPTION(CommonException, OSFileOpenError) + } +#ifdef WIN32 + this->fileName = "HANDLE"; +#endif +} + +#if 0 +// -------------------------------------------------------------------------- +// +// Function +// Name: FileStream::FileStream(const FileStream &) +// Purpose: Copy constructor, creates a duplicate of the file handle +// Created: 2003/07/31 +// +// -------------------------------------------------------------------------- +FileStream::FileStream(const FileStream &rToCopy) + : mOSFileHandle(::dup(rToCopy.mOSFileHandle)), + mIsEOF(rToCopy.mIsEOF) +{ + if(mOSFileHandle < 0) + { + MEMLEAKFINDER_NOT_A_LEAK(this); + THROW_EXCEPTION(CommonException, OSFileOpenError) + } +} +#endif // 0 + +// -------------------------------------------------------------------------- +// +// Function // Name: FileStream::~FileStream() // Purpose: Destructor, closes file // Created: 2003/07/31 Modified: box/chris/general/lib/common/FileStream.h =================================================================== --- box/chris/general/lib/common/FileStream.h 2006-08-19 15:30:46 UTC (rev 780) +++ box/chris/general/lib/common/FileStream.h 2006-08-19 15:31:48 UTC (rev 781) @@ -38,6 +38,7 @@ int flags = O_RDONLY, #endif int mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)); + FileStream(tOSFileHandle FileDescriptor); virtual ~FileStream(); From boxbackup-dev at fluffy.co.uk Sat Aug 19 16:32:17 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 19 Aug 2006 16:32:17 +0100 Subject: [Box Backup-dev] COMMIT r782 - box/chris/general/lib/server Message-ID: Author: chris Date: 2006-08-19 16:32:16 +0100 (Sat, 19 Aug 2006) New Revision: 782 Modified: box/chris/general/lib/server/LocalProcessStream.cpp Log: * LocalProcessStream.cpp - Added support for SyncAllowScript under Win32 Modified: box/chris/general/lib/server/LocalProcessStream.cpp =================================================================== --- box/chris/general/lib/server/LocalProcessStream.cpp 2006-08-19 15:31:48 UTC (rev 781) +++ box/chris/general/lib/server/LocalProcessStream.cpp 2006-08-19 15:32:16 UTC (rev 782) @@ -18,10 +18,15 @@ #endif #include "LocalProcessStream.h" -#include "SocketStream.h" #include "autogen_ServerException.h" #include "Utils.h" +#ifdef WIN32 + #include "FileStream.h" +#else + #include "SocketStream.h" +#endif + #include "MemLeakFindOn.h" #define MAX_ARGUMENTS 64 @@ -101,9 +106,64 @@ // Return the stream object and PID rPidOut = pid; return stream; + #else // WIN32 - ::syslog(LOG_ERR, "vfork not implemented - LocalProcessStream.cpp"); - std::auto_ptr stream; + + SECURITY_ATTRIBUTES secAttr; + secAttr.nLength = sizeof(SECURITY_ATTRIBUTES); + secAttr.bInheritHandle = TRUE; + secAttr.lpSecurityDescriptor = NULL; + + HANDLE WriteInChild, ReadFromChild; + if (!CreatePipe(&ReadFromChild, &WriteInChild, &secAttr, 0)) + { + ::syslog(LOG_ERR, "Failed to CreatePipe for child process: " + "error %d", GetLastError()); + THROW_EXCEPTION(ServerException, SocketPairFailed) + } + SetHandleInformation(ReadFromChild, HANDLE_FLAG_INHERIT, 0); + + PROCESS_INFORMATION ProcInfo; + STARTUPINFO StartupInfo; + + ZeroMemory(&ProcInfo, sizeof(ProcInfo)); + ZeroMemory(&StartupInfo, sizeof(StartupInfo)); + StartupInfo.cb = sizeof(StartupInfo); + StartupInfo.hStdError = WriteInChild; + StartupInfo.hStdOutput = WriteInChild; + StartupInfo.hStdInput = INVALID_HANDLE_VALUE; + StartupInfo.dwFlags |= STARTF_USESTDHANDLES; + + CHAR* CommandLineCopy = (CHAR*)malloc(strlen(CommandLine) + 1); + strcpy(CommandLineCopy, CommandLine); + + bool result = CreateProcess(NULL, + CommandLineCopy, // command line + NULL, // process security attributes + NULL, // primary thread security attributes + TRUE, // handles are inherited + 0, // creation flags + NULL, // use parent's environment + NULL, // use parent's current directory + &StartupInfo, // STARTUPINFO pointer + &ProcInfo); // receives PROCESS_INFORMATION + + free(CommandLineCopy); + + if (!result) + { + ::syslog(LOG_ERR, "Failed to CreateProcess: '%s': " + "error %d", CommandLine, GetLastError()); + CloseHandle(WriteInChild); + CloseHandle(ReadFromChild); + THROW_EXCEPTION(ServerException, ServerForkError) + } + + CloseHandle(ProcInfo.hProcess); + CloseHandle(ProcInfo.hThread); + CloseHandle(WriteInChild); + + std::auto_ptr stream(new FileStream(ReadFromChild)); return stream; #endif // ! WIN32 } From boxbackup-dev at fluffy.co.uk Sat Aug 19 16:33:10 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 19 Aug 2006 16:33:10 +0100 Subject: [Box Backup-dev] COMMIT r783 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2006-08-19 16:33:10 +0100 (Sat, 19 Aug 2006) New Revision: 783 Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp Log: * BackupDaemon.cpp - Log output of SyncAllowScript if it could not be parsed correctly Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupDaemon.cpp 2006-08-19 15:32:16 UTC (rev 782) +++ box/chris/general/bin/bbackupd/BackupDaemon.cpp 2006-08-19 15:33:10 UTC (rev 783) @@ -59,6 +59,7 @@ #include "BackupStoreFilenameClear.h" #include "BackupClientInodeToIDMap.h" #include "autogen_BackupProtocolClient.h" +#include "autogen_ConversionException.h" #include "BackupClientCryptoKeys.h" #include "BannerText.h" #include "BackupStoreFile.h" @@ -982,8 +983,21 @@ } else { - // How many seconds to wait? - waitInSeconds = BoxConvert::Convert(line); + try + { + // How many seconds to wait? + waitInSeconds = BoxConvert::Convert(line); + } + catch(ConversionException &e) + { + ::syslog(LOG_ERR, "Invalid output " + "from SyncAllowScript '%s': " + "'%s'", + conf.GetKeyValue("SyncAllowScript").c_str(), + line.c_str()); + throw; + } + ::syslog(LOG_INFO, "Delaying sync by %d seconds (SyncAllowScript '%s')", waitInSeconds, conf.GetKeyValue("SyncAllowScript").c_str()); } } From boxbackup-dev at fluffy.co.uk Sat Aug 19 16:33:39 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 19 Aug 2006 16:33:39 +0100 Subject: [Box Backup-dev] COMMIT r784 - box/chris/general/lib/win32 Message-ID: Author: chris Date: 2006-08-19 16:33:39 +0100 (Sat, 19 Aug 2006) New Revision: 784 Modified: box/chris/general/lib/win32/emu.cpp Log: * emu.cpp - Flush stdout after writing messages Modified: box/chris/general/lib/win32/emu.cpp =================================================================== --- box/chris/general/lib/win32/emu.cpp 2006-08-19 15:33:10 UTC (rev 783) +++ box/chris/general/lib/win32/emu.cpp 2006-08-19 15:33:39 UTC (rev 784) @@ -1349,6 +1349,7 @@ if (len < 0) { printf("%s\r\n", buffer); + fflush(stdout); return; } @@ -1362,6 +1363,7 @@ if (gSyslogH == 0) { printf("%s\r\n", buffer); + fflush(stdout); return; } @@ -1384,6 +1386,7 @@ { printf("Unable to send message to Event Log " "(Event Log is full):\r\n"); + fflush(stdout); sHaveWarnedEventLogFull = TRUE; } } @@ -1391,6 +1394,7 @@ { printf("Unable to send message to Event Log: " "error %i:\r\n", (int)err); + fflush(stdout); } } else @@ -1399,6 +1403,7 @@ } printf("%s\r\n", buffer); + fflush(stdout); } int emu_chdir(const char* pDirName) From boxbackup-dev at fluffy.co.uk Sat Aug 19 16:30:46 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 19 Aug 2006 16:30:46 +0100 Subject: [Box Backup-dev] COMMIT r780 - in box/chris/general: . test/bbackupd test/bbackupd/testfiles Message-ID: Author: chris Date: 2006-08-19 16:30:46 +0100 (Sat, 19 Aug 2006) New Revision: 780 Added: box/chris/general/test/bbackupd/testfiles/syncallowscript.pl.in Modified: box/chris/general/configure.ac box/chris/general/test/bbackupd/testbbackupd.cpp box/chris/general/test/bbackupd/testfiles/bbackupd.conf.in Log: * test/bbackupd/testfiles/syncallowscript.pl.in - Added a SyncAllowScript for use in unit test * configure.ac - Auto-generate syncallowscript.pl from syncallowscript.pl.in * test/bbackupd/testfiles/bbackupd.conf.in - Use SyncAllowScript * test/bbackupd/testbbackupd.cpp - Added test for correct functioning of SyncAllowScript Modified: box/chris/general/configure.ac =================================================================== --- box/chris/general/configure.ac 2006-08-19 12:25:52 UTC (rev 779) +++ box/chris/general/configure.ac 2006-08-19 15:30:46 UTC (rev 780) @@ -253,7 +253,8 @@ test/bbackupd/testfiles/bbackupd.conf test/bbackupd/testfiles/extcheck1.pl test/bbackupd/testfiles/extcheck2.pl - test/bbackupd/testfiles/notifyscript.pl]) + test/bbackupd/testfiles/notifyscript.pl + test/bbackupd/testfiles/syncallowscript.pl]) # TODO: Need to do contrib/cygwin/install-cygwin-service.pl but location varies AC_OUTPUT Modified: box/chris/general/test/bbackupd/testbbackupd.cpp =================================================================== --- box/chris/general/test/bbackupd/testbbackupd.cpp 2006-08-19 12:25:52 UTC (rev 779) +++ box/chris/general/test/bbackupd/testbbackupd.cpp 2006-08-19 15:30:46 UTC (rev 780) @@ -541,7 +541,7 @@ TestRemoteProcessMemLeaks("bbackupctl.memleaks"); } -void wait_for_sync() +void wait_for_sync_start() { TEST_THAT(::system(BBACKUPCTL " -q -c testfiles/bbackupd.conf " "wait-for-sync") == 0); @@ -679,8 +679,100 @@ compareReturnValue = ::system(BBACKUPQUERY " -q -c testfiles/bbackupd.conf -l testfiles/query1.log \"compare -ac\" quit"); TEST_RETURN(compareReturnValue, 1); TestRemoteProcessMemLeaks("bbackupquery.memleaks"); + + // Check that SyncAllowScript is executed and can pause backup + printf("==== Check that SyncAllowScript is executed and can " + "pause backup\n"); + fflush(stdout); + + { + wait_for_sync_end(); + // we now have 3 seconds before bbackupd + // runs the SyncAllowScript again. + + char* sync_control_file = "testfiles" + DIRECTORY_SEPARATOR "syncallowscript.control"; + int fd = open(sync_control_file, + O_CREAT | O_EXCL | O_WRONLY, 0700); + if (fd <= 0) + { + perror(sync_control_file); + } + TEST_THAT(fd > 0); - printf("Delete file and update another, create symlink.\n"); + char* control_string = "10\n"; + TEST_THAT(write(fd, control_string, + strlen(control_string)) == + (int)strlen(control_string)); + close(fd); + + // this will pause backups, bbackupd will check + // every 10 seconds to see if they are allowed again. + + char* new_test_file = "testfiles" + DIRECTORY_SEPARATOR "TestDir1" + DIRECTORY_SEPARATOR "Added_During_Pause"; + fd = open(new_test_file, + O_CREAT | O_EXCL | O_WRONLY, 0700); + if (fd <= 0) + { + perror(new_test_file); + } + TEST_THAT(fd > 0); + close(fd); + + struct stat st; + + // next poll should happen within the next + // 5 seconds (normally about 3 seconds) + + sleep(1); // 2 seconds before + TEST_THAT(stat("testfiles" DIRECTORY_SEPARATOR + "syncallowscript.notifyran.1", &st) != 0); + sleep(4); // 2 seconds after + TEST_THAT(stat("testfiles" DIRECTORY_SEPARATOR + "syncallowscript.notifyran.1", &st) == 0); + TEST_THAT(stat("testfiles" DIRECTORY_SEPARATOR + "syncallowscript.notifyran.2", &st) != 0); + + // next poll should happen within the next + // 10 seconds (normally about 8 seconds) + + sleep(6); // 2 seconds before + TEST_THAT(stat("testfiles" DIRECTORY_SEPARATOR + "syncallowscript.notifyran.2", &st) != 0); + sleep(4); // 2 seconds after + TEST_THAT(stat("testfiles" DIRECTORY_SEPARATOR + "syncallowscript.notifyran.2", &st) == 0); + + // check that no backup has run (compare fails) + compareReturnValue = ::system(BBACKUPQUERY " -q " + "-c testfiles/bbackupd.conf " + "-l testfiles/query3.log \"compare -ac\" quit"); + TEST_RETURN(compareReturnValue, 2); + TestRemoteProcessMemLeaks("bbackupquery.memleaks"); + + long start_time = time(NULL); + TEST_THAT(unlink(sync_control_file) == 0); + wait_for_sync_start(); + long end_time = time(NULL); + + long wait_time = end_time - start_time + 2; + // should be about 10 seconds + printf("Waited for %ld seconds, should have been %s", + wait_time, control_string); + TEST_THAT(wait_time >= 8); + TEST_THAT(wait_time <= 12); + + // check that backup has run (compare succeeds) + compareReturnValue = ::system(BBACKUPQUERY " -q " + "-c testfiles/bbackupd.conf " + "-l testfiles/query3.log \"compare -ac\" quit"); + TEST_RETURN(compareReturnValue, 1); + TestRemoteProcessMemLeaks("bbackupquery.memleaks"); + } + + printf("==== Delete file and update another, create symlink.\n"); // Delete a file TEST_THAT(::unlink("testfiles/TestDir1/x1/dsfdsfs98.fd") == 0); @@ -714,7 +806,7 @@ TestRemoteProcessMemLeaks("bbackupquery.memleaks"); // Bad case: delete a file/symlink, replace it with a directory - printf("Replace symlink with directory, add new directory\n"); + printf("==== Replace symlink with directory, add new directory\n"); #ifndef WIN32 TEST_THAT(::unlink("testfiles/TestDir1/symlink-to-dir") == 0); #endif @@ -731,7 +823,7 @@ TestRemoteProcessMemLeaks("bbackupquery.memleaks"); // And the inverse, replace a directory with a file/symlink - printf("Replace directory with symlink\n"); + printf("==== Replace directory with symlink\n"); #ifndef WIN32 TEST_THAT(::unlink("testfiles/TestDir1/x1/dir-to-file/contents") == 0); #endif @@ -745,7 +837,7 @@ TestRemoteProcessMemLeaks("bbackupquery.memleaks"); // And then, put it back to how it was before. - printf("Replace symlink with directory (which was a symlink)\n"); + printf("==== Replace symlink with directory (which was a symlink)\n"); #ifndef WIN32 TEST_THAT(::unlink("testfiles/TestDir1/x1/dir-to-file") == 0); #endif @@ -760,7 +852,7 @@ // And finally, put it back to how it was before it was put back to how it was before // This gets lots of nasty things in the store with directories over other old directories. - printf("Put it all back to how it was\n"); + printf("==== Put it all back to how it was\n"); #ifndef WIN32 TEST_THAT(::unlink("testfiles/TestDir1/x1/dir-to-file/contents2") == 0); #endif @@ -784,7 +876,7 @@ TEST_RETURN(compareReturnValue, 1); TestRemoteProcessMemLeaks("bbackupquery.memleaks"); - printf("Add files with old times, update attributes of one to latest time\n"); + printf("==== Add files with old times, update attributes of one to latest time\n"); // Move that file back TEST_THAT(::rename("testfiles/TestDir1/x1/dsfdsfs98.fd", "testfiles/TestDir1/df9834.dsf") == 0); @@ -804,9 +896,10 @@ compareReturnValue = ::system(BBACKUPQUERY " -q -c testfiles/bbackupd.conf -l testfiles/query3.log \"compare -ac\" quit"); TEST_RETURN(compareReturnValue, 1); TestRemoteProcessMemLeaks("bbackupquery.memleaks"); - + // Check that modifying files with old timestamps still get added - printf("Modify existing file, but change timestamp to rather old\n"); + printf("==== Modify existing file, but change timestamp " + "to rather old\n"); wait_for_sync_end(); // Then modify an existing file @@ -849,7 +942,7 @@ TestRemoteProcessMemLeaks("bbackupquery.memleaks"); // Add some files and directories which are marked as excluded - printf("Add files and dirs for exclusion test\n"); + printf("==== Add files and dirs for exclusion test\n"); #ifdef WIN32 TEST_THAT(::system("tar xzvf testfiles/testexclude.tgz -C testfiles") == 0); #else @@ -876,7 +969,7 @@ // check that the excluded files did not make it // into the store, and the included files did - printf("Check that exclude/alwaysinclude commands " + printf("==== Check that exclude/alwaysinclude commands " "actually work\n"); { @@ -956,7 +1049,7 @@ if(::getuid() != 0) { // Check that read errors are reported neatly - printf("Add unreadable files\n"); + printf("==== Add unreadable files\n"); { // Dir and file which can't be read TEST_THAT(::mkdir("testfiles/TestDir1/sub23/read-fail-test-dir", 0000) == 0); @@ -981,11 +1074,11 @@ } #endif - printf("Continuously update file, check isn't uploaded\n"); + printf("==== Continuously update file, check isn't uploaded\n"); // Make sure everything happens at the same point in the // sync cycle: wait until exactly the start of a sync - wait_for_sync(); + wait_for_sync_start(); // Then wait a second, to make sure the scan is complete ::sleep(1); @@ -1016,7 +1109,8 @@ TEST_RETURN(compareReturnValue, 1); TestRemoteProcessMemLeaks("bbackupquery.memleaks"); - printf("Keep on continuously updating file, check it is uploaded eventually\n"); + printf("==== Keep on continuously updating file, " + "check it is uploaded eventually\n"); for(int l = 0; l < 28; ++l) { @@ -1042,7 +1136,7 @@ TestRemoteProcessMemLeaks("bbackupquery.memleaks"); } - printf("Delete directory, change attributes\n"); + printf("==== Delete directory, change attributes\n"); // Delete a directory TEST_THAT(::system("rm -rf testfiles/TestDir1/x1") == 0); @@ -1055,7 +1149,7 @@ TEST_RETURN(compareReturnValue, 1); TestRemoteProcessMemLeaks("bbackupquery.memleaks"); - printf("Restore files and directories\n"); + printf("==== Restore files and directories\n"); int64_t deldirid = 0; int64_t restoredirid = 0; { @@ -1183,7 +1277,7 @@ TestRemoteProcessMemLeaks("bbackupquery.memleaks"); #endif - printf("Add files with current time\n"); + printf("==== Add files with current time\n"); // Add some more files and modify others // Use the m flag this time so they have a recent modification time @@ -1200,7 +1294,7 @@ TestRemoteProcessMemLeaks("bbackupquery.memleaks"); // Rename directory - printf("Rename directory\n"); + printf("==== Rename directory\n"); TEST_THAT(rename("testfiles/TestDir1/sub23/dhsfdss", "testfiles/TestDir1/renamed-dir") == 0); wait_for_backup_operation(); compareReturnValue = ::system(BBACKUPQUERY " -q -c testfiles/bbackupd.conf -l testfiles/query6.log \"compare -ac\" quit"); @@ -1212,7 +1306,7 @@ TestRemoteProcessMemLeaks("bbackupquery.memleaks"); // Rename some files -- one under the threshold, others above - printf("Rename files\n"); + printf("==== Rename files\n"); TEST_THAT(rename("testfiles/TestDir1/continousupdate", "testfiles/TestDir1/continousupdate-ren") == 0); TEST_THAT(rename("testfiles/TestDir1/df324", "testfiles/TestDir1/df324-ren") == 0); TEST_THAT(rename("testfiles/TestDir1/sub23/find2perl", "testfiles/TestDir1/find2perl-ren") == 0); @@ -1222,9 +1316,10 @@ TestRemoteProcessMemLeaks("bbackupquery.memleaks"); // Check that modifying files with madly in the future timestamps still get added - printf("Create a file with timestamp to way ahead in the future\n"); + printf("==== Create a file with timestamp way ahead " + "in the future\n"); // Time critical, so sync - wait_for_sync(); + wait_for_sync_start(); // Then wait a second, to make sure the scan is complete ::sleep(1); @@ -1248,7 +1343,7 @@ TEST_RETURN(compareReturnValue, 1); TestRemoteProcessMemLeaks("bbackupquery.memleaks"); - printf("Change client store marker\n"); + printf("==== Change client store marker\n"); // Then... connect to the server, and change the client store marker. See what that does! { @@ -1283,7 +1378,7 @@ TEST_THAT(done); } - printf("Check change of store marker pauses daemon\n"); + printf("==== Check change of store marker pauses daemon\n"); // Make a change to a file, to detect whether or not // it's hanging around waiting to retry. @@ -1301,7 +1396,7 @@ TestRemoteProcessMemLeaks("bbackupquery.memleaks"); #ifndef WIN32 - printf("Interrupted restore\n"); + printf("==== Interrupted restore\n"); { do_interrupted_restore(context, restoredirid); int64_t resumesize = 0; @@ -1335,7 +1430,7 @@ } #endif - printf("Check restore deleted files\n"); + printf("==== Check restore deleted files\n"); { SocketStreamTLS conn; conn.Open(context, Socket::TypeINET, "localhost", BOX_PORT_BBSTORED); @@ -1363,12 +1458,12 @@ TEST_THAT(!TestFileExists("testfiles/notifyran.read-error.2")); #ifdef WIN32 - printf("Testing locked file behaviour:\n"); + printf("==== Testing locked file behaviour:\n"); // Test that locked files cannot be backed up, // and the appropriate error is reported. // Wait for the sync to finish, so that we have time to work - wait_for_sync(); + wait_for_sync_start(); // Now we have about three seconds to work handle = openfile("testfiles/TestDir1/lockedfile", Modified: box/chris/general/test/bbackupd/testfiles/bbackupd.conf.in =================================================================== --- box/chris/general/test/bbackupd/testfiles/bbackupd.conf.in 2006-08-19 12:25:52 UTC (rev 779) +++ box/chris/general/test/bbackupd/testfiles/bbackupd.conf.in 2006-08-19 15:30:46 UTC (rev 780) @@ -23,7 +23,8 @@ CommandSocket = testfiles/bbackupd.sock -NotifyScript = @PERL_NATIVE@ testfiles/notifyscript.pl +NotifyScript = @PERL_NATIVE@ testfiles/notifyscript.pl +SyncAllowScript = @PERL_NATIVE@ testfiles/syncallowscript.pl Server { Copied: box/chris/general/test/bbackupd/testfiles/syncallowscript.pl.in (from rev 779, box/chris/general/test/bbackupd/testfiles/notifyscript.pl.in) =================================================================== --- box/chris/general/test/bbackupd/testfiles/syncallowscript.pl.in (rev 0) +++ box/chris/general/test/bbackupd/testfiles/syncallowscript.pl.in 2006-08-19 15:30:46 UTC (rev 780) @@ -0,0 +1,33 @@ +#!@PERL@ + +use strict; +use warnings; + +my $control_file = 'testfiles/syncallowscript.control'; +if (! -r $control_file) +{ + print "now\n"; + exit 0; +} + +my $control_state; +open CONTROL, "< $control_file" or die "$control_file: $!"; +$control_state = ; +defined $control_state or die "$control_file: read failed: $!"; +close CONTROL; + +my $marker_file_root = 'testfiles/syncallowscript.notifyran.'; +my $n = 1; +my $marker_file; + +while($marker_file = $marker_file_root.$n and -e $marker_file) +{ + $n ++; +} + +open FL,'>'.$marker_file or die "$marker_file: $!"; +print FL localtime(); +close FL; + +print $control_state; +exit 0; From boxbackup-dev at fluffy.co.uk Sat Aug 19 16:50:02 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 19 Aug 2006 16:50:02 +0100 Subject: [Box Backup-dev] COMMIT r785 - box/chris/win32/releases Message-ID: Author: chris Date: 2006-08-19 16:50:02 +0100 (Sat, 19 Aug 2006) New Revision: 785 Added: box/chris/win32/releases/boxbackup-chris_general_784-backup-client-mingw32.zip Log: * boxbackup-chris_general_784-backup-client-mingw32.zip - Fixed SyncAllowScript on Win32 Copied: box/chris/win32/releases/boxbackup-chris_general_784-backup-client-mingw32.zip (from rev 778, box/chris/win32/releases/boxbackup-chris_general_777M-backup-client-mingw32.zip) =================================================================== (Binary files differ) From boxbackup-dev at fluffy.co.uk Sat Aug 19 16:56:40 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Sat, 19 Aug 2006 16:56:40 +0100 (BST) Subject: [Box Backup-dev] COMMIT r779 - box/chris/general/test/backupdiff In-Reply-To: <44E72AB5.9000805@invis.net> References: <44E72AB5.9000805@invis.net> Message-ID: Hi Charles, On Sat, 19 Aug 2006, Charles Lecklider wrote: > OK, I know this is debug code, but.... [...] > Sorry to jump on this, but it's indicative of the first round of > compiler warnings I'm still trying to find time to trawl through and fix > before I get started on the real work. No-one likes Microsoft for > inconsistent use of INVALID_HANDLE_VALUE and NULL, or BOOL, or any > number of other things, but that's the way it is.... Thanks for spotting these. In fact the test code works fine on Windows as it is (probably because everything is cast down to bool), but I've made the changes you suggested and will commit them if all tests still pass. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Sat Aug 19 17:00:40 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 19 Aug 2006 17:00:40 +0100 Subject: [Box Backup-dev] COMMIT r786 - box/chris/general/test/backupdiff Message-ID: Author: chris Date: 2006-08-19 17:00:39 +0100 (Sat, 19 Aug 2006) New Revision: 786 Modified: box/chris/general/test/backupdiff/testbackupdiff.cpp Log: * backupdiff/testbackupdiff.cpp - Type conversion fixes suggested by Charles Lecklider Modified: box/chris/general/test/backupdiff/testbackupdiff.cpp =================================================================== --- box/chris/general/test/backupdiff/testbackupdiff.cpp 2006-08-19 15:50:02 UTC (rev 785) +++ box/chris/general/test/backupdiff/testbackupdiff.cpp 2006-08-19 16:00:39 UTC (rev 786) @@ -69,15 +69,16 @@ #ifdef WIN32 HANDLE handle = openfile(filename, O_WRONLY | O_CREAT | O_EXCL, 0); TEST_THAT(handle != INVALID_HANDLE_VALUE); - SetFilePointer(handle, size, NULL, FILE_BEGIN); + TEST_THAT(SetFilePointer(handle, size, NULL, FILE_BEGIN) + != INVALID_SET_FILE_POINTER); TEST_THAT(GetLastError() == NO_ERROR); - bool result = SetEndOfFile(handle); - if (!result) + BOOL result = SetEndOfFile(handle); + if (result != TRUE) { - printf("Error %d\n", (int)GetLastError()); + printf("Error %u\n", GetLastError()); } - TEST_THAT(result == true); - TEST_THAT(CloseHandle(handle) == true); + TEST_THAT(result == TRUE); + TEST_THAT(CloseHandle(handle) == TRUE); #else int fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0600); if (fd < 0) perror(filename); From boxbackup-dev at fluffy.co.uk Sat Aug 19 17:35:22 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Sat, 19 Aug 2006 17:35:22 +0100 Subject: [Box Backup-dev] COMMIT r782 - box/chris/general/lib/server In-Reply-To: References: Message-ID: <876E0C3D-87AC-434B-B84A-4A3FB3A2078E@fluffy.co.uk> mutter mutter coding standards mutter local variables mutter mutter On 19 Aug 2006, at 16:32, subversion at fluffy.co.uk wrote: > Author: chris > Date: 2006-08-19 16:32:16 +0100 (Sat, 19 Aug 2006) > New Revision: 782 > > Modified: > box/chris/general/lib/server/LocalProcessStream.cpp > Log: > * LocalProcessStream.cpp > - Added support for SyncAllowScript under Win32 > > > Modified: box/chris/general/lib/server/LocalProcessStream.cpp > =================================================================== > --- box/chris/general/lib/server/LocalProcessStream.cpp 2006-08-19 > 15:31:48 UTC (rev 781) > +++ box/chris/general/lib/server/LocalProcessStream.cpp 2006-08-19 > 15:32:16 UTC (rev 782) > @@ -18,10 +18,15 @@ > #endif > > #include "LocalProcessStream.h" > -#include "SocketStream.h" > #include "autogen_ServerException.h" > #include "Utils.h" > > +#ifdef WIN32 > + #include "FileStream.h" > +#else > + #include "SocketStream.h" > +#endif > + > #include "MemLeakFindOn.h" > > #define MAX_ARGUMENTS 64 > @@ -101,9 +106,64 @@ > // Return the stream object and PID > rPidOut = pid; > return stream; > + > #else // WIN32 > - ::syslog(LOG_ERR, "vfork not implemented - LocalProcessStream.cpp"); > - std::auto_ptr stream; > + > + SECURITY_ATTRIBUTES secAttr; > + secAttr.nLength = sizeof(SECURITY_ATTRIBUTES); > + secAttr.bInheritHandle = TRUE; > + secAttr.lpSecurityDescriptor = NULL; > + > + HANDLE WriteInChild, ReadFromChild; > + if (!CreatePipe(&ReadFromChild, &WriteInChild, &secAttr, 0)) > + { > + ::syslog(LOG_ERR, "Failed to CreatePipe for child process: " > + "error %d", GetLastError()); > + THROW_EXCEPTION(ServerException, SocketPairFailed) > + } > + SetHandleInformation(ReadFromChild, HANDLE_FLAG_INHERIT, 0); > + > + PROCESS_INFORMATION ProcInfo; > + STARTUPINFO StartupInfo; > + > + ZeroMemory(&ProcInfo, sizeof(ProcInfo)); > + ZeroMemory(&StartupInfo, sizeof(StartupInfo)); > + StartupInfo.cb = sizeof(StartupInfo); > + StartupInfo.hStdError = WriteInChild; > + StartupInfo.hStdOutput = WriteInChild; > + StartupInfo.hStdInput = INVALID_HANDLE_VALUE; > + StartupInfo.dwFlags |= STARTF_USESTDHANDLES; > + > + CHAR* CommandLineCopy = (CHAR*)malloc(strlen(CommandLine) + 1); > + strcpy(CommandLineCopy, CommandLine); > + > + bool result = CreateProcess(NULL, > + CommandLineCopy, // command line > + NULL, // process security attributes > + NULL, // primary thread security attributes > + TRUE, // handles are inherited > + 0, // creation flags > + NULL, // use parent's environment > + NULL, // use parent's current directory > + &StartupInfo, // STARTUPINFO pointer > + &ProcInfo); // receives PROCESS_INFORMATION > + > + free(CommandLineCopy); > + > + if (!result) > + { > + ::syslog(LOG_ERR, "Failed to CreateProcess: '%s': " > + "error %d", CommandLine, GetLastError()); > + CloseHandle(WriteInChild); > + CloseHandle(ReadFromChild); > + THROW_EXCEPTION(ServerException, ServerForkError) > + } > + > + CloseHandle(ProcInfo.hProcess); > + CloseHandle(ProcInfo.hThread); > + CloseHandle(WriteInChild); > + > + std::auto_ptr stream(new FileStream(ReadFromChild)); > return stream; > #endif // ! WIN32 > } > > _______________________________________________ > Boxbackup-dev mailing list > Boxbackup-dev at fluffy.co.uk > http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Sat Aug 19 17:49:15 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Sat, 19 Aug 2006 17:49:15 +0100 (BST) Subject: [Box Backup-dev] COMMIT r782 - box/chris/general/lib/server In-Reply-To: <876E0C3D-87AC-434B-B84A-4A3FB3A2078E@fluffy.co.uk> References: <876E0C3D-87AC-434B-B84A-4A3FB3A2078E@fluffy.co.uk> Message-ID: Hi Ben, > mutter mutter coding standards mutter local variables mutter mutter :-) What's the coding standard for a local variable? Always start with lower case? Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Sat Aug 19 17:50:27 2006 From: boxbackup-dev at fluffy.co.uk (Charles Lecklider) Date: Sat, 19 Aug 2006 17:50:27 +0100 Subject: [Box Backup-dev] COMMIT r779 - box/chris/general/test/backupdiff In-Reply-To: References: <44E72AB5.9000805@invis.net> Message-ID: <44E74153.1030301@invis.net> Chris Wilson wrote: > Hi Charles, > > On Sat, 19 Aug 2006, Charles Lecklider wrote: > >> OK, I know this is debug code, but.... > [...] >> Sorry to jump on this, but it's indicative of the first round of >> compiler warnings I'm still trying to find time to trawl through and fix >> before I get started on the real work. No-one likes Microsoft for >> inconsistent use of INVALID_HANDLE_VALUE and NULL, or BOOL, or any >> number of other things, but that's the way it is.... > > Thanks for spotting these. In fact the test code works fine on Windows > as it is (probably because everything is cast down to bool), but I've > made the changes you suggested and will commit them if all tests still > pass. I've no doubt it works, but that doesn't mean it's right :-) There are similar problems in #782 too. -C From boxbackup-dev at fluffy.co.uk Sat Aug 19 17:56:20 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Sat, 19 Aug 2006 17:56:20 +0100 Subject: [Box Backup-dev] COMMIT r782 - box/chris/general/lib/server In-Reply-To: References: <876E0C3D-87AC-434B-B84A-4A3FB3A2078E@fluffy.co.uk> Message-ID: On 19 Aug 2006, at 17:49, Chris Wilson wrote: > Hi Ben, > >> mutter mutter coding standards mutter local variables mutter mutter > > :-) What's the coding standard for a local variable? Always start > with lower case? http://boxbackup.hostworks.ca/index.php/Coding_style From boxbackup-dev at fluffy.co.uk Sat Aug 19 18:32:55 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sat, 19 Aug 2006 18:32:55 +0100 Subject: [Box Backup-dev] COMMIT r787 - box/chris/general/lib/server Message-ID: Author: chris Date: 2006-08-19 18:32:55 +0100 (Sat, 19 Aug 2006) New Revision: 787 Modified: box/chris/general/lib/server/LocalProcessStream.cpp Log: * LocalProcessStream.cpp - Fixed coding style - Fixed type issues pointed out by Charles Lecklider Modified: box/chris/general/lib/server/LocalProcessStream.cpp =================================================================== --- box/chris/general/lib/server/LocalProcessStream.cpp 2006-08-19 16:00:39 UTC (rev 786) +++ box/chris/general/lib/server/LocalProcessStream.cpp 2006-08-19 17:32:55 UTC (rev 787) @@ -114,56 +114,56 @@ secAttr.bInheritHandle = TRUE; secAttr.lpSecurityDescriptor = NULL; - HANDLE WriteInChild, ReadFromChild; - if (!CreatePipe(&ReadFromChild, &WriteInChild, &secAttr, 0)) + HANDLE writeInChild, readFromChild; + if(!CreatePipe(&readFromChild, &writeInChild, &secAttr, 0)) { ::syslog(LOG_ERR, "Failed to CreatePipe for child process: " "error %d", GetLastError()); THROW_EXCEPTION(ServerException, SocketPairFailed) } - SetHandleInformation(ReadFromChild, HANDLE_FLAG_INHERIT, 0); + SetHandleInformation(readFromChild, HANDLE_FLAG_INHERIT, 0); - PROCESS_INFORMATION ProcInfo; - STARTUPINFO StartupInfo; + PROCESS_INFORMATION procInfo; + STARTUPINFO startupInfo; - ZeroMemory(&ProcInfo, sizeof(ProcInfo)); - ZeroMemory(&StartupInfo, sizeof(StartupInfo)); - StartupInfo.cb = sizeof(StartupInfo); - StartupInfo.hStdError = WriteInChild; - StartupInfo.hStdOutput = WriteInChild; - StartupInfo.hStdInput = INVALID_HANDLE_VALUE; - StartupInfo.dwFlags |= STARTF_USESTDHANDLES; + ZeroMemory(&procInfo, sizeof(procInfo)); + ZeroMemory(&startupInfo, sizeof(startupInfo)); + startupInfo.cb = sizeof(startupInfo); + startupInfo.hStdError = writeInChild; + startupInfo.hStdOutput = writeInChild; + startupInfo.hStdInput = INVALID_HANDLE_VALUE; + startupInfo.dwFlags |= STARTF_USESTDHANDLES; - CHAR* CommandLineCopy = (CHAR*)malloc(strlen(CommandLine) + 1); - strcpy(CommandLineCopy, CommandLine); + CHAR* commandLineCopy = (CHAR*)malloc(strlen(CommandLine) + 1); + strcpy(commandLineCopy, CommandLine); - bool result = CreateProcess(NULL, - CommandLineCopy, // command line + BOOL result = CreateProcess(NULL, + commandLineCopy, // command line NULL, // process security attributes NULL, // primary thread security attributes TRUE, // handles are inherited 0, // creation flags NULL, // use parent's environment NULL, // use parent's current directory - &StartupInfo, // STARTUPINFO pointer - &ProcInfo); // receives PROCESS_INFORMATION + &startupInfo, // STARTUPINFO pointer + &procInfo); // receives PROCESS_INFORMATION - free(CommandLineCopy); + free(commandLineCopy); - if (!result) + if(!result) { ::syslog(LOG_ERR, "Failed to CreateProcess: '%s': " "error %d", CommandLine, GetLastError()); - CloseHandle(WriteInChild); - CloseHandle(ReadFromChild); + CloseHandle(writeInChild); + CloseHandle(readFromChild); THROW_EXCEPTION(ServerException, ServerForkError) } - CloseHandle(ProcInfo.hProcess); - CloseHandle(ProcInfo.hThread); - CloseHandle(WriteInChild); + CloseHandle(procInfo.hProcess); + CloseHandle(procInfo.hThread); + CloseHandle(writeInChild); - std::auto_ptr stream(new FileStream(ReadFromChild)); + std::auto_ptr stream(new FileStream(readFromChild)); return stream; #endif // ! WIN32 } From boxbackup-dev at fluffy.co.uk Sat Aug 19 22:20:06 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Sat, 19 Aug 2006 22:20:06 +0100 Subject: [Box Backup-dev] COMMIT r746 - box/chris/merge/bin/bbackupd In-Reply-To: References: <20060809175956.3532C96@s0g0.pems.testserver.co.uk> Message-ID: <1156022406.17028.23.camel@avenin.ebourne.me.uk> On Wed, 2006-08-09 at 19:11 +0100, Chris Wilson wrote: > Hi Martin, > > Please review 745:746 for merge. > > * bin/bbackupd/BackupDaemon.h > * bin/bbackupd/BackupDaemon.cpp > - Made SerializeStoreObjectInfo() return a boolean, true if it > successfully saved the store object info file, false otherwise. Is it really considered successful if the file is created but none of the contents are written? Cheers, Martin. From boxbackup-dev at fluffy.co.uk Sat Aug 19 22:26:07 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Sat, 19 Aug 2006 22:26:07 +0100 (BST) Subject: [Box Backup-dev] COMMIT r746 - box/chris/merge/bin/bbackupd In-Reply-To: <1156022406.17028.23.camel@avenin.ebourne.me.uk> References: <20060809175956.3532C96@s0g0.pems.testserver.co.uk> <1156022406.17028.23.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, On Sat, 19 Aug 2006, Martin Ebourne wrote: >> - Made SerializeStoreObjectInfo() return a boolean, true if it >> successfully saved the store object info file, false otherwise. > > Is it really considered successful if the file is created but none of > the contents are written? Sorry, I should have been clearer. A file is successfully created, which must be deleted during the next backup run. We delete it without looking at its contents, but if we create the file and fail to delete it, and then die, then a subsequent run could get confused. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Sat Aug 19 23:18:59 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Sat, 19 Aug 2006 23:18:59 +0100 Subject: [Box Backup-dev] Merges In-Reply-To: References: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> Message-ID: <1156025939.17028.50.camel@avenin.ebourne.me.uk> Except where noted, these are all good to merge: > Please review 738:739 for merge. > Please review 739:740 for merge. > Please review 740:741 for merge. > Please review 742:743 for merge. > Please review 745:746 for merge. > Please review 746:747 for merge. > Please review 747:748 for merge. > Please review 748:749 for merge. 1. --- bin/bbackupd/BackupDaemon.cpp (revision 748) +++ bin/bbackupd/BackupDaemon.cpp (revision 749) @@ -263,16 +263,36 @@ void BackupDaemon::RunHelperThread(void) { mpCommandSocketInfo = new CommandSocketInfo; - this->mReceivedCommandConn = false; Why? 2. If you've got a catch(...) and you're not propagating the error you should at least catch(std::exception&) before it and report that with .what(). This will catch a lot of exceptions (eg. out of memory) that would otherwise go reported as "unknown error". I see too much software give unknown error and it's quite hateful. This is also true of the catch at the bottom of this function too, which you haven't changed here. 3. Could you not use IsTerminateWanted() rather than break to get of the loop? > Please review 749:750 for merge. > Please review 754:755 for merge. > Please review 755:756 for merge. 1. I'm guessing Ben might have something to say about the naming of the new struct. 2. This adds new options 'T' to list and 'A' to compare, but no code to handle them. > Please review 757:758 > Please consider 766:767 for merge. 1. What if rDir to MakeFullPath is empty? If that's impossible it should be documented as a precondition. 2. Why are you changing copy construction of locals to assignment? Copy construction is better. As far as I can see from my inbox this is the full list of outstanding merges. If I've missed any please correct me. Again, sorry for the delay. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Sun Aug 20 00:34:11 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 00:34:11 +0100 Subject: [Box Backup-dev] COMMIT r788 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2006-08-20 00:34:11 +0100 (Sun, 20 Aug 2006) New Revision: 788 Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp box/trunk/bin/bbackupd/Win32ServiceFunctions.h box/trunk/bin/bbackupd/bbackupd.cpp Log: * bin/bbackupd/Win32ServiceFunctions.h * bin/bbackupd/Win32ServiceFunctions.cpp - InstallService() and OurService() take the config file name as a parameter - InstallService() returns an integer status code like RemoveService() - OurService() sets the global static config file name to pass into the main thread later * bin/bbackupd/bbackupd.cpp - Call InstallService() and OurService() with the config file name as a parameter Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-19 17:32:55 UTC (rev 787) +++ box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-19 23:34:11 UTC (rev 788) @@ -161,8 +161,10 @@ } } -void OurService(void) +void OurService(char* pConfigFileName) { + spConfigFileName = pConfigFileName; + SERVICE_TABLE_ENTRY serviceTable[] = { { SERVICE_NAME, (LPSERVICE_MAIN_FUNCTION) ServiceMain }, @@ -181,7 +183,7 @@ } } -void InstallService(void) +int InstallService(const char* pConfigFileName) { SC_HANDLE newService, scm; @@ -191,7 +193,7 @@ { syslog(LOG_ERR, "Failed to open service control manager: " "error %d", GetLastError()); - return; + return 1; } char cmd[MAX_PATH]; @@ -217,7 +219,7 @@ { ::syslog(LOG_ERR, "Failed to create Box Backup service: " "error %d", GetLastError()); - return; + return 1; } ::syslog(LOG_INFO, "Created Box Backup service"); @@ -234,6 +236,8 @@ CloseServiceHandle(newService); CloseServiceHandle(scm); + + return 0; } int RemoveService(void) Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.h =================================================================== --- box/trunk/bin/bbackupd/Win32ServiceFunctions.h 2006-08-19 17:32:55 UTC (rev 787) +++ box/trunk/bin/bbackupd/Win32ServiceFunctions.h 2006-08-19 23:34:11 UTC (rev 788) @@ -12,8 +12,8 @@ #ifndef WIN32SERVICEFUNCTIONS_H #define WIN32SERVICEFUNCTIONS_H -int RemoveService(void); -void InstallService(void); -void OurService(void); +int RemoveService (void); +int InstallService (const char* pConfigFilePath); +void OurService (char* pConfigFileName); #endif Modified: box/trunk/bin/bbackupd/bbackupd.cpp =================================================================== --- box/trunk/bin/bbackupd/bbackupd.cpp 2006-08-19 17:32:55 UTC (rev 787) +++ box/trunk/bin/bbackupd/bbackupd.cpp 2006-08-19 23:34:11 UTC (rev 788) @@ -43,14 +43,19 @@ RemoveService(); return 0; } - if(argc == 2 && ::strcmp(argv[1], "-i") == 0) + if((argc == 2 || argc == 3) && ::strcmp(argv[1], "-i") == 0) { - InstallService(); + const char* config = NULL; + if (argc == 3) + { + config = argv[2]; + } + InstallService(config); return 0; } bool runAsWin32Service = false; - if (argc == 2 && ::strcmp(argv[1], "--service") == 0) + if (argc >= 2 && ::strcmp(argv[1], "--service") == 0) { runAsWin32Service = true; } @@ -73,8 +78,22 @@ if (runAsWin32Service) { - syslog(LOG_INFO,"Starting Box Backup Service"); - OurService(); + syslog(LOG_INFO, "Box Backup service starting"); + + char* config = NULL; + if (argc >= 3) + { + config = strdup(argv[2]); + } + + OurService(config); + + if (config) + { + free(config); + } + + syslog(LOG_INFO, "Box Backup service shut down"); } else { From boxbackup-dev at fluffy.co.uk Sun Aug 20 00:35:10 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 00:35:10 +0100 Subject: [Box Backup-dev] COMMIT r789 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2006-08-20 00:35:10 +0100 (Sun, 20 Aug 2006) New Revision: 789 Modified: box/trunk/bin/bbackupd/bbackupd.cpp Log: * bbackupd.cpp - Return the status code from InstallService() and RemoveService() as exit code (0 on success, 1 on failure) Modified: box/trunk/bin/bbackupd/bbackupd.cpp =================================================================== --- box/trunk/bin/bbackupd/bbackupd.cpp 2006-08-19 23:34:11 UTC (rev 788) +++ box/trunk/bin/bbackupd/bbackupd.cpp 2006-08-19 23:35:10 UTC (rev 789) @@ -40,8 +40,7 @@ } if(argc == 2 && ::strcmp(argv[1], "-r") == 0) { - RemoveService(); - return 0; + return RemoveService(); } if((argc == 2 || argc == 3) && ::strcmp(argv[1], "-i") == 0) { @@ -50,8 +49,7 @@ { config = argv[2]; } - InstallService(config); - return 0; + return InstallService(config); } bool runAsWin32Service = false; From boxbackup-dev at fluffy.co.uk Sun Aug 20 00:37:53 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 00:37:53 +0100 Subject: [Box Backup-dev] COMMIT r790 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2006-08-20 00:37:53 +0100 (Sun, 20 Aug 2006) New Revision: 790 Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp Log: * bin/bbackupd/Win32ServiceFunctions.cpp - Improved diagnostic output if InstallService() fails - Ensure that InstallService() cleans up all resources - Check that the requested configuration file is accessible - Include the configuration file in the service parameters Modified: box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp =================================================================== --- box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-19 23:35:10 UTC (rev 789) +++ box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp 2006-08-19 23:37:53 UTC (rev 790) @@ -185,10 +185,28 @@ int InstallService(const char* pConfigFileName) { - SC_HANDLE newService, scm; + if (pConfigFileName != NULL) + { + struct stat st; - scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); + if (emu_stat(pConfigFileName, &st) != 0) + { + syslog(LOG_ERR, "Failed to open configuration file: " + "%s: %s", pConfigFileName, strerror(errno)); + return 1; + } + if (! st.st_mode & S_IFREG) + { + + syslog(LOG_ERR, "Failed to open configuration file: " + "%s: not a file", pConfigFileName); + return 1; + } + } + + SC_HANDLE scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); + if (!scm) { syslog(LOG_ERR, "Failed to open service control manager: " @@ -200,11 +218,17 @@ GetModuleFileName(NULL, cmd, sizeof(cmd)-1); cmd[sizeof(cmd)-1] = 0; - char cmd_args[MAX_PATH]; - _snprintf(cmd_args, sizeof(cmd_args)-1, "%s --service", cmd); - cmd_args[sizeof(cmd_args)-1] = 0; + std::string cmdWithArgs(cmd); + cmdWithArgs += " --service"; - newService = CreateService( + if (pConfigFileName != NULL) + { + cmdWithArgs += " \""; + cmdWithArgs += pConfigFileName; + cmdWithArgs += "\""; + } + + SC_HANDLE newService = CreateService( scm, SERVICE_NAME, "Box Backup", @@ -212,13 +236,45 @@ SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, - cmd_args, + cmdWithArgs.c_str(), 0,0,0,0,0); + DWORD err = GetLastError(); + CloseServiceHandle(scm); + if (!newService) { - ::syslog(LOG_ERR, "Failed to create Box Backup service: " - "error %d", GetLastError()); + switch (err) + { + case ERROR_SERVICE_EXISTS: + { + ::syslog(LOG_ERR, "Failed to create Box Backup " + "service: it already exists"); + } + break; + + case ERROR_SERVICE_MARKED_FOR_DELETE: + { + ::syslog(LOG_ERR, "Failed to create Box Backup " + "service: it is waiting to be deleted"); + } + break; + + case ERROR_DUPLICATE_SERVICE_NAME: + { + ::syslog(LOG_ERR, "Failed to create Box Backup " + "service: a service with this name " + "already exists"); + } + break; + + default: + { + ::syslog(LOG_ERR, "Failed to create Box Backup " + "service: error %d", err); + } + } + return 1; } @@ -235,7 +291,6 @@ } CloseServiceHandle(newService); - CloseServiceHandle(scm); return 0; } From boxbackup-dev at fluffy.co.uk Sun Aug 20 00:39:38 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 00:39:38 +0100 Subject: [Box Backup-dev] COMMIT r791 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2006-08-20 00:39:38 +0100 (Sun, 20 Aug 2006) New Revision: 791 Modified: box/trunk/bin/bbackupd/Win32BackupService.cpp Log: * bin/bbackupd/Win32BackupService.cpp - Made RunService() pass the configuration file name to Win32BackupService::WinService() - Made WinService() calculate the default configuration file name more sanely and safely - Made WinService() not return before MAINHELPER_END Modified: box/trunk/bin/bbackupd/Win32BackupService.cpp =================================================================== --- box/trunk/bin/bbackupd/Win32BackupService.cpp 2006-08-19 23:37:53 UTC (rev 790) +++ box/trunk/bin/bbackupd/Win32BackupService.cpp 2006-08-19 23:39:38 UTC (rev 791) @@ -17,8 +17,8 @@ unsigned int WINAPI RunService(LPVOID lpParameter) { - DWORD retVal = gDaemonService.WinService(); - SetEvent( gStopServiceEvent ); + DWORD retVal = gDaemonService.WinService((const char*) lpParameter); + SetEvent(gStopServiceEvent); return retVal; } @@ -27,25 +27,36 @@ gDaemonService.SetTerminateWanted(); } -DWORD Win32BackupService::WinService(void) +DWORD Win32BackupService::WinService(const char* pConfigFileName) { - int argc = 2; - //first off get the path name for the default - char buf[MAX_PATH]; + char exepath[MAX_PATH]; + GetModuleFileName(NULL, exepath, sizeof(exepath)); + + std::string configfile; - GetModuleFileName(NULL, buf, sizeof(buf)); - std::string buffer(buf); - std::string conf( "-c"); - std::string cfile(buffer.substr(0,(buffer.find("bbackupd.exe"))) - + "bbackupd.conf"); + if (pConfigFileName != NULL) + { + configfile = pConfigFileName; + } + else + { + // make the default config file name, + // based on the program path + configfile = exepath; + configfile = configfile.substr(0, + configfile.rfind(DIRECTORY_SEPARATOR_ASCHAR)); + configfile += DIRECTORY_SEPARATOR "bbackupd.conf"; + } - const char *argv[] = {conf.c_str(), cfile.c_str()}; + const char *argv[] = {exepath, "-c", configfile.c_str()}; + int argc = sizeof(argv) / sizeof(*argv); + DWORD ret; MAINHELPER_START + ret = this->Main(BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv); + MAINHELPER_END - return this->Main(BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv); - - MAINHELPER_END + return ret; } #endif // WIN32 From boxbackup-dev at fluffy.co.uk Sun Aug 20 00:41:19 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 00:41:19 +0100 Subject: [Box Backup-dev] COMMIT r792 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2006-08-20 00:41:19 +0100 (Sun, 20 Aug 2006) New Revision: 792 Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp box/trunk/bin/bbackupd/BackupDaemon.h Log: * bbackupd/BackupDaemon.h * bbackupd/BackupDaemon.cpp - Made SerializeStoreObjectInfo() return a boolean, true if it created a store object info file (which we must delete later), false otherwise. Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.cpp 2006-08-19 23:39:38 UTC (rev 791) +++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2006-08-19 23:41:19 UTC (rev 792) @@ -2173,11 +2173,11 @@ static const std::string STOREOBJECTINFO_MAGIC_ID_STRING = "BBACKUPD-STATE"; static const int STOREOBJECTINFO_VERSION = 1; -void BackupDaemon::SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const +bool BackupDaemon::SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const { if(!GetConfiguration().KeyExists("StoreObjectInfoFile")) { - return; + return false; } std::string StoreObjectInfoFile = @@ -2185,13 +2185,17 @@ if (StoreObjectInfoFile.size() <= 0) { - return; + return false; } + bool created = false; + try { FileStream aFile(StoreObjectInfoFile.c_str(), O_WRONLY | O_CREAT | O_TRUNC); + created = true; + Archive anArchive(aFile, 0); anArchive.Write(STOREOBJECTINFO_MAGIC_ID_VALUE); @@ -2236,6 +2240,8 @@ "not accessible or could not be created", StoreObjectInfoFile.c_str()); } + + return created; } // -------------------------------------------------------------------------- Modified: box/trunk/bin/bbackupd/BackupDaemon.h =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.h 2006-08-19 23:39:38 UTC (rev 791) +++ box/trunk/bin/bbackupd/BackupDaemon.h 2006-08-19 23:41:19 UTC (rev 792) @@ -46,9 +46,12 @@ ~BackupDaemon(); private: - // methods below do partial (specialized) serialization of client state only - void SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const; - bool DeserializeStoreObjectInfo(int64_t & aClientStoreMarker, box_time_t & theLastSyncTime, box_time_t & theNextSyncTime); + // methods below do partial (specialized) serialization of + // client state only + bool SerializeStoreObjectInfo(int64_t aClientStoreMarker, + box_time_t theLastSyncTime, box_time_t theNextSyncTime) const; + bool DeserializeStoreObjectInfo(int64_t & aClientStoreMarker, + box_time_t & theLastSyncTime, box_time_t & theNextSyncTime); bool DeleteStoreObjectInfo() const; BackupDaemon(const BackupDaemon &); public: From boxbackup-dev at fluffy.co.uk Sun Aug 20 00:43:58 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 00:43:58 +0100 Subject: [Box Backup-dev] COMMIT r793 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2006-08-20 00:43:58 +0100 (Sun, 20 Aug 2006) New Revision: 793 Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Use the return of SerializeStoreObjectInfo to determine whether we created a serialised file. If so, then we must delete it on the next run, otherwise we should not try to delete it. Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.cpp 2006-08-19 23:41:19 UTC (rev 792) +++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2006-08-19 23:43:58 UTC (rev 793) @@ -504,8 +504,8 @@ BackupClientContext::ClientStoreMarker_NotKnown; // haven't contacted the store yet - bool deserialised = DeserializeStoreObjectInfo(clientStoreMarker, - lastSyncTime, nextSyncTime); + bool deleteStoreObjectInfoFile = DeserializeStoreObjectInfo( + clientStoreMarker, lastSyncTime, nextSyncTime); // -------------------------------------------------------------------------------------------- @@ -611,7 +611,8 @@ // Delete the serialised store object file, // so that we don't try to reload it after a // partially completed backup - if(deserialised && !DeleteStoreObjectInfo()) + if(deleteStoreObjectInfoFile && + !DeleteStoreObjectInfo()) { ::syslog(LOG_ERR, "Failed to delete the " "StoreObjectInfoFile, backup cannot " @@ -621,6 +622,11 @@ ::sleep(60); continue; } + + // In case the backup throws an exception, + // we should not try to delete the store info + // object file again. + deleteStoreObjectInfoFile = false; // Do sync bool errorOccurred = false; @@ -729,9 +735,15 @@ // -------------------------------------------------------------------------------------------- - // We had a successful backup, save the store info - SerializeStoreObjectInfo(clientStoreMarker, lastSyncTime, nextSyncTime); + // We had a successful backup, save the store + // info. If we save successfully, we must + // delete the file next time we start a backup + deleteStoreObjectInfoFile = + SerializeStoreObjectInfo( + clientStoreMarker, + lastSyncTime, nextSyncTime); + // -------------------------------------------------------------------------------------------- } catch(BoxException &e) From boxbackup-dev at fluffy.co.uk Sun Aug 20 00:45:00 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 00:45:00 +0100 Subject: [Box Backup-dev] COMMIT r794 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2006-08-20 00:44:59 +0100 (Sun, 20 Aug 2006) New Revision: 794 Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Cosmetic spelling and formatting fixes Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.cpp 2006-08-19 23:43:58 UTC (rev 793) +++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2006-08-19 23:44:59 UTC (rev 794) @@ -965,7 +965,7 @@ { #ifdef PLATFORM_CANNOT_FIND_PEER_UID_OF_UNIX_SOCKET bool uidOK = true; - ::syslog(LOG_WARNING, "On this platform, no security check can be made on the credientials of peers connecting to the command socket. (bbackupctl)"); + ::syslog(LOG_WARNING, "On this platform, no security check can be made on the credentials of peers connecting to the command socket. (bbackupctl)"); #else // Security check -- does the process connecting to this socket have // the same UID as this process? @@ -1149,8 +1149,8 @@ // -------------------------------------------------------------------------- void BackupDaemon::SendSyncStartOrFinish(bool SendStart) { - // The bbackupctl program can't rely on a state change, because it may never - // change if the server doesn't need to be contacted. + // The bbackupctl program can't rely on a state change, because it + // may never change if the server doesn't need to be contacted. #ifdef __MINGW32__ #warning race condition: what happens if socket is closed? From boxbackup-dev at fluffy.co.uk Sun Aug 20 00:46:35 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 00:46:35 +0100 Subject: [Box Backup-dev] COMMIT r795 - in box/trunk/lib: server win32 Message-ID: Author: chris Date: 2006-08-20 00:46:35 +0100 (Sun, 20 Aug 2006) New Revision: 795 Added: box/trunk/lib/server/WinNamedPipeStream.cpp box/trunk/lib/server/WinNamedPipeStream.h Removed: box/trunk/lib/win32/WinNamedPipeStream.cpp box/trunk/lib/win32/WinNamedPipeStream.h Log: * lib/win32/WinNamedPipeStream.h * lib/win32/WinNamedPipeStream.cpp * lib/server/WinNamedPipeStream.h * lib/server/WinNamedPipeStream.cpp - Moved WinNamedPipeStream class from lib/win32 to lib/server, to resolve circular dependency between lib/common and lib/win32. Copied: box/trunk/lib/server/WinNamedPipeStream.cpp (from rev 750, box/chris/merge/lib/server/WinNamedPipeStream.cpp) =================================================================== --- box/trunk/lib/server/WinNamedPipeStream.cpp (rev 0) +++ box/trunk/lib/server/WinNamedPipeStream.cpp 2006-08-19 23:46:35 UTC (rev 795) @@ -0,0 +1,312 @@ +// -------------------------------------------------------------------------- +// +// File +// Name: WinNamedPipeStream.cpp +// Purpose: I/O stream interface for Win32 named pipes +// Created: 2005/12/07 +// +// -------------------------------------------------------------------------- + +#include "Box.h" + +#ifdef WIN32 + +#ifdef HAVE_UNISTD_H + #include +#endif + +#include +#include +#include + +#include "WinNamedPipeStream.h" +#include "ServerException.h" +#include "CommonException.h" +#include "Socket.h" + +#include "MemLeakFindOn.h" + +// -------------------------------------------------------------------------- +// +// Function +// Name: WinNamedPipeStream::WinNamedPipeStream() +// Purpose: Constructor (create stream ready for Open() call) +// Created: 2005/12/07 +// +// -------------------------------------------------------------------------- +WinNamedPipeStream::WinNamedPipeStream() + : mSocketHandle(NULL), + mReadClosed(false), + mWriteClosed(false), + mIsServer(false), + mIsConnected(false) +{ +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: WinNamedPipeStream::~WinNamedPipeStream() +// Purpose: Destructor, closes stream if open +// Created: 2005/12/07 +// +// -------------------------------------------------------------------------- +WinNamedPipeStream::~WinNamedPipeStream() +{ + if (mSocketHandle != NULL) + { + Close(); + } +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: WinNamedPipeStream::Accept(const char* Name) +// Purpose: Creates a new named pipe with the given name, +// and wait for a connection on it +// Created: 2005/12/07 +// +// -------------------------------------------------------------------------- +void WinNamedPipeStream::Accept(const wchar_t* pName) +{ + if (mSocketHandle != NULL || mIsConnected) + { + THROW_EXCEPTION(ServerException, SocketAlreadyOpen) + } + + mSocketHandle = CreateNamedPipeW( + pName, // pipe name + PIPE_ACCESS_DUPLEX, // read/write access + PIPE_TYPE_MESSAGE | // message type pipe + PIPE_READMODE_MESSAGE | // message-read mode + PIPE_WAIT, // blocking mode + 1, // max. instances + 4096, // output buffer size + 4096, // input buffer size + NMPWAIT_USE_DEFAULT_WAIT, // client time-out + NULL); // default security attribute + + if (mSocketHandle == NULL) + { + ::syslog(LOG_ERR, "CreateNamedPipeW failed: %d", + GetLastError()); + THROW_EXCEPTION(ServerException, SocketOpenError) + } + + bool connected = ConnectNamedPipe(mSocketHandle, (LPOVERLAPPED) NULL); + + if (!connected) + { + ::syslog(LOG_ERR, "ConnectNamedPipe failed: %d", + GetLastError()); + Close(); + THROW_EXCEPTION(ServerException, SocketOpenError) + } + + mReadClosed = false; + mWriteClosed = false; + mIsServer = true; // must flush and disconnect before closing + mIsConnected = true; +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: WinNamedPipeStream::Connect(const char* Name) +// Purpose: Opens a connection to a listening named pipe +// Created: 2005/12/07 +// +// -------------------------------------------------------------------------- +void WinNamedPipeStream::Connect(const wchar_t* pName) +{ + if (mSocketHandle != NULL || mIsConnected) + { + THROW_EXCEPTION(ServerException, SocketAlreadyOpen) + } + + mSocketHandle = CreateFileW( + pName, // pipe name + GENERIC_READ | // read and write access + GENERIC_WRITE, + 0, // no sharing + NULL, // default security attributes + OPEN_EXISTING, + 0, // default attributes + NULL); // no template file + + if (mSocketHandle == INVALID_HANDLE_VALUE) + { + ::syslog(LOG_ERR, "Failed to connect to server's named pipe: " + "error %d", GetLastError()); + THROW_EXCEPTION(ServerException, SocketOpenError) + } + + mReadClosed = false; + mWriteClosed = false; + mIsServer = false; // just close the socket + mIsConnected = true; +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: WinNamedPipeStream::Read(void *pBuffer, int NBytes) +// Purpose: Reads data from stream. Maybe returns less than asked for. +// Created: 2003/07/31 +// +// -------------------------------------------------------------------------- +int WinNamedPipeStream::Read(void *pBuffer, int NBytes, int Timeout) +{ + // TODO no support for timeouts yet + ASSERT(Timeout == IOStream::TimeOutInfinite) + + if (mSocketHandle == NULL || !mIsConnected) + { + THROW_EXCEPTION(ServerException, BadSocketHandle) + } + + DWORD NumBytesRead; + + bool Success = ReadFile( + mSocketHandle, // pipe handle + pBuffer, // buffer to receive reply + NBytes, // size of buffer + &NumBytesRead, // number of bytes read + NULL); // not overlapped + + if (!Success) + { + THROW_EXCEPTION(ConnectionException, Conn_SocketReadError) + } + + // Closed for reading at EOF? + if (NumBytesRead == 0) + { + mReadClosed = true; + } + + return NumBytesRead; +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: WinNamedPipeStream::Write(void *pBuffer, int NBytes) +// Purpose: Writes data, blocking until it's all done. +// Created: 2003/07/31 +// +// -------------------------------------------------------------------------- +void WinNamedPipeStream::Write(const void *pBuffer, int NBytes) +{ + if (mSocketHandle == NULL || !mIsConnected) + { + THROW_EXCEPTION(ServerException, BadSocketHandle) + } + + // Buffer in byte sized type. + ASSERT(sizeof(char) == 1); + const char *pByteBuffer = (char *)pBuffer; + + int NumBytesWrittenTotal = 0; + + while (NumBytesWrittenTotal < NBytes) + { + DWORD NumBytesWrittenThisTime = 0; + + bool Success = WriteFile( + mSocketHandle, // pipe handle + pByteBuffer + NumBytesWrittenTotal, // message + NBytes - NumBytesWrittenTotal, // message length + &NumBytesWrittenThisTime, // bytes written this time + NULL); // not overlapped + + if (!Success) + { + mWriteClosed = true; // assume can't write again + THROW_EXCEPTION(ConnectionException, + Conn_SocketWriteError) + } + + NumBytesWrittenTotal += NumBytesWrittenThisTime; + } +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: WinNamedPipeStream::Close() +// Purpose: Closes connection to remote socket +// Created: 2003/07/31 +// +// -------------------------------------------------------------------------- +void WinNamedPipeStream::Close() +{ + if (mSocketHandle == NULL && mIsConnected) + { + fprintf(stderr, "Inconsistent connected state\n"); + ::syslog(LOG_ERR, "Inconsistent connected state"); + mIsConnected = false; + } + + if (mSocketHandle == NULL) + { + THROW_EXCEPTION(ServerException, BadSocketHandle) + } + + if (mIsServer) + { + if (!FlushFileBuffers(mSocketHandle)) + { + ::syslog(LOG_INFO, "FlushFileBuffers failed: %d", + GetLastError()); + } + + if (!DisconnectNamedPipe(mSocketHandle)) + { + ::syslog(LOG_ERR, "DisconnectNamedPipe failed: %d", + GetLastError()); + } + + mIsServer = false; + } + + bool result = CloseHandle(mSocketHandle); + + mSocketHandle = NULL; + mIsConnected = false; + + if (!result) + { + ::syslog(LOG_ERR, "CloseHandle failed: %d", GetLastError()); + THROW_EXCEPTION(ServerException, SocketCloseError) + } +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: WinNamedPipeStream::StreamDataLeft() +// Purpose: Still capable of reading data? +// Created: 2003/08/02 +// +// -------------------------------------------------------------------------- +bool WinNamedPipeStream::StreamDataLeft() +{ + return !mReadClosed; +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: WinNamedPipeStream::StreamClosed() +// Purpose: Connection been closed? +// Created: 2003/08/02 +// +// -------------------------------------------------------------------------- +bool WinNamedPipeStream::StreamClosed() +{ + return mWriteClosed; +} + +#endif // WIN32 Property changes on: box/trunk/lib/server/WinNamedPipeStream.cpp ___________________________________________________________________ Name: svn:eol-style + native Copied: box/trunk/lib/server/WinNamedPipeStream.h (from rev 750, box/chris/merge/lib/server/WinNamedPipeStream.h) =================================================================== --- box/trunk/lib/server/WinNamedPipeStream.h (rev 0) +++ box/trunk/lib/server/WinNamedPipeStream.h 2006-08-19 23:46:35 UTC (rev 795) @@ -0,0 +1,60 @@ +// -------------------------------------------------------------------------- +// +// File +// Name: WinNamedPipeStream.h +// Purpose: I/O stream interface for Win32 named pipes +// Created: 2005/12/07 +// +// -------------------------------------------------------------------------- + +#if ! defined WINNAMEDPIPESTREAM__H && defined WIN32 +#define WINNAMEDPIPESTREAM__H + +#include "IOStream.h" + +// -------------------------------------------------------------------------- +// +// Class +// Name: WinNamedPipeStream +// Purpose: I/O stream interface for Win32 named pipes +// Created: 2003/07/31 +// +// -------------------------------------------------------------------------- +class WinNamedPipeStream : public IOStream +{ +public: + WinNamedPipeStream(); + ~WinNamedPipeStream(); + + // server side - create the named pipe and listen for connections + void Accept(const wchar_t* Name); + + // client side - connect to a waiting server + void Connect(const wchar_t* Name); + + // both sides + virtual int Read(void *pBuffer, int NBytes, + int Timeout = IOStream::TimeOutInfinite); + virtual void Write(const void *pBuffer, int NBytes); + virtual void Close(); + virtual bool StreamDataLeft(); + virtual bool StreamClosed(); + bool IsConnected() { return mIsConnected; } + +protected: + HANDLE GetSocketHandle(); + void MarkAsReadClosed() {mReadClosed = true;} + void MarkAsWriteClosed() {mWriteClosed = true;} + +private: + WinNamedPipeStream(const WinNamedPipeStream &rToCopy) + { /* do not call */ } + + HANDLE mSocketHandle; + bool mReadClosed; + bool mWriteClosed; + bool mIsServer; + bool mIsConnected; +}; + +#endif // WINNAMEDPIPESTREAM__H Property changes on: box/trunk/lib/server/WinNamedPipeStream.h ___________________________________________________________________ Name: svn:eol-style + native Deleted: box/trunk/lib/win32/WinNamedPipeStream.cpp =================================================================== --- box/trunk/lib/win32/WinNamedPipeStream.cpp 2006-08-19 23:44:59 UTC (rev 794) +++ box/trunk/lib/win32/WinNamedPipeStream.cpp 2006-08-19 23:46:35 UTC (rev 795) @@ -1,312 +0,0 @@ -// -------------------------------------------------------------------------- -// -// File -// Name: WinNamedPipeStream.cpp -// Purpose: I/O stream interface for Win32 named pipes -// Created: 2005/12/07 -// -// -------------------------------------------------------------------------- - -#include "Box.h" - -#ifdef WIN32 - -#ifdef HAVE_UNISTD_H - #include -#endif - -#include -#include -#include - -#include "WinNamedPipeStream.h" -#include "ServerException.h" -#include "CommonException.h" -#include "Socket.h" - -#include "MemLeakFindOn.h" - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::WinNamedPipeStream() -// Purpose: Constructor (create stream ready for Open() call) -// Created: 2005/12/07 -// -// -------------------------------------------------------------------------- -WinNamedPipeStream::WinNamedPipeStream() - : mSocketHandle(NULL), - mReadClosed(false), - mWriteClosed(false), - mIsServer(false), - mIsConnected(false) -{ -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::~WinNamedPipeStream() -// Purpose: Destructor, closes stream if open -// Created: 2005/12/07 -// -// -------------------------------------------------------------------------- -WinNamedPipeStream::~WinNamedPipeStream() -{ - if (mSocketHandle != NULL) - { - Close(); - } -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::Accept(const char* Name) -// Purpose: Creates a new named pipe with the given name, -// and wait for a connection on it -// Created: 2005/12/07 -// -// -------------------------------------------------------------------------- -void WinNamedPipeStream::Accept(const wchar_t* pName) -{ - if (mSocketHandle != NULL || mIsConnected) - { - THROW_EXCEPTION(ServerException, SocketAlreadyOpen) - } - - mSocketHandle = CreateNamedPipeW( - pName, // pipe name - PIPE_ACCESS_DUPLEX, // read/write access - PIPE_TYPE_MESSAGE | // message type pipe - PIPE_READMODE_MESSAGE | // message-read mode - PIPE_WAIT, // blocking mode - 1, // max. instances - 4096, // output buffer size - 4096, // input buffer size - NMPWAIT_USE_DEFAULT_WAIT, // client time-out - NULL); // default security attribute - - if (mSocketHandle == NULL) - { - ::syslog(LOG_ERR, "CreateNamedPipeW failed: %d", - GetLastError()); - THROW_EXCEPTION(ServerException, SocketOpenError) - } - - bool connected = ConnectNamedPipe(mSocketHandle, (LPOVERLAPPED) NULL); - - if (!connected) - { - ::syslog(LOG_ERR, "ConnectNamedPipe failed: %d", - GetLastError()); - Close(); - THROW_EXCEPTION(ServerException, SocketOpenError) - } - - mReadClosed = false; - mWriteClosed = false; - mIsServer = true; // must flush and disconnect before closing - mIsConnected = true; -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::Connect(const char* Name) -// Purpose: Opens a connection to a listening named pipe -// Created: 2005/12/07 -// -// -------------------------------------------------------------------------- -void WinNamedPipeStream::Connect(const wchar_t* pName) -{ - if (mSocketHandle != NULL || mIsConnected) - { - THROW_EXCEPTION(ServerException, SocketAlreadyOpen) - } - - mSocketHandle = CreateFileW( - pName, // pipe name - GENERIC_READ | // read and write access - GENERIC_WRITE, - 0, // no sharing - NULL, // default security attributes - OPEN_EXISTING, - 0, // default attributes - NULL); // no template file - - if (mSocketHandle == INVALID_HANDLE_VALUE) - { - ::syslog(LOG_ERR, "Failed to connect to server's named pipe: " - "error %d", GetLastError()); - THROW_EXCEPTION(ServerException, SocketOpenError) - } - - mReadClosed = false; - mWriteClosed = false; - mIsServer = false; // just close the socket - mIsConnected = true; -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::Read(void *pBuffer, int NBytes) -// Purpose: Reads data from stream. Maybe returns less than asked for. -// Created: 2003/07/31 -// -// -------------------------------------------------------------------------- -int WinNamedPipeStream::Read(void *pBuffer, int NBytes, int Timeout) -{ - // TODO no support for timeouts yet - ASSERT(Timeout == IOStream::TimeOutInfinite) - - if (mSocketHandle == NULL || !mIsConnected) - { - THROW_EXCEPTION(ServerException, BadSocketHandle) - } - - DWORD NumBytesRead; - - bool Success = ReadFile( - mSocketHandle, // pipe handle - pBuffer, // buffer to receive reply - NBytes, // size of buffer - &NumBytesRead, // number of bytes read - NULL); // not overlapped - - if (!Success) - { - THROW_EXCEPTION(ConnectionException, Conn_SocketReadError) - } - - // Closed for reading at EOF? - if (NumBytesRead == 0) - { - mReadClosed = true; - } - - return NumBytesRead; -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::Write(void *pBuffer, int NBytes) -// Purpose: Writes data, blocking until it's all done. -// Created: 2003/07/31 -// -// -------------------------------------------------------------------------- -void WinNamedPipeStream::Write(const void *pBuffer, int NBytes) -{ - if (mSocketHandle == NULL || !mIsConnected) - { - THROW_EXCEPTION(ServerException, BadSocketHandle) - } - - // Buffer in byte sized type. - ASSERT(sizeof(char) == 1); - const char *pByteBuffer = (char *)pBuffer; - - int NumBytesWrittenTotal = 0; - - while (NumBytesWrittenTotal < NBytes) - { - DWORD NumBytesWrittenThisTime = 0; - - bool Success = WriteFile( - mSocketHandle, // pipe handle - pByteBuffer + NumBytesWrittenTotal, // message - NBytes - NumBytesWrittenTotal, // message length - &NumBytesWrittenThisTime, // bytes written this time - NULL); // not overlapped - - if (!Success) - { - mWriteClosed = true; // assume can't write again - THROW_EXCEPTION(ConnectionException, - Conn_SocketWriteError) - } - - NumBytesWrittenTotal += NumBytesWrittenThisTime; - } -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::Close() -// Purpose: Closes connection to remote socket -// Created: 2003/07/31 -// -// -------------------------------------------------------------------------- -void WinNamedPipeStream::Close() -{ - if (mSocketHandle == NULL && mIsConnected) - { - fprintf(stderr, "Inconsistent connected state\n"); - ::syslog(LOG_ERR, "Inconsistent connected state"); - mIsConnected = false; - } - - if (mSocketHandle == NULL) - { - THROW_EXCEPTION(ServerException, BadSocketHandle) - } - - if (mIsServer) - { - if (!FlushFileBuffers(mSocketHandle)) - { - ::syslog(LOG_INFO, "FlushFileBuffers failed: %d", - GetLastError()); - } - - if (!DisconnectNamedPipe(mSocketHandle)) - { - ::syslog(LOG_ERR, "DisconnectNamedPipe failed: %d", - GetLastError()); - } - - mIsServer = false; - } - - bool result = CloseHandle(mSocketHandle); - - mSocketHandle = NULL; - mIsConnected = false; - - if (!result) - { - ::syslog(LOG_ERR, "CloseHandle failed: %d", GetLastError()); - THROW_EXCEPTION(ServerException, SocketCloseError) - } -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::StreamDataLeft() -// Purpose: Still capable of reading data? -// Created: 2003/08/02 -// -// -------------------------------------------------------------------------- -bool WinNamedPipeStream::StreamDataLeft() -{ - return !mReadClosed; -} - -// -------------------------------------------------------------------------- -// -// Function -// Name: WinNamedPipeStream::StreamClosed() -// Purpose: Connection been closed? -// Created: 2003/08/02 -// -// -------------------------------------------------------------------------- -bool WinNamedPipeStream::StreamClosed() -{ - return mWriteClosed; -} - -#endif // WIN32 Deleted: box/trunk/lib/win32/WinNamedPipeStream.h =================================================================== --- box/trunk/lib/win32/WinNamedPipeStream.h 2006-08-19 23:44:59 UTC (rev 794) +++ box/trunk/lib/win32/WinNamedPipeStream.h 2006-08-19 23:46:35 UTC (rev 795) @@ -1,60 +0,0 @@ -// -------------------------------------------------------------------------- -// -// File -// Name: WinNamedPipeStream.h -// Purpose: I/O stream interface for Win32 named pipes -// Created: 2005/12/07 -// -// -------------------------------------------------------------------------- - -#if ! defined WINNAMEDPIPESTREAM__H && defined WIN32 -#define WINNAMEDPIPESTREAM__H - -#include "IOStream.h" - -// -------------------------------------------------------------------------- -// -// Class -// Name: WinNamedPipeStream -// Purpose: I/O stream interface for Win32 named pipes -// Created: 2003/07/31 -// -// -------------------------------------------------------------------------- -class WinNamedPipeStream : public IOStream -{ -public: - WinNamedPipeStream(); - ~WinNamedPipeStream(); - - // server side - create the named pipe and listen for connections - void Accept(const wchar_t* Name); - - // client side - connect to a waiting server - void Connect(const wchar_t* Name); - - // both sides - virtual int Read(void *pBuffer, int NBytes, - int Timeout = IOStream::TimeOutInfinite); - virtual void Write(const void *pBuffer, int NBytes); - virtual void Close(); - virtual bool StreamDataLeft(); - virtual bool StreamClosed(); - bool IsConnected() { return mIsConnected; } - -protected: - HANDLE GetSocketHandle(); - void MarkAsReadClosed() {mReadClosed = true;} - void MarkAsWriteClosed() {mWriteClosed = true;} - -private: - WinNamedPipeStream(const WinNamedPipeStream &rToCopy) - { /* do not call */ } - - HANDLE mSocketHandle; - bool mReadClosed; - bool mWriteClosed; - bool mIsServer; - bool mIsConnected; -}; - -#endif // WINNAMEDPIPESTREAM__H From boxbackup-dev at fluffy.co.uk Sun Aug 20 00:47:46 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 00:47:46 +0100 Subject: [Box Backup-dev] COMMIT r796 - box/trunk/bin/bbackupquery Message-ID: Author: chris Date: 2006-08-20 00:47:45 +0100 (Sun, 20 Aug 2006) New Revision: 796 Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp Log: * bin/bbackupquery/BackupQueries.cpp - Don't call geteuid() on Windows, since it lies to us anyway Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/trunk/bin/bbackupquery/BackupQueries.cpp 2006-08-19 23:46:35 UTC (rev 795) +++ box/trunk/bin/bbackupquery/BackupQueries.cpp 2006-08-19 23:47:45 UTC (rev 796) @@ -70,7 +70,11 @@ mWarnedAboutOwnerAttributes(false), mReturnCode(0) // default return code { + #ifdef WIN32 + mRunningAsRoot = TRUE; + #else mRunningAsRoot = (::geteuid() == 0); + #endif } // -------------------------------------------------------------------------- From boxbackup-dev at fluffy.co.uk Sun Aug 20 00:51:23 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 00:51:23 +0100 Subject: [Box Backup-dev] COMMIT r797 - box/trunk Message-ID: Author: chris Date: 2006-08-20 00:51:23 +0100 (Sun, 20 Aug 2006) New Revision: 797 Modified: box/trunk/win32.bat Log: * win32.bat - Run the "pl.in" versions of the Perl scripts, since we can't autogenerate the real ones without autoconf Modified: box/trunk/win32.bat =================================================================== --- box/trunk/win32.bat 2006-08-19 23:47:45 UTC (rev 796) +++ box/trunk/win32.bat 2006-08-19 23:51:23 UTC (rev 797) @@ -3,26 +3,27 @@ echo quick and dirty to get up and running by generating the required files echo using Cygwin and Perl -cd .\bin\bbackupquery\ & perl ./../../bin/bbackupquery/makedocumentation.pl +cd .\bin\bbackupquery\ & perl ./../../bin/bbackupquery/makedocumentation.pl.in cd ..\..\ -cd .\lib\backupclient & perl ./../../lib/common/makeexception.pl BackupStoreException.txt -perl ./../../lib/server/makeprotocol.pl Client ./../../bin/bbstored/backupprotocol.txt +cd .\lib\backupclient & perl ./../../lib/common/makeexception.pl.in BackupStoreException.txt & perl ./../../lib/server/makeprotocol.pl.in Client ./../../bin/bbstored/backupprotocol.txt cd ..\..\ -cd .\lib\compress & perl ./../../lib/common/makeexception.pl CompressException.txt +cd .\lib\compress & perl ./../../lib/common/makeexception.pl.in CompressException.txt cd ..\..\ -cd .\lib\common & perl ./../../lib/common/makeexception.pl CommonException.txt & perl ./../../lib/common/makeexception.pl ConversionException.txt +cd .\lib\common & perl ./../../lib/common/makeexception.pl.in CommonException.txt & perl ./../../lib/common/makeexception.pl.in ConversionException.txt cd ..\..\ -cd .\lib\crypto & perl ./../../lib/common/makeexception.pl CipherException.txt +cd .\lib\crypto & perl ./../../lib/common/makeexception.pl.in CipherException.txt cd ..\..\ echo server parts - which appears as though some of the clients rely on -cd .\lib\server & perl ./../../lib/common/makeexception.pl ServerException.txt & perl ./../../lib/common/makeexception.pl ConnectionException.txt +cd .\lib\server & perl ./../../lib/common/makeexception.pl.in ServerException.txt & perl ./../../lib/common/makeexception.pl.in ConnectionException.txt cd ..\..\ copy lib\win32\config.h.win32 lib\common\BoxConfig.h + +perl -pe 's/@PERL@/perl/' ./test/bbackupd/testfiles/bbackupd.conf.in > .\test\bbackupd\testfiles\bbackupd.conf From boxbackup-dev at fluffy.co.uk Sun Aug 20 01:29:23 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 01:29:23 +0100 Subject: [Box Backup-dev] COMMIT r798 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2006-08-20 01:29:23 +0100 (Sun, 20 Aug 2006) New Revision: 798 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Restored initialisation of this->mReceivedCommandConn to false in handler thread. - Changed handling of all catch(...) blocks, which don't have an obvious outer exception handler, to catch std::exception first and report it with e.what(), as suggested by Martin. - Fixed some catch blocks to match coding standards. Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-19 23:51:23 UTC (rev 797) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-20 00:29:23 UTC (rev 798) @@ -262,6 +262,7 @@ #ifdef WIN32 void BackupDaemon::RunHelperThread(void) { + this->mReceivedCommandConn = false; mpCommandSocketInfo = new CommandSocketInfo; WinNamedPipeStream& rSocket(mpCommandSocketInfo->mListeningSocket); @@ -273,16 +274,23 @@ { rSocket.Accept(BOX_NAMED_PIPE_NAME); } - catch (BoxException &e) + catch(BoxException &e) { ::syslog(LOG_ERR, "Failed to open command socket: %s", e.what()); SetTerminateWanted(); break; // this is fatal to listening thread } - catch (...) + catch(std::exception &e) { ::syslog(LOG_ERR, "Failed to open command socket: " + "%s", e.what()); + SetTerminateWanted(); + break; // this is fatal to listening thread + } + catch(...) + { + ::syslog(LOG_ERR, "Failed to open command socket: " "unknown error"); SetTerminateWanted(); break; // this is fatal to listening thread @@ -384,13 +392,18 @@ rSocket.Close(); } - catch (BoxException &e) + catch(BoxException &e) { ::syslog(LOG_ERR, "Communication error with " "control client: %s", e.what()); } - catch (...) + catch(std::exception &e) { + ::syslog(LOG_ERR, "Internal error in command socket " + "thread: %s", e.what()); + } + catch(...) + { ::syslog(LOG_ERR, "Communication error with control client"); } } @@ -450,6 +463,12 @@ { delete mpCommandSocketInfo; } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error while " + "closing command socket after " + "another exception: %s", e.what()); + } catch(...) { ::syslog(LOG_WARNING, @@ -780,6 +799,12 @@ errorCode = e.GetType(); errorSubCode = e.GetSubType(); } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error during " + "backup run: %s", e.what()); + errorOccurred = true; + } catch(...) { // TODO: better handling of exceptions here... need to be very careful @@ -911,6 +936,17 @@ int status = 0; ::waitpid(pid, &status, 0); } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error running SyncAllowScript: " + "%s", e.what()); + // Clean up + if(pid != 0) + { + int status = 0; + ::waitpid(pid, &status, 0); + } + } catch(...) { // Ignore any exceptions @@ -1117,13 +1153,19 @@ CloseCommandConnection(); } } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error in command socket thread: " + "%s", e.what()); + throw; // thread will die + } catch(...) { // If an error occurs, and there is a connection active, just close that // connection and continue. Otherwise, let the error propagate. if(mpCommandSocketInfo->mpConnectedSocket.get() == 0) { - throw; + throw; // thread will die } else { @@ -1157,6 +1199,11 @@ } mpCommandSocketInfo->mpConnectedSocket.reset(); } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error while closing command " + "socket: %s", e.what()); + } catch(...) { // Ignore any errors @@ -1202,6 +1249,12 @@ strlen(message)); #endif } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error while sending to " + "command socket client: %s", e.what()); + CloseCommandConnection(); + } catch(...) { CloseCommandConnection(); @@ -1311,7 +1364,7 @@ } catch(...) { - ::endmntent(mountPointsFile); + ::endmntent(mountPointsFile); throw; } #else // ! HAVE_STRUCT_MNTENT_MNT_DIR @@ -1811,6 +1864,12 @@ { mpCommandSocketInfo->mListeningSocket.Write(newState, newStateSize); } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error while writing state " + "to command socket: %s", e.what()); + CloseCommandConnection(); + } catch(...) { CloseCommandConnection(); @@ -1824,6 +1883,12 @@ { mpCommandSocketInfo->mpConnectedSocket->Write(newState, newStateSize); } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error while writing state " + "to command socket: %s", e.what()); + CloseCommandConnection(); + } catch(...) { CloseCommandConnection(); @@ -2273,7 +2338,7 @@ ::syslog(LOG_INFO, "Saved store object info file '%s'", StoreObjectInfoFile.c_str()); } - catch (...) + catch(...) { ::syslog(LOG_WARNING, "Requested store object info file '%s' " "not accessible or could not be created", @@ -2428,22 +2493,29 @@ iVersion); return true; + } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error reading store object " + "info file: %s", e.what()); } - catch (...) + catch(...) { - DeleteAllLocations(); + ::syslog(LOG_ERR, "Internal error reading store object " + "info file: unknown error"); + } - aClientStoreMarker = - BackupClientContext::ClientStoreMarker_NotKnown; - theLastSyncTime = 0; - theNextSyncTime = 0; + DeleteAllLocations(); - ::syslog(LOG_WARNING, "Requested store object info file '%s' " - "does not exist, not accessible, or inconsistent. " - "Will re-cache from store.", - StoreObjectInfoFile.c_str()); - } + aClientStoreMarker = BackupClientContext::ClientStoreMarker_NotKnown; + theLastSyncTime = 0; + theNextSyncTime = 0; + ::syslog(LOG_WARNING, "Requested store object info file '%s' " + "does not exist, not accessible, or inconsistent. " + "Will re-cache from store.", + StoreObjectInfoFile.c_str()); + return false; } From boxbackup-dev at fluffy.co.uk Sun Aug 20 01:36:14 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 01:36:14 +0100 Subject: [Box Backup-dev] COMMIT r799 - box/chris/merge/bin/bbackupquery Message-ID: Author: chris Date: 2006-08-20 01:36:13 +0100 (Sun, 20 Aug 2006) New Revision: 799 Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp Log: * bin/bbackupquery/BackupQueries.cpp - Removed options without code to handle them Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/chris/merge/bin/bbackupquery/BackupQueries.cpp 2006-08-20 00:29:23 UTC (rev 798) +++ box/chris/merge/bin/bbackupquery/BackupQueries.cpp 2006-08-20 00:36:13 UTC (rev 799) @@ -176,14 +176,14 @@ { { "quit", "" }, { "exit", "" }, - { "list", "rodIFtTsh", }, + { "list", "rodIFtsh", }, { "pwd", "" }, { "cd", "od" }, { "lcd", "" }, { "sh", "" }, { "getobject", "" }, { "get", "i" }, - { "compare", "alcqAE" }, + { "compare", "alcqE" }, { "restore", "dri" }, { "help", "" }, { "usage", "" }, From boxbackup-dev at fluffy.co.uk Sun Aug 20 01:47:06 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 01:47:06 +0100 Subject: [Box Backup-dev] COMMIT r800 - box/chris/general/bin/bbackupd Message-ID: Author: chris Date: 2006-08-20 01:47:06 +0100 (Sun, 20 Aug 2006) New Revision: 800 Modified: box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: * bin/bbackupd/BackupClientDirectoryRecord.cpp - Fixed MakeFullPath() to handle zero-length directory name - Changed assignments back to copy constructors - Fixed accidental white space changes to reduce diff Modified: box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-20 00:36:13 UTC (rev 799) +++ box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-20 00:47:06 UTC (rev 800) @@ -107,7 +107,8 @@ { std::string result; - if (rDir[rDir.size()-1] == DIRECTORY_SEPARATOR_ASCHAR) + if (rDir.size() > 0 && + rDir[rDir.size()-1] == DIRECTORY_SEPARATOR_ASCHAR) { result = rDir + rFile; } @@ -289,10 +290,10 @@ #endif continue; } - + // Here if the object is something to back up (file, symlink or dir, not excluded) // So make the information for adding to the checksum - + #ifdef WIN32 if(::lstat(filename.c_str(), &st) != 0) { @@ -306,7 +307,6 @@ } #endif - checksum_info.mModificationTime = FileModificationTime(st); checksum_info.mAttributeModificationTime = FileAttrModificationTime(st); checksum_info.mSize = st.st_size; @@ -562,7 +562,7 @@ f != rFiles.end(); ++f) { // Filename of this file - std::string filename = MakeFullPath(rLocalPath, *f); + std::string filename(MakeFullPath(rLocalPath, *f)); // Get relevant info about file box_time_t modTime = 0; @@ -909,7 +909,7 @@ d != rDirs.end(); ++d) { // Get the local filename - std::string dirname = MakeFullPath(rLocalPath, *d); + std::string dirname(MakeFullPath(rLocalPath, *d)); // See if it's in the listing (if we have one) BackupStoreFilenameClear storeFilename(*d); From boxbackup-dev at fluffy.co.uk Sun Aug 20 01:47:56 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Sun, 20 Aug 2006 01:47:56 +0100 (BST) Subject: [Box Backup-dev] Merges In-Reply-To: <1156025939.17028.50.camel@avenin.ebourne.me.uk> References: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> <1156025939.17028.50.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, > Except where noted, these are all good to merge: Thanks! I think I've merged all the ones you said were OK. > --- bin/bbackupd/BackupDaemon.cpp (revision 748) > +++ bin/bbackupd/BackupDaemon.cpp (revision 749) > @@ -263,16 +263,36 @@ > void BackupDaemon::RunHelperThread(void) > { > mpCommandSocketInfo = new CommandSocketInfo; > - this->mReceivedCommandConn = false; > > Why? Sorry, looks like a mistake. > 2. If you've got a catch(...) and you're not propagating the error you > should at least catch(std::exception&) before it and report that with > .what(). This will catch a lot of exceptions (eg. out of memory) > that would otherwise go reported as "unknown error". I see too much > software give unknown error and it's quite hateful. This is also true > of the catch at the bottom of this function too, which you haven't > changed here. Ok, I'm no expert on exceptions or C++, and I've never seen a std::exception in the wild, but I found quite a few other places in BackupDaemon that looked like they could use the same treatment, so I fixed them all. > 3. Could you not use IsTerminateWanted() rather than break to get of the > loop? It's not the same. IsTerminateWanted() is a signal that the whole of bbackupd needs to die ASAP, whereas if something goes badly wrong with the handler thread, we can just let it die and bbackupd keeps running. I think that's better. I don't like using break, but the alternative seemed to be to set a flag and call continue, which looks worse to me. At least "break;" with a good comment has an intuitive meaning, whereas using "continue" to kill the thread is counter-intuitive, isn't it? Please review for merge: svn diff -r 748:798 \ http://bbdev.fluffy.co.uk/svn/box/chris/merge/bin/bbackupd/BackupDaemon.cpp > 1. I'm guessing Ben might have something to say about the naming of the > new struct. > > 2. This adds new options 'T' to list and 'A' to compare, but no code to > handle them. Well spotted, thanks! Fixed in r799. I'll wait for Ben to tell me what he wants the struct to be called before asking you to review again. >> Please consider 766:767 for merge. > > 1. What if rDir to MakeFullPath is empty? If that's impossible it should > be documented as a precondition. > > 2. Why are you changing copy construction of locals to assignment? Copy > construction is better. Fixed both. Please review for merge: svn diff -r 766:800 \ http://bbdev.fluffy.co.uk/svn/box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp By the way, why is copy construction better? More efficient? > As far as I can see from my inbox this is the full list of outstanding > merges. If I've missed any please correct me. Again, sorry for the > delay. Thanks again! OK if I send you some more patches for review this weekend? Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Sun Aug 20 09:26:26 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Sun, 20 Aug 2006 09:26:26 +0100 Subject: [Box Backup-dev] Merges In-Reply-To: References: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> <1156025939.17028.50.camel@avenin.ebourne.me.uk> Message-ID: On 20 Aug 2006, at 01:47, Chris Wilson wrote: > >> 1. I'm guessing Ben might have something to say about the naming >> of the >> new struct. >> >> 2. This adds new options 'T' to list and 'A' to compare, but no >> code to >> handle them. > > Well spotted, thanks! Fixed in r799. I'll wait for Ben to tell me > what he wants the struct to be called before asking you to review > again. Well cmd_info_t is not exactly in the project coding style. QueryCommandSpecification might fit in better and describe what it is more accurately. I hope everyone else thinks coding standards are important. I read a essay recently which suggested that the compilers should enforce coding standards. I think that's a good plan. It's not that any coding standard is correct or better or The One True Way, it's just that it's important for everyone on a project to use the same one. > >>> Please consider 766:767 for merge. >> >> 1. What if rDir to MakeFullPath is empty? If that's impossible it >> should >> be documented as a precondition. >> >> 2. Why are you changing copy construction of locals to assignment? >> Copy >> construction is better. > > Fixed both. Please review for merge: > > svn diff -r 766:800 \ > http://bbdev.fluffy.co.uk/svn/box/chris/general/bin/bbackupd/ > BackupClientDirectoryRecord.cpp > > By the way, why is copy construction better? More efficient? Less function calls. std::string pants(FunctionReturningString()); works by copying the result of the function into the local variable using the copy constructor. std::string pants = FunctionReturningString(); works by copying the result of the function into a 'hidden' local variable, constructing the local variable, assigning the hidden variable to the local variable, then deleting the hidden variable. It cannot be optimised to the first case, because the compiler must call operator= on the local variable to avoid funny things happening if you define your operators in odd ways. (Trivial example: imagine you have a member variable which records how the object was constructed.) At least I think that's it. C++ is unnecessarily complex. I find it an effective language to work in, but it has taken me quite a while to learn it. But what else is low level enough to be able to write system code, high level enough to be able to abstract concepts and do OO stuff, and portable enough to compile and run anywhere? Ben From boxbackup-dev at fluffy.co.uk Sun Aug 20 10:18:11 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Sun, 20 Aug 2006 10:18:11 +0100 Subject: [Box Backup-dev] Merges In-Reply-To: References: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> <1156025939.17028.50.camel@avenin.ebourne.me.uk> Message-ID: <1156065492.17028.63.camel@avenin.ebourne.me.uk> On Sun, 2006-08-20 at 01:47 +0100, Chris Wilson wrote: > Ok, I'm no expert on exceptions or C++, and I've never seen a > std::exception in the wild, std::exception is the interface that all C++ standardised exceptions implement. Both the run time code and the libraries are capable of throwing objects implementing std::exception. Here's a good breakdown of the class hierarchy as provided by the ISO C++ 99 standard: http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1exception.html Some of those can happen virtually anywhere - eg. bad_alloc is used for out of memory and can be thrown any time new is called, which makes it pretty likely. If you're using catch to report an error in C++ you should always catch std::exception and report that otherwise you're missing a whole load of exception types. A lot of recent apps also implement std::exception for their own exception types. Only time to use catch(...) and not catch(std::exception) as well is if you're doing silent cleanup and then rethrowing. > but I found quite a few other places in > BackupDaemon that looked like they could use the same treatment, so I > fixed them all. Excellent, good thinking. > I don't like using break, but the alternative seemed to be to set a flag > and call continue, which looks worse to me. At least "break;" with a good > comment has an intuitive meaning, whereas using "continue" to kill the > thread is counter-intuitive, isn't it? Ok, that's fine then. > Please review for merge: > > svn diff -r 748:798 \ > http://bbdev.fluffy.co.uk/svn/box/chris/merge/bin/bbackupd/BackupDaemon.cpp Can you go through this and check all your added catch blocks. At least one of them the catch(std::exception) doesn't do the same as the catch(...). > Fixed both. Please review for merge: > > svn diff -r 766:800 \ > http://bbdev.fluffy.co.uk/svn/box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp Yep, that's ok now. > By the way, why is copy construction better? More efficient? Ben answered that in detail. > > As far as I can see from my inbox this is the full list of outstanding > > merges. If I've missed any please correct me. Again, sorry for the > > delay. > > Thanks again! OK if I send you some more patches for review this weekend? Sure, just keep sending them as and when. I'll review them when I can grab some time. Can't guarantee it'll be this weekend though. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Sun Aug 20 10:52:37 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 10:52:37 +0100 Subject: [Box Backup-dev] COMMIT r801 - box/chris/general/bin/bbackupquery Message-ID: Author: chris Date: 2006-08-20 10:52:37 +0100 (Sun, 20 Aug 2006) New Revision: 801 Modified: box/chris/general/bin/bbackupquery/BackupQueries.cpp Log: * bin/bbackupquery/BackupQueries.cpp - Renamed cmd_info_t to QueryCommandSpecification as requested by Ben Modified: box/chris/general/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/chris/general/bin/bbackupquery/BackupQueries.cpp 2006-08-20 00:47:06 UTC (rev 800) +++ box/chris/general/bin/bbackupquery/BackupQueries.cpp 2006-08-20 09:52:37 UTC (rev 801) @@ -93,11 +93,11 @@ { } -typedef struct cmd_info +typedef struct { const char* name; const char* opts; -} cmd_info_t; +} QueryCommandSpecification; // -------------------------------------------------------------------------- // @@ -176,7 +176,7 @@ } // Data about commands - static cmd_info_t commands[] = + static QueryCommandSpecification commands[] = { { "quit", "" }, { "exit", "" }, From boxbackup-dev at fluffy.co.uk Sun Aug 20 10:56:28 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 10:56:28 +0100 Subject: [Box Backup-dev] COMMIT r802 - box/chris/merge/bin/bbackupquery Message-ID: Author: chris Date: 2006-08-20 10:56:28 +0100 (Sun, 20 Aug 2006) New Revision: 802 Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp Log: * bin/bbackupquery/BackupQueries.cpp - Renamed cmd_info_t to QueryCommandSpecification as requested by Ben Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/chris/merge/bin/bbackupquery/BackupQueries.cpp 2006-08-20 09:52:37 UTC (rev 801) +++ box/chris/merge/bin/bbackupquery/BackupQueries.cpp 2006-08-20 09:56:28 UTC (rev 802) @@ -89,11 +89,11 @@ { } -typedef struct cmd_info +typedef struct { const char* name; const char* opts; -} cmd_info_t; +} QueryCommandSpecification; // -------------------------------------------------------------------------- // @@ -172,7 +172,7 @@ } // Data about commands - static cmd_info_t commands[] = + static QueryCommandSpecification commands[] = { { "quit", "" }, { "exit", "" }, From boxbackup-dev at fluffy.co.uk Sun Aug 20 11:06:55 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 11:06:55 +0100 Subject: [Box Backup-dev] COMMIT r803 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2006-08-20 11:06:55 +0100 (Sun, 20 Aug 2006) New Revision: 803 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Cleaned up SyncAllowScript cleanup code - Fixed catching std::exception while handling command socket to do the same as catching (...) Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-20 09:56:28 UTC (rev 802) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-20 10:06:55 UTC (rev 803) @@ -932,34 +932,26 @@ } } - // Wait and then cleanup child process - int status = 0; - ::waitpid(pid, &status, 0); } catch(std::exception &e) { ::syslog(LOG_ERR, "Internal error running SyncAllowScript: " "%s", e.what()); - // Clean up - if(pid != 0) - { - int status = 0; - ::waitpid(pid, &status, 0); - } } catch(...) { // Ignore any exceptions // Log that something bad happened ::syslog(LOG_ERR, "Error running SyncAllowScript '%s'", conf.GetKeyValue("SyncAllowScript").c_str()); - // Clean up though - if(pid != 0) - { - int status = 0; - ::waitpid(pid, &status, 0); - } } + // Wait and then cleanup child process, if any + if (pid != 0) + { + int status = 0; + ::waitpid(pid, &status, 0); + } + return waitInSeconds; } @@ -1157,7 +1149,17 @@ { ::syslog(LOG_ERR, "Internal error in command socket thread: " "%s", e.what()); - throw; // thread will die + // If an error occurs, and there is a connection active, just close that + // connection and continue. Otherwise, let the error propagate. + if(mpCommandSocketInfo->mpConnectedSocket.get() == 0) + { + throw; // thread will die + } + else + { + // Close socket and ignore error + CloseCommandConnection(); + } } catch(...) { From boxbackup-dev at fluffy.co.uk Sun Aug 20 11:16:47 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 11:16:47 +0100 Subject: [Box Backup-dev] COMMIT r804 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2006-08-20 11:16:47 +0100 (Sun, 20 Aug 2006) New Revision: 804 Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: * bin/bbackupd/BackupClientDirectoryRecord.cpp - Fixed exclusion of files, and display of path names, when backing up the root directory of a drive, or the UNIX root. Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-20 10:06:55 UTC (rev 803) +++ box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-20 10:16:47 UTC (rev 804) @@ -97,6 +97,33 @@ // -------------------------------------------------------------------------- // // Function +// Name: MakeFullPath(const std::string& rDir, const std::string& rFile) +// Purpose: Combine directory and file name +// Created: 2006/08/10 +// +// -------------------------------------------------------------------------- +static std::string MakeFullPath(const std::string& rDir, + const std::string& rFile) +{ + std::string result; + + if (rDir.size() > 0 && + rDir[rDir.size()-1] == DIRECTORY_SEPARATOR_ASCHAR) + { + result = rDir + rFile; + } + else + { + result = rDir + DIRECTORY_SEPARATOR + rFile; + } + + return result; +} + + +// -------------------------------------------------------------------------- +// +// Function // Name: BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::SyncParams &, int64_t, const std::string &, bool) // Purpose: Syncronise, recusively, a local directory with the server. // Created: 2003/10/08 @@ -207,8 +234,7 @@ } // Stat file to get info - filename = rLocalPath + DIRECTORY_SEPARATOR + - en->d_name; + filename = MakeFullPath(rLocalPath, en->d_name); if(::lstat(filename.c_str(), &st) != 0) { @@ -512,7 +538,7 @@ f != rFiles.end(); ++f) { // Filename of this file - std::string filename(rLocalPath + DIRECTORY_SEPARATOR + *f); + std::string filename(MakeFullPath(rLocalPath, *f)); // Get relevant info about file box_time_t modTime = 0; @@ -818,7 +844,7 @@ d != rDirs.end(); ++d) { // Get the local filename - std::string dirname(rLocalPath + DIRECTORY_SEPARATOR + *d); + std::string dirname(MakeFullPath(rLocalPath, *d)); // See if it's in the listing (if we have one) BackupStoreFilenameClear storeFilename(*d); @@ -1022,7 +1048,13 @@ BackupClientDirectoryRecord *rec = e->second; mSubDirectories.erase(e); delete rec; - TRACE2("Deleted directory record for %s/%s\n", rLocalPath.c_str(), dirname.GetClearFilename().c_str()); + + std::string name = MakeFullPath( + rLocalPath, + dirname.GetClearFilename()); + + TRACE1("Deleted directory record for " + "%s\n", name.c_str()); } } } From boxbackup-dev at fluffy.co.uk Sun Aug 20 11:13:56 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Sun, 20 Aug 2006 11:13:56 +0100 (BST) Subject: [Box Backup-dev] Merges In-Reply-To: <1156065492.17028.63.camel@avenin.ebourne.me.uk> References: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> <1156025939.17028.50.camel@avenin.ebourne.me.uk> <1156065492.17028.63.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, > Can you go through this and check all your added catch blocks. At least > one of them the catch(std::exception) doesn't do the same as the > catch(...). OK, fixed, I think. Please review for merge: svn diff -r 748:803 \ http://bbdev.fluffy.co.uk/svn/box/chris/merge/bin/bbackupd/BackupDaemon.cpp >> Fixed both. Please review for merge: >> >> svn diff -r 766:800 \ >> http://bbdev.fluffy.co.uk/svn/box/chris/general/bin/bbackupd/BackupClientDirectoryRecord.cpp > > Yep, that's ok now. I just noticed that another patch got mixed in there: the one that uses en->d_type rather than ::lstat to identify excluded files/dirs on Win32. I don't think it's ready to merge yet, so I removed it (it requires changes to emu.cpp as well to make it work, and it's not much tested) and merged the rest. >> Thanks again! OK if I send you some more patches for review this weekend? > > Sure, just keep sending them as and when. I'll review them when I can > grab some time. Can't guarantee it'll be this weekend though. Thanks, please review for merge: svn diff -r 755:802 http://bbdev.fluffy.co.uk/svn/box/chris/merge/bin/bbackupquery/BackupQueries.cpp Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Sun Aug 20 11:16:27 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Sun, 20 Aug 2006 11:16:27 +0100 (BST) Subject: [Box Backup-dev] Merges In-Reply-To: References: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> <1156025939.17028.50.camel@avenin.ebourne.me.uk> Message-ID: Hi Ben, On Sun, 20 Aug 2006, Ben Summers wrote: >> Well spotted, thanks! Fixed in r799. I'll wait for Ben to tell me what he >> wants the struct to be called before asking you to review again. > > Well cmd_info_t is not exactly in the project coding style. > QueryCommandSpecification might fit in better and describe what it is more > accurately. OK, fixed. > I hope everyone else thinks coding standards are important. Yes, I do, although I disagree about certain standards in certain projects I will follow them anyway to avoid causing trouble for others :-) I hope you will forgive me, and correct me, if I occasionally let something slip through. > I read a essay recently which suggested that the compilers should > enforce coding standards. I think that's a good plan. It's not that any > coding standard is correct or better or The One True Way, it's just that > it's important for everyone on a project to use the same one. I think it would be a good idea, but it would have to be optional, or else nothing would compile any more :-) Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Sun Aug 20 15:43:39 2006 From: boxbackup-dev at fluffy.co.uk (E.W. Peter Jalajas) Date: Sun, 20 Aug 2006 07:43:39 -0700 (PDT) Subject: [Box Backup-dev] Merges In-Reply-To: Message-ID: <20060820144339.76041.qmail@web60619.mail.yahoo.com> One tiny development-side thing that I could contribute to the project, until the compiler --enforce-coding-stds option is created, that I've always wanted to do and had a minor passion about, is to write scripts that scan the entire source code tree for various issues, including common security holes (for example, buffer overflows; un-validated input strings), coding standards, copyright/license strings, string capitalization, etc. At first, this script could be run manually periodically locally on my computer and I'll report the issues found to the -dev list, but then if it proves worthy, it could maybe be added to the check-in validation process at some level between simple reporting and heavy-handed enforcement. At first it would have to be optional, lest nothing would get checked in any more :-). At first, it could just report issues; maybe later it could maybe correct simple issues (for example, replace tabs with spaces, or replace copyright 2001 with Copyright $CurrentYear). I tend to write things like this for my own use in shell (bash, and less frequently now ksh), but I wouldn't have a problem coding it in perl if preferred. Any interest in such a beast? Is there such a thing out there already? Pete --- Chris Wilson wrote: > Hi Ben, > > On Sun, 20 Aug 2006, Ben Summers wrote: > > > I hope everyone else thinks coding standards are important. > > I read a essay recently which suggested that the compilers should > > enforce coding standards. > I think it would be a good idea, but it would have to be optional, or > else > nothing would compile any more :-) From boxbackup-dev at fluffy.co.uk Sun Aug 20 23:38:10 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Sun, 20 Aug 2006 23:38:10 +0100 Subject: [Box Backup-dev] Merges In-Reply-To: References: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> <1156025939.17028.50.camel@avenin.ebourne.me.uk> <1156065492.17028.63.camel@avenin.ebourne.me.uk> Message-ID: <1156113491.18437.12.camel@avenin.ebourne.me.uk> On Sun, 2006-08-20 at 11:13 +0100, Chris Wilson wrote: > OK, fixed, I think. Please review for merge: > > svn diff -r 748:803 \ > http://bbdev.fluffy.co.uk/svn/box/chris/merge/bin/bbackupd/BackupDaemon.cpp catch(std::exception &e) { ::syslog(LOG_ERR, "Internal error while " "closing command socket after " "another exception: %s", e.what()); } catch(...) { ::syslog(LOG_WARNING, "Error closing command socket " "after exception, ignored."); } Why is one an error and one a warning? Having been and looked at the code I can see that BoxException already implements std::exception. At least the first try/catch in RunHelperThread could therefore have the catch(BoxException) block removed since the catch(std::exception) block will cover it and do exactly the same thing. Probably also the one at the end of the same method (though keep the message from the BoxException case to use for std::exception). At line 804 it seems a shame that the standard exceptions can't be reported like the box ones. Maybe if we reserved a type/subtype value for std::exceptions we could use the same mechanism? I wonder if you intentionally skipped the one at line 2343? There were some waitpid changes in this diff that weren't in the previous one. Were they accidental? eg. - // Clean up though - if(pid != 0) - { - int status = 0; - ::waitpid(pid, &status, 0); - } > Thanks, please review for merge: > > svn diff -r 755:802 > http://bbdev.fluffy.co.uk/svn/box/chris/merge/bin/bbackupquery/BackupQueries.cpp Yes, that's fine. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Sun Aug 20 23:46:34 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 23:46:34 +0100 Subject: [Box Backup-dev] COMMIT r805 - box/chris Message-ID: Author: chris Date: 2006-08-20 23:46:33 +0100 (Sun, 20 Aug 2006) New Revision: 805 Added: box/chris/acl/ Log: * http://bbdev.fluffy.co.uk/svn/box/chris/acl - Created a branch for working on ACL support in Box Backup for Windows (work in progress) Copied: box/chris/acl (from rev 804, box/chris/general) From boxbackup-dev at fluffy.co.uk Sun Aug 20 23:52:09 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 20 Aug 2006 23:52:09 +0100 Subject: [Box Backup-dev] COMMIT r806 - in box/chris/acl: bin/bbackupd bin/bbackupquery infrastructure/msvc/2005 lib/backupclient lib/common lib/win32 test/win32 Message-ID: Author: chris Date: 2006-08-20 23:52:09 +0100 (Sun, 20 Aug 2006) New Revision: 806 Added: box/chris/acl/lib/common/DiscardStream.cpp box/chris/acl/lib/common/DiscardStream.h Modified: box/chris/acl/bin/bbackupd/BackupClientDirectoryRecord.cpp box/chris/acl/bin/bbackupd/BackupDaemon.cpp box/chris/acl/bin/bbackupquery/BackupQueries.cpp box/chris/acl/bin/bbackupquery/documentation.txt box/chris/acl/infrastructure/msvc/2005/common.vcproj box/chris/acl/lib/backupclient/BackupClientFileAttributes.cpp box/chris/acl/lib/backupclient/BackupClientFileAttributes.h box/chris/acl/lib/backupclient/BackupClientRestore.cpp box/chris/acl/lib/backupclient/BackupStoreException.txt box/chris/acl/lib/win32/emu.cpp box/chris/acl/lib/win32/emu.h box/chris/acl/test/win32/testlibwin32.cpp Log: * test/win32/testlibwin32.cpp * infrastructure/msvc/2005/common.vcproj * lib/win32/emu.cpp * lib/win32/emu.h * lib/backupclient/BackupStoreException.txt * lib/backupclient/BackupClientRestore.cpp * lib/backupclient/BackupClientFileAttributes.cpp * lib/backupclient/BackupClientFileAttributes.h * lib/common/DiscardStream.h * lib/common/DiscardStream.cpp * bin/bbackupd/BackupClientDirectoryRecord.cpp * bin/bbackupd/BackupDaemon.cpp * bin/bbackupquery/BackupQueries.cpp * bin/bbackupquery/documentation.txt - Checking in work in progress Modified: box/chris/acl/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/chris/acl/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-20 22:46:33 UTC (rev 805) +++ box/chris/acl/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-20 22:52:09 UTC (rev 806) @@ -156,6 +156,12 @@ // Build the current state checksum to compare against while getting info from dirs // Note checksum is used locally only, so byte order isn't considered. MD5Digest currentStateChecksum; + + bool logChanges = false; + if (rLocalPath == "C:\\Cygwin\\Home\\Administrator\\pcre-6.3") + { + logChanges = true; + } // Stat the directory, to get attribute info { @@ -186,6 +192,14 @@ StreamableMemBlock xattr; BackupClientFileAttributes::FillExtendedAttr(xattr, rLocalPath.c_str()); currentStateChecksum.Add(xattr.GetBuffer(), xattr.GetSize()); + + if (logChanges) + { + ::syslog(LOG_INFO, "%s: mode %.3o, uid %d, gid %d, " + "ino %d, xattr %d\n", rLocalPath.c_str(), + st.st_mode, st.st_uid, st.st_gid, st.st_ino, + xattr.GetSize()); + } } // Read directory entries, building arrays of names @@ -236,6 +250,11 @@ // Stat file to get info filename = MakeFullPath(rLocalPath, en->d_name); + if (logChanges && strcmp(en->d_name, ".libs") == 0) + { + printf("foo"); + } + #ifdef WIN32 int type = en->d_type; #else @@ -312,6 +331,15 @@ checksum_info.mSize = st.st_size; currentStateChecksum.Add(&checksum_info, sizeof(checksum_info)); currentStateChecksum.Add(en->d_name, strlen(en->d_name)); + if (logChanges && strcmp(en->d_name, ".libs") == 0) + { + ::syslog(LOG_INFO, "%s: mod %lld, " + "attr %lld, size %lld\n", + filename.c_str(), + (long long)checksum_info.mModificationTime, + (long long)checksum_info.mAttributeModificationTime, + (long long)checksum_info.mSize); + } // If the file has been modified madly into the future, download the // directory record anyway to ensure that it doesn't get uploaded @@ -353,6 +381,12 @@ // The checksum is the same, and there was one to compare with checksumDifferent = false; } + else + { + std::string digest(currentStateChecksum.DigestAsString()); + ::syslog(LOG_INFO, "Checksum changed on %s: %s\n", + rLocalPath.c_str(), digest.c_str()); + } // Pointer to potentially downloaded store directory info BackupStoreDirectory *pdirOnStore = 0; Modified: box/chris/acl/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/acl/bin/bbackupd/BackupDaemon.cpp 2006-08-20 22:46:33 UTC (rev 805) +++ box/chris/acl/bin/bbackupd/BackupDaemon.cpp 2006-08-20 22:52:09 UTC (rev 806) @@ -75,6 +75,7 @@ #include "IOStreamGetLine.h" #include "Conversion.h" #include "Archive.h" +#include "BoxTimeToText.h" #include "MemLeakFindOn.h" @@ -852,6 +853,12 @@ SerializeStoreObjectInfo( clientStoreMarker, lastSyncTime, nextSyncTime); + std::string last(BoxTimeToISO8601String( + lastSyncTime, true)); + std::string next(BoxTimeToISO8601String( + nextSyncTime, true)); + printf("Last sync was at %s, next will be %s\n", + last.c_str(), next.c_str()); // -------------------------------------------------------------------------------------------- } Modified: box/chris/acl/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/chris/acl/bin/bbackupquery/BackupQueries.cpp 2006-08-20 22:46:33 UTC (rev 805) +++ box/chris/acl/bin/bbackupquery/BackupQueries.cpp 2006-08-20 22:52:09 UTC (rev 806) @@ -7,6 +7,11 @@ // // -------------------------------------------------------------------------- +#ifdef WIN32 +// we need features from Windows 2000 and above for ACL support +#define WINVER 0x0500 +#endif + #include "Box.h" #ifdef HAVE_UNISTD_H @@ -28,6 +33,12 @@ #include #include +#ifdef WIN32 +#include +#include +#include +#endif + #include "BackupQueries.h" #include "Utils.h" #include "Configuration.h" @@ -46,6 +57,9 @@ #include "BackupStoreException.h" #include "ExcludeList.h" #include "BackupClientMakeExcludeList.h" +#include "DiscardStream.h" +#include "Archive.h" +#include "CollectInBufferStream.h" #include "MemLeakFindOn.h" @@ -180,7 +194,7 @@ { { "quit", "" }, { "exit", "" }, - { "list", "rodIFtTsh", }, + { "list", "rodIFtTshw", }, { "pwd", "" }, { "cd", "od" }, { "lcd", "" }, @@ -355,6 +369,7 @@ #define LIST_OPTION_TIMES_UTC 'T' #define LIST_OPTION_SIZEINBLOCKS 's' #define LIST_OPTION_DISPLAY_HASH 'h' + #define LIST_OPTION_WINDOWS_ATTR 'w' // default to using the current directory int64_t rootDir = GetCurrentDirectoryID(); @@ -391,6 +406,264 @@ } +#ifdef WIN32 +bool PrintSid(Archive& rArchive) +{ + int nametype; + rArchive.Read(nametype); + + std::string sid; + rArchive.Read(sid); + + std::string domain; + rArchive.Read(domain); + + std::string name; + rArchive.Read(name); + + printf("%s\\%s (%s)", domain.c_str(), name.c_str(), sid.c_str()); + return true; +} + +void PrintWindowsAttributes(const StreamableMemBlock& rBlock) +{ + attr_StreamFormat_Generic* attr = + (attr_StreamFormat_Generic*) + rBlock.GetBuffer(); + + if (attr->AttributeType != htonl(ATTRIBUTETYPE_GENERIC_WINDOWS)) + { + return; + } + + attr_StreamFormat_Windows* wattr = + (attr_StreamFormat_Windows*) + rBlock.GetBuffer(); + + DWORD attribs = wattr->Attributes; + printf("\tFile attributes: "); + + #define PRINT_ATTR(x) \ + if (attribs & FILE_ATTRIBUTE_ ## x) \ + { \ + printf(#x " "); \ + attribs &= ~FILE_ATTRIBUTE_ ## x; \ + } + + PRINT_ATTR(ARCHIVE); + PRINT_ATTR(COMPRESSED); + PRINT_ATTR(DIRECTORY); + PRINT_ATTR(ENCRYPTED); + PRINT_ATTR(HIDDEN); + PRINT_ATTR(OFFLINE); + PRINT_ATTR(READONLY); + PRINT_ATTR(REPARSE_POINT); + PRINT_ATTR(SPARSE_FILE); + PRINT_ATTR(SYSTEM); + PRINT_ATTR(TEMPORARY); + + #undef PRINT_ATTR + + attribs &= ~FILE_ATTRIBUTE_NORMAL; + + if (wattr->Attributes) + { + if (attribs) + { + printf("Other (%08x)", + (unsigned int)attribs); + } + } + else + { + printf("None"); + } + + printf("\n"); + + CollectInBufferStream buffer; + buffer.Write(wattr + 1, + rBlock.GetSize() - sizeof(attr_StreamFormat_Windows)); + buffer.SetForReading(); + + Archive archive(buffer, 0); + int data; + + #define ERR_MSG "\tWindows attributes error: " + + archive.Read(data); + if (data != ACL_FORMAT_MAGIC) + { + printf(ERR_MSG "wrong magic\n"); + return; + } + + archive.Read(data); + if (data != ACL_FORMAT_VERSION) + { + printf(ERR_MSG "wrong version\n"); + return; + } + + EXPLICIT_ACCESS* pEntries = NULL; + + try + { + printf("\tOwner: "); + if (!PrintSid(archive)) + { + printf(ERR_MSG "failed to read owner\n"); + throw 1; + } + + printf("\n\tGroup: "); + if (!PrintSid(archive)) + { + printf(ERR_MSG "failed to read group\n"); + throw 1; + } + printf("\n"); + + int numEntries; + archive.Read(numEntries); + + pEntries = (EXPLICIT_ACCESS*)calloc(numEntries, + sizeof(EXPLICIT_ACCESS)); + + if (!pEntries) + { + printf(ERR_MSG "failed to allocate enough memory\n"); + throw 1; + } + + for (int i = 0; i < numEntries; i++) + { + PEXPLICIT_ACCESS pEntry = &(pEntries[i]); + + archive.Read(data); pEntry->grfAccessPermissions = + data; + archive.Read(data); pEntry->grfAccessMode = + (ACCESS_MODE)data; + archive.Read(data); pEntry->Trustee.TrusteeForm = + (TRUSTEE_FORM)data; + archive.Read(data); pEntry->Trustee.TrusteeType = + (TRUSTEE_TYPE)data; + + if (pEntry->Trustee.TrusteeForm != TRUSTEE_IS_SID) + { + printf(ERR_MSG "trustee is not a SID\n"); + throw 1; + } + + printf("\t"); + if (!PrintSid(archive)) + { + printf(ERR_MSG "failed to read trustee SID\n"); + throw 1; + } + + printf(" ("); + switch(pEntry->Trustee.TrusteeType) + { + case TRUSTEE_IS_UNKNOWN: + printf("unknown type"); break; + case TRUSTEE_IS_USER: + printf("user"); break; + case TRUSTEE_IS_GROUP: + printf("group"); break; + case TRUSTEE_IS_DOMAIN: + printf("domain"); break; + case TRUSTEE_IS_ALIAS: + printf("alias"); break; + case TRUSTEE_IS_WELL_KNOWN_GROUP: + printf("well-known group"); break; + case TRUSTEE_IS_DELETED: + printf("deleted account"); break; + case TRUSTEE_IS_INVALID: + printf("invalid trustee type"); break; + case TRUSTEE_IS_COMPUTER: + printf("computer\n"); break; + default: + printf("unknown type %d\n", + pEntry->Trustee.TrusteeType); + } + + printf("): "); + + switch(pEntry->grfAccessMode) + { + case NOT_USED_ACCESS: + printf("NOT_USED_ACCESS "); break; + case GRANT_ACCESS: + printf("Grant "); break; + case DENY_ACCESS: + printf("Deny "); break; + case REVOKE_ACCESS: + printf("Revoke "); break; + case SET_AUDIT_SUCCESS: + printf("Audit Success "); break; + case SET_AUDIT_FAILURE: + printf("Audit Failure "); break; + default: + printf("Unknown (%08x)\n", + pEntry->grfAccessMode); + } + + data = pEntry->grfAccessPermissions; + + #define PRINT_PERM(name) \ + if (data & name == name) \ + { \ + printf(#name " "); \ + data &= ~name; \ + } + + PRINT_PERM(FILE_ADD_FILE); + PRINT_PERM(FILE_ADD_SUBDIRECTORY); + PRINT_PERM(FILE_ALL_ACCESS); + PRINT_PERM(FILE_APPEND_DATA); + PRINT_PERM(FILE_CREATE_PIPE_INSTANCE); + PRINT_PERM(FILE_DELETE_CHILD); + PRINT_PERM(FILE_EXECUTE); + PRINT_PERM(FILE_LIST_DIRECTORY); + PRINT_PERM(FILE_READ_ATTRIBUTES); + PRINT_PERM(FILE_READ_DATA); + PRINT_PERM(FILE_READ_EA); + PRINT_PERM(FILE_TRAVERSE); + PRINT_PERM(FILE_WRITE_ATTRIBUTES); + PRINT_PERM(FILE_WRITE_DATA); + PRINT_PERM(FILE_WRITE_EA); + PRINT_PERM(STANDARD_RIGHTS_READ); + PRINT_PERM(STANDARD_RIGHTS_WRITE); + PRINT_PERM(SYNCHRONIZE); + PRINT_PERM(DELETE); + PRINT_PERM(READ_CONTROL); + PRINT_PERM(WRITE_DAC); + PRINT_PERM(WRITE_OWNER); + PRINT_PERM(MAXIMUM_ALLOWED); + PRINT_PERM(GENERIC_ALL); + PRINT_PERM(GENERIC_EXECUTE); + PRINT_PERM(GENERIC_WRITE); + PRINT_PERM(GENERIC_READ); + + if (data) + { + printf(" and others (%08x)", data); + } + + printf("\n"); + } + + free(pEntries); + } + catch(...) + { + if (pEntries) free(pEntries); + } +} +#endif + + // -------------------------------------------------------------------------- // // Function @@ -534,6 +807,75 @@ } printf("\n"); + + BackupClientFileAttributes storeAttr; + +#ifdef WIN32 + if (opts[LIST_OPTION_WINDOWS_ATTR]) + { + if (en->HasAttributes()) + { + const StreamableMemBlock &storeAttrEnc( + en->GetAttributes()); + storeAttr = BackupClientFileAttributes(storeAttrEnc); + } + else if (en->GetFlags() & + BackupStoreDirectory::Entry::Flags_Dir) + { + // TODO: find a way to read the attributes of a directory + // without reading and discarding its contents :-( + + mrConnection.QueryListDirectory( + en->GetObjectID(), + BackupProtocolClientListDirectory::Flags_INCLUDE_EVERYTHING, + // both files and directories + excludeFlags, + true /* want attributes */); + + // Retrieve the directory from the stream following + BackupStoreDirectory dummy; + std::auto_ptr dummydirstream( + mrConnection.ReceiveStream()); + dummy.ReadFromStream(*dummydirstream, + mrConnection.GetTimeout()); + + const StreamableMemBlock &storeAttrEnc( + dummy.GetAttributes()); + storeAttr = BackupClientFileAttributes( + storeAttrEnc); + } + else + { + // TODO: find a way to read the attributes of a file + // without reading and discarding its contents :-( + + mrConnection.QueryGetFile(DirID, en->GetObjectID()); + + // Stream containing encoded file + std::auto_ptr objectStream( + mrConnection.ReceiveStream()); + + DiscardStream out; + + // Get the decoding stream + std::auto_ptr stream( + BackupStoreFile::DecodeFileStream( + *objectStream, mrConnection.GetTimeout(), NULL)); + + // Is it a symlink? + if(!stream->IsSymLink()) + { + // Copy it out to the file + stream->CopyStreamTo(out); + } + + storeAttr = stream->GetAttributes(); + } + + StreamableMemBlock attrBlock(storeAttr.GetAttributes()); + PrintWindowsAttributes(attrBlock); + } +#endif // WIN32 // Directory? if((en->GetFlags() & BackupStoreDirectory::Entry::Flags_Dir) != 0) Modified: box/chris/acl/bin/bbackupquery/documentation.txt =================================================================== --- box/chris/acl/bin/bbackupquery/documentation.txt 2006-08-20 22:46:33 UTC (rev 805) +++ box/chris/acl/bin/bbackupquery/documentation.txt 2006-08-20 22:52:09 UTC (rev 806) @@ -39,9 +39,10 @@ -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) + (and attr mod time if has the object has attributes, ~ separated) -s -- show file size in blocks used on server - (only very approximate indication of size locally) + (only very approximate indication of size locally) + -w -- show Windows attributes and access control list ls can be used as an alias. < Modified: box/chris/acl/infrastructure/msvc/2005/common.vcproj =================================================================== --- box/chris/acl/infrastructure/msvc/2005/common.vcproj 2006-08-20 22:46:33 UTC (rev 805) +++ box/chris/acl/infrastructure/msvc/2005/common.vcproj 2006-08-20 22:52:09 UTC (rev 806) @@ -220,6 +220,14 @@ > + + + + Modified: box/chris/acl/lib/backupclient/BackupClientFileAttributes.cpp =================================================================== --- box/chris/acl/lib/backupclient/BackupClientFileAttributes.cpp 2006-08-20 22:46:33 UTC (rev 805) +++ box/chris/acl/lib/backupclient/BackupClientFileAttributes.cpp 2006-08-20 22:52:09 UTC (rev 806) @@ -7,6 +7,12 @@ // // -------------------------------------------------------------------------- +#ifdef WIN32 +// we need features from Windows 2000 and above for ACL support +#define WINVER 0x0500 +#define _WIN32_WINNT 0x0500 +#endif + #include "Box.h" #ifdef HAVE_UNISTD_H @@ -25,6 +31,13 @@ #include #endif +#ifdef WIN32 +#include +#include +#include +#include +#endif + #include "BackupClientFileAttributes.h" #include "CommonException.h" #include "FileModificationTime.h" @@ -33,56 +46,13 @@ #include "CipherContext.h" #include "CipherBlowfish.h" #include "MD5Digest.h" +#include "CollectInBufferStream.h" +#include "Archive.h" #include "MemLeakFindOn.h" -// set packing to one byte -#ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS -#include "BeginStructPackForWire.h" -#else -BEGIN_STRUCTURE_PACKING_FOR_WIRE -#endif - -#define ATTRIBUTETYPE_GENERIC_UNIX 1 - #define ATTRIBUTE_ENCODING_BLOWFISH 2 -typedef struct -{ - int32_t AttributeType; - u_int32_t UID; - u_int32_t GID; - u_int64_t ModificationTime; - u_int64_t AttrModificationTime; - u_int32_t UserDefinedFlags; - u_int32_t FileGenerationNumber; - u_int16_t Mode; - // Symbolic link filename may follow - // Extended attribute (xattr) information may follow, format is: - // u_int32_t Size of extended attribute block (excluding this word) - // For each of NumberOfAttributes (sorted by AttributeName): - // u_int16_t AttributeNameLength - // char AttributeName[AttributeNameLength] - // u_int32_t AttributeValueLength - // unsigned char AttributeValue[AttributeValueLength] - // AttributeName is 0 terminated, AttributeValue is not (and may be binary data) -} attr_StreamFormat; - -// This has wire packing so it's compatible across platforms -// Use wider than necessary sizes, just to be careful. -typedef struct -{ - int32_t uid, gid, mode; -} attributeHashData; - -// Use default packing -#ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS -#include "EndStructPackForWire.h" -#else -END_STRUCTURE_PACKING_FOR_WIRE -#endif - - #define MAX_ATTRIBUTE_HASH_SECRET_LENGTH 256 // Hide private static variables from the rest of the world @@ -234,45 +204,106 @@ // Then check the elements of the two things // 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(); + attr_StreamFormat_Generic *a1 = (attr_StreamFormat_Generic*) + mpClearAttributes->GetBuffer(); + attr_StreamFormat_Generic *a2 = (attr_StreamFormat_Generic*) + rAttr.mpClearAttributes->GetBuffer(); - if(a1->AttributeType != a2->AttributeType - || a1->UID != a2->UID - || a1->GID != a2->GID - || a1->UserDefinedFlags != a2->UserDefinedFlags - || a1->Mode != a2->Mode) + if(a1->AttributeType != a2->AttributeType) { return false; } - - if(!IgnoreModTime) + + if (ntohl(a1->AttributeType) == ATTRIBUTETYPE_GENERIC_UNIX) { - if(a1->ModificationTime != a2->ModificationTime) + attr_StreamFormat_Unix* ua1 = (attr_StreamFormat_Unix*)a1; + attr_StreamFormat_Unix* ua2 = (attr_StreamFormat_Unix*)a2; + if (ua1->UID != ua2->UID + || ua1->GID != ua2->GID + || ua1->UserDefinedFlags != ua2->UserDefinedFlags + || ua1->Mode != ua2->Mode) { return false; } - } + + if(!IgnoreModTime) + { + if(ua1->ModificationTime != ua2->ModificationTime) + { + return false; + } + } - if(!IgnoreAttrModTime) - { - if(a1->AttrModificationTime != a2->AttrModificationTime) + if(!IgnoreAttrModTime) { + if(ua1->AttrModificationTime != ua2->AttrModificationTime) + { + return false; + } + } + + // Check symlink string? + unsigned int size = mpClearAttributes->GetSize(); + if(size == sizeof(attr_StreamFormat_Unix)) + { + return true; + } + + // Check whether symlink strings and xattrs match + if(::memcmp(ua1 + 1, ua2 + 1, + size - sizeof(attr_StreamFormat_Unix)) != 0) + { return false; } + + return true; } - - // Check symlink string? - unsigned int size = mpClearAttributes->GetSize(); - if(size > sizeof(attr_StreamFormat)) + else if (ntohl(a1->AttributeType) == ATTRIBUTETYPE_GENERIC_WINDOWS) { - // Symlink strings don't match. This also compares xattrs - if(::memcmp(a1 + 1, a2 + 1, size - sizeof(attr_StreamFormat)) != 0) + attr_StreamFormat_Windows* wa1 = (attr_StreamFormat_Windows*)a1; + attr_StreamFormat_Windows* wa2 = (attr_StreamFormat_Windows*)a2; + + if(wa1->Attributes != wa2->Attributes) { return false; } + + if(wa1->CreationTime != wa2->CreationTime) + { + return false; + } + + if(!IgnoreModTime) + { + if(wa1->LastWriteTime != wa2->LastWriteTime) + { + return false; + } + } + + unsigned int size = mpClearAttributes->GetSize(); + if(size == sizeof(attr_StreamFormat_Windows)) + { + return true; + } + + // The rest of the record is the Windows ACL data, + // which we can compare byte-for-byte for now. + + if(::memcmp(wa1 + 1, wa2 + 1, + size - sizeof(attr_StreamFormat_Windows)) != 0) + { + return false; + } + + return true; } - + else + { + // unknown attribute type + return false; + } + // Passes all test, must be OK return true; } @@ -292,7 +323,7 @@ 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; + StreamableMemBlock *pAttrBlock = 0; try { struct stat st; @@ -308,72 +339,40 @@ if(pInodeNumber) {*pInodeNumber = st.st_ino;} if(pHasMultipleLinks) {*pHasMultipleLinks = (st.st_nlink > 1);} - pnewAttr = new StreamableMemBlock; + pAttrBlock = new StreamableMemBlock; - FillAttributes(*pnewAttr, Filename, st, ZeroModificationTimes); +#ifdef WIN32 + FillAttributesWindows(*pAttrBlock, Filename, st, + ZeroModificationTimes); +#else // !WIN32 + FillAttributes(*pAttrBlock, Filename, st, + ZeroModificationTimes); -#ifndef WIN32 // Is it a link? if((st.st_mode & S_IFMT) == S_IFLNK) { - FillAttributesLink(*pnewAttr, Filename, st); + FillAttributesLink(*pAttrBlock, Filename, st); } -#endif - FillExtendedAttr(*pnewAttr, Filename); + FillExtendedAttr(*pAttrBlock, Filename); +#endif // WIN32 -#ifdef WIN32 - //this is to catch those problems with invalid time stamps stored... - //need to find out the reason why - but also a catch as well. - - attr_StreamFormat *pattr = - (attr_StreamFormat*)pnewAttr->GetBuffer(); - ASSERT(pattr != 0); - - // __time64_t winTime = BoxTimeToSeconds( - // pnewAttr->ModificationTime); - - u_int64_t modTime = box_ntoh64(pattr->ModificationTime); - box_time_t modSecs = BoxTimeToSeconds(modTime); - __time64_t winTime = modSecs; - - // _MAX__TIME64_T doesn't seem to be defined, but the code below - // will throw an assertion failure if we exceed it :-) - // Microsoft says dates up to the year 3000 are valid, which - // is a bit more than 15 * 2^32. Even that doesn't seem - // to be true (still aborts), but it can at least hold 2^32. - if (winTime >= 0x100000000LL || _gmtime64(&winTime) == 0) - { - ::syslog(LOG_ERR, "Invalid Modification Time " - "caught for file: %s", Filename); - pattr->ModificationTime = 0; - } - - modTime = box_ntoh64(pattr->AttrModificationTime); - modSecs = BoxTimeToSeconds(modTime); - winTime = modSecs; - - if (winTime > 0x100000000LL || _gmtime64(&winTime) == 0) - { - ::syslog(LOG_ERR, "Invalid Attribute Modification " - "Time caught for file: %s", Filename); - pattr->AttrModificationTime = 0; - } -#endif - // Attributes ready. Encrypt into this block - EncryptAttr(*pnewAttr); + EncryptAttr(*pAttrBlock); // Store the new attributes RemoveClear(); - mpClearAttributes = pnewAttr; - pnewAttr = 0; + mpClearAttributes = pAttrBlock; + pAttrBlock = 0; } catch(...) { // clean up - delete pnewAttr; - pnewAttr = 0; + if (pAttrBlock) + { + delete pAttrBlock; + pAttrBlock = 0; + } throw; } } @@ -388,8 +387,9 @@ // -------------------------------------------------------------------------- void BackupClientFileAttributes::FillAttributes(StreamableMemBlock &outputBlock, const char *Filename, struct stat &st, bool ZeroModificationTimes) { - outputBlock.ResizeBlock(sizeof(attr_StreamFormat)); - attr_StreamFormat *pattr = (attr_StreamFormat*)outputBlock.GetBuffer(); + outputBlock.ResizeBlock(sizeof(attr_StreamFormat_Unix)); + attr_StreamFormat_Unix *pattr = (attr_StreamFormat_Unix*) + outputBlock.GetBuffer(); ASSERT(pattr != 0); // Fill in the entries @@ -416,6 +416,242 @@ pattr->FileGenerationNumber = htonl(st.st_gen); #endif } + + +#ifdef WIN32 +void WriteSid(Archive& rArchiver, PSID pSID) +{ + CHAR* pSidString; + if (!ConvertSidToStringSid(pSID, &pSidString)) + { + ::syslog(LOG_WARNING, "Failed to convert Security Identifier " + "to a string: error %d", GetLastError()); + THROW_EXCEPTION(BackupStoreException, LookupAccountFailed) + } + + std::string sid(pSidString); + LocalFree((HLOCAL)pSidString); + + char namebuf[1024]; + char domainbuf[1024]; + SID_NAME_USE nametype; + DWORD namelen = sizeof(namebuf); + DWORD domainlen = sizeof(domainbuf); + + if(!LookupAccountSid(NULL, pSID, namebuf, &namelen, + domainbuf, &domainlen, &nametype)) + { + ::syslog(LOG_WARNING, "Failed to find account details for " + "'%s': error %d", sid.c_str(), GetLastError()); + THROW_EXCEPTION(BackupStoreException, LookupAccountFailed) + } + + std::string domain(domainbuf); + std::string name(namebuf); + + rArchiver.Write((int)nametype); + rArchiver.Write(sid); + rArchiver.Write(domain); + rArchiver.Write(name); +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: BackupClientFileAttributes::FillAttributesWindows() +// Purpose: Private function, handles Windows attributes (ACL) +// Created: 2006/02/27 +// +// -------------------------------------------------------------------------- +void BackupClientFileAttributes::FillAttributesWindows +( + StreamableMemBlock &rOutputBlock, const char *pFilename, + struct stat &rStat, bool ZeroLastWriteTime +) +{ + rOutputBlock.ResizeBlock(sizeof(attr_StreamFormat_Windows)); + attr_StreamFormat_Windows *pAttr = (attr_StreamFormat_Windows*) + rOutputBlock.GetBuffer(); + ASSERT(pAttr != 0); + + // Fill in the entries + pAttr->AttributeType = htonl(ATTRIBUTETYPE_GENERIC_WINDOWS); + pAttr->CreationTime = box_hton64(rStat.st_ctime * MICRO_SEC_IN_SEC_LL); + + if(ZeroLastWriteTime) + { + pAttr->LastWriteTime = 0; + } + else + { + pAttr->LastWriteTime = box_hton64(FileModificationTime(rStat)); + } + + // not very efficient to stat the file again, but emu_fstat + // doesn't return the information that we need. + + HANDLE handle = OpenFileByNameUtf8(pFilename); + + if (handle == INVALID_HANDLE_VALUE) + { + ::syslog(LOG_WARNING, "Failed to open file to read " + "Windows attributes: '%s': error %d", + pFilename, GetLastError()); + THROW_EXCEPTION(CommonException, OSFileError) + } + + BY_HANDLE_FILE_INFORMATION fi; + bool result = GetFileInformationByHandle(handle, &fi); + + if (!result) + { + CloseHandle(handle); + ::syslog(LOG_WARNING, "Failed to read Windows " + "file attributes for '%s': error %d", + pFilename, GetLastError()); + THROW_EXCEPTION(CommonException, OSFileError) + } + + if (INVALID_FILE_ATTRIBUTES == fi.dwFileAttributes) + { + CloseHandle(handle); + ::syslog(LOG_WARNING, "Failed to read valid Windows " + "file attributes for '%s': error %d", + pFilename, GetLastError()); + THROW_EXCEPTION(CommonException, OSFileError) + } + + pAttr->Attributes = fi.dwFileAttributes; + + // Now start writing our custom data, with the magic and version + CollectInBufferStream buffer; + Archive archiver(buffer, 0); + + archiver.Write((int) ACL_FORMAT_MAGIC); + archiver.Write((int) ACL_FORMAT_VERSION); + + PSID psidOwner = NULL; + PSID psidGroup = NULL; + PACL pDacl = NULL; + PSECURITY_DESCRIPTOR pSecurityDesc = NULL; + PEXPLICIT_ACCESS pEntries = NULL; + + try + { + DWORD result = GetSecurityInfo( + handle, // object handle + SE_FILE_OBJECT, // ObjectType + DACL_SECURITY_INFORMATION | // SecurityInfo + GROUP_SECURITY_INFORMATION | + OWNER_SECURITY_INFORMATION, + &psidOwner, // ppsidOwner, + &psidGroup, // ppsidGroup, + &pDacl, // ppDacl, + NULL, // ppSacl, + &pSecurityDesc // ppSecurityDescriptor + ); + + CloseHandle(handle); + + if (result != ERROR_SUCCESS) + { + ::syslog(LOG_WARNING, "Failed to get Windows " + "security info for '%s': error %d", + pFilename, result); + THROW_EXCEPTION(CommonException, OSFileError) + } + + WriteSid(archiver, psidOwner); + WriteSid(archiver, psidGroup); + + ULONG numEntries; + result = GetExplicitEntriesFromAcl + ( + pDacl, // pAcl + &numEntries, // pcCountOfExplicitEntries, + &pEntries // pListOfExplicitEntries + ); + + if(result != ERROR_SUCCESS) + { + ::syslog(LOG_WARNING, "Failed to get Windows " + "access control list entries for '%s': " + "error %d", pFilename, result); + THROW_EXCEPTION(CommonException, OSFileError) + } + + archiver.Write((int)numEntries); + + for (ULONG i = 0; i < numEntries; i++) + { + EXPLICIT_ACCESS* pEntry = &(pEntries[i]); + + archiver.Write((int)pEntry->grfAccessPermissions); + archiver.Write((int)pEntry->grfAccessMode); + archiver.Write((int)pEntry->grfInheritance); + archiver.Write((int)pEntry->Trustee.TrusteeForm); + archiver.Write((int)pEntry->Trustee.TrusteeType); + + if(pEntry->Trustee.pMultipleTrustee != NULL) + { + ::syslog(LOG_WARNING, "Failed to process " + "access control entry for '%s': " + "multiple trustees not supported", + pFilename); + THROW_EXCEPTION(CommonException, OSFileError); + } + + if(pEntry->Trustee.MultipleTrusteeOperation != + NO_MULTIPLE_TRUSTEE) + { + ::syslog(LOG_WARNING, "Failed to process " + "access control entry for '%s': " + "multiple trustees not supported (2)", + pFilename); + THROW_EXCEPTION(CommonException, OSFileError); + } + + switch(pEntry->Trustee.TrusteeForm) + { + case TRUSTEE_IS_SID: + { + PSID trusteeSid = (PSID)( + pEntry->Trustee.ptstrName); + WriteSid(archiver, trusteeSid); + } + break; + default: + ::syslog(LOG_WARNING, "Failed to process " + "access control entry for '%s': " + "trustee form %d not supported", + pFilename, + pEntry->Trustee.TrusteeForm); + THROW_EXCEPTION(CommonException, OSFileError); + } + + } + } + catch(...) + { + if (pEntries) LocalFree((HLOCAL)pEntries); + if (pSecurityDesc) LocalFree((HLOCAL)pSecurityDesc); + throw; + } + + LocalFree((HLOCAL)pEntries); + LocalFree((HLOCAL)pSecurityDesc); + + // Copy the serialised data into the output block + buffer.SetForReading(); + rOutputBlock.ResizeBlock(rOutputBlock.GetSize() + buffer.GetSize()); + + // block might have moved after resize + pAttr = (attr_StreamFormat_Windows *)(rOutputBlock.GetBuffer()); + memcpy(pAttr + 1, buffer.GetBuffer(), buffer.GetSize()); +} +#endif // WIN32 + + #ifndef WIN32 // -------------------------------------------------------------------------- // @@ -597,6 +833,15 @@ } int32_t *type = (int32_t*)mpClearAttributes->GetBuffer(); ASSERT(type != 0); + +#ifdef WIN32 + if(ntohl(*type) == ATTRIBUTETYPE_GENERIC_WINDOWS) + { + WriteAttributesWindows(Filename); + return; + } +#endif + if(ntohl(*type) != ATTRIBUTETYPE_GENERIC_UNIX) { // Don't know what to do with these @@ -604,22 +849,24 @@ } // Check there is enough space for an attributes block - if(mpClearAttributes->GetSize() < (int)sizeof(attr_StreamFormat)) + if(mpClearAttributes->GetSize() < (int)sizeof(attr_StreamFormat_Unix)) { // Too small THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); } // Get pointer to structure - attr_StreamFormat *pattr = (attr_StreamFormat*)mpClearAttributes->GetBuffer(); - int xattrOffset = sizeof(attr_StreamFormat); + attr_StreamFormat_Unix *pattr = (attr_StreamFormat_Unix*) + mpClearAttributes->GetBuffer(); + int xattrOffset = sizeof(attr_StreamFormat_Unix); // is it a symlink? int16_t mode = ntohs(pattr->Mode); if((mode & S_IFMT) == S_IFLNK) { // Check things are sensible - if(mpClearAttributes->GetSize() < (int)sizeof(attr_StreamFormat) + 1) + if(mpClearAttributes->GetSize() < + (int)sizeof(attr_StreamFormat_Unix) + 1) { // Too small THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); @@ -715,9 +962,248 @@ } +#ifdef WIN32 +bool ReadSid(Archive& rArchive, PSID* pPSID) +{ + int nametype; + rArchive.Read(nametype); + + std::string sid; + rArchive.Read(sid); + + std::string domain; + rArchive.Read(domain); + + std::string name; + rArchive.Read(name); + + name = domain + '\\' + name; + + DWORD sidBufSize = 0; + DWORD domainBufSize = 0; + SID_NAME_USE use; + + // TODO: if we don't find the account name, + // use the stored SID instead + + if (!LookupAccountName(NULL, name.c_str(), NULL, &sidBufSize, + NULL, &domainBufSize, &use) && + GetLastError() != ERROR_INSUFFICIENT_BUFFER) + { + ::syslog(LOG_ERR, "Failed to lookup account details for " + "'%s': error %d", name.c_str(), GetLastError()); + return false; + } + + *pPSID = malloc(sidBufSize); + TCHAR* domainstr = (TCHAR *)malloc(domainBufSize); + + BOOL result = LookupAccountName(NULL, name.c_str(), + *pPSID, &sidBufSize, domainstr, &domainBufSize, &use); + free(domainstr); + + if (!result) + { + ::syslog(LOG_ERR, "Failed to lookup account details for " + "'%s': error %d", name.c_str(), GetLastError()); + free(*pPSID); + *pPSID = NULL; + return false; + } + + return true; +} + + // -------------------------------------------------------------------------- // // Function +// Name: BackupClientFileAttributes::WriteAttributesWindows( +// const char *) +// Purpose: Apply the stored Windows attributes to the file +// Created: 2006/03/12 +// +// -------------------------------------------------------------------------- +void BackupClientFileAttributes::WriteAttributesWindows(const char *Filename) +const +{ + // Check there is enough space for an attributes block + if(mpClearAttributes->GetSize() < + (int)sizeof(attr_StreamFormat_Windows)) + { + // Too small + THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); + } + + // Get pointer to structure + attr_StreamFormat_Windows *pAttr = (attr_StreamFormat_Windows*) + mpClearAttributes->GetBuffer(); + + std::wstring wideName; + if (!GetFileNameWide(Filename, wideName)) + { + THROW_EXCEPTION(CommonException, OSFileError); + } + + DWORD attributes = pAttr->Attributes; + attributes &= ~FILE_ATTRIBUTE_OFFLINE; + attributes &= ~FILE_ATTRIBUTE_REPARSE_POINT; + + if (!SetFileAttributesW(wideName.c_str(), attributes)) + { + ::syslog(LOG_ERR, "Failed to restore attributes of '%s': " + "error %d", Filename, GetLastError()); + return; + } + + CollectInBufferStream buffer; + buffer.Write(pAttr + 1, mpClearAttributes->GetSize() - + sizeof(attr_StreamFormat_Windows)); + buffer.SetForReading(); + + Archive archive(buffer, 0); + int data; + + archive.Read(data); + if (data != ACL_FORMAT_MAGIC) + { + ::syslog(LOG_ERR, "Failed to restore ACL of '%s': " + "wrong magic in attribute block", Filename); + THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); + } + + archive.Read(data); + if (data != ACL_FORMAT_VERSION) + { + ::syslog(LOG_ERR, "Failed to restore ACL of '%s': " + "wrong version in attribute block", Filename); + THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); + } + + PACL pNewAcl = NULL; + PSID pSidOwner = NULL, pSidGroup = NULL; + + if (!ReadSid(archive, &pSidOwner)) + { + ::syslog(LOG_ERR, "Failed to restore ACL of '%s': " + "failed to decode file owner", Filename); + THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); + } + + if (!ReadSid(archive, &pSidGroup)) + { + ::syslog(LOG_ERR, "Failed to restore ACL of '%s': " + "failed to decode file group", Filename); + THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); + } + + int numEntries; + archive.Read(numEntries); + + EXPLICIT_ACCESS* pEntries = (EXPLICIT_ACCESS*)calloc(numEntries, + sizeof(EXPLICIT_ACCESS)); + + if (!pEntries) + { + ::syslog(LOG_ERR, "Failed to restore ACL of '%s': " + "out of memory", Filename); + if (pSidOwner) free(pSidOwner); + if (pSidGroup) free(pSidGroup); + THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); + } + + for (int i = 0; i < numEntries; i++) + { + PEXPLICIT_ACCESS pEntry = &(pEntries[i]); + + int data; + archive.Read(data); pEntry->grfAccessPermissions = data; + archive.Read(data); pEntry->grfAccessMode = (ACCESS_MODE)data; + archive.Read(data); pEntry->grfInheritance = data; + archive.Read(data); pEntry->Trustee.TrusteeForm = + (TRUSTEE_FORM)data; + archive.Read(data); pEntry->Trustee.TrusteeType = + (TRUSTEE_TYPE)data; + + if (pEntry->Trustee.TrusteeForm != TRUSTEE_IS_SID) + { + ::syslog(LOG_ERR, "Failed to restore ACL of '%s': " + "only SID trustees are supported", Filename); + if (pSidOwner) free(pSidOwner); + if (pSidGroup) free(pSidGroup); + THROW_EXCEPTION(BackupStoreException, + AttributesNotLoaded); + } + + LPSTR* pPSIDstr = &pEntry->Trustee.ptstrName; + if (!ReadSid(archive, (PSID*)pPSIDstr)) + { + ::syslog(LOG_ERR, "Failed to restore ACL of '%s': " + "failed to read ACL entry %d SID", Filename, i); + if (pSidOwner) free(pSidOwner); + if (pSidGroup) free(pSidGroup); + THROW_EXCEPTION(BackupStoreException, + AttributesNotLoaded); + } + } + + DWORD result = SetEntriesInAcl(numEntries, pEntries, NULL, &pNewAcl); + + for (int i = 0; i < numEntries; i++) + { + PEXPLICIT_ACCESS pEntry = &(pEntries[i]); + PSID pSid = (PSID)(pEntry->Trustee.ptstrName); + free(pSid); + } + + free(pEntries); + + if (result != ERROR_SUCCESS) + { + ::syslog(LOG_ERR, "Failed to create access control list " + "for '%s': error %d", Filename, result); + if (pSidOwner) free(pSidOwner); + if (pSidGroup) free(pSidGroup); + THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); + } + + WCHAR* pNameBuffer = new WCHAR [wideName.size() + 1]; + if (!pNameBuffer) + { + ::syslog(LOG_ERR, "Failed to create access control list " + "for '%s': out of memory", Filename); + if (pSidOwner) free(pSidOwner); + if (pSidGroup) free(pSidGroup); + THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); + } + + memcpy(pNameBuffer, wideName.c_str(), wideName.size() * sizeof(WCHAR)); + + result = SetNamedSecurityInfoW(pNameBuffer, SE_FILE_OBJECT, + DACL_SECURITY_INFORMATION | + OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION + /* | UNPROTECTED_DACL_SECURITY_INFORMATION */, + pSidOwner, pSidGroup, pNewAcl, NULL); + + delete [] pNameBuffer; + LocalFree((HLOCAL)pNewAcl); + + if (result != ERROR_SUCCESS) + { + ::syslog(LOG_ERR, "Failed to apply access control list " + "to '%s': error %d", Filename, result); + if (pSidOwner) free(pSidOwner); + if (pSidGroup) free(pSidGroup); + THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded); + } +} +#endif + + +// -------------------------------------------------------------------------- +// +// Function // Name: BackupClientFileAttributes::IsSymLink() // Purpose: Do these attributes represent a symbolic link? // Created: 2003/10/07 @@ -736,10 +1222,12 @@ // Get the type of attributes stored int32_t *type = (int32_t*)mpClearAttributes->GetBuffer(); ASSERT(type != 0); - if(ntohl(*type) == ATTRIBUTETYPE_GENERIC_UNIX && mpClearAttributes->GetSize() > (int)sizeof(attr_StreamFormat)) + if(ntohl(*type) == ATTRIBUTETYPE_GENERIC_UNIX && + mpClearAttributes->GetSize() > (int)sizeof(attr_StreamFormat_Unix)) { // Check link - attr_StreamFormat *pattr = (attr_StreamFormat*)mpClearAttributes->GetBuffer(); + attr_StreamFormat_Unix *pattr = (attr_StreamFormat_Unix*) + mpClearAttributes->GetBuffer(); return ((ntohs(pattr->Mode)) & S_IFMT) == S_IFLNK; } Modified: box/chris/acl/lib/backupclient/BackupClientFileAttributes.h =================================================================== --- box/chris/acl/lib/backupclient/BackupClientFileAttributes.h 2006-08-20 22:46:33 UTC (rev 805) +++ box/chris/acl/lib/backupclient/BackupClientFileAttributes.h 2006-08-20 22:52:09 UTC (rev 806) @@ -17,6 +17,69 @@ struct stat; +// set packing to one byte +#ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS +#include "BeginStructPackForWire.h" +#else +BEGIN_STRUCTURE_PACKING_FOR_WIRE +#endif + +#define ATTRIBUTETYPE_GENERIC_UNIX 1 +#define ATTRIBUTETYPE_GENERIC_WINDOWS 2 + +#ifdef WIN32 +#define ACL_FORMAT_MAGIC 0x31415927 +#define ACL_FORMAT_VERSION 0x1 +#endif + +typedef struct +{ + int32_t AttributeType; +} attr_StreamFormat_Generic; + +typedef struct +{ + int32_t AttributeType; + u_int32_t UID; + u_int32_t GID; + u_int64_t ModificationTime; + u_int64_t AttrModificationTime; + u_int32_t UserDefinedFlags; + u_int32_t FileGenerationNumber; + u_int16_t Mode; + // Symbolic link filename may follow + // Extended attribute (xattr) information may follow, format is: + // u_int32_t Size of extended attribute block (excluding this word) + // For each of NumberOfAttributes (sorted by AttributeName): + // u_int16_t AttributeNameLength + // char AttributeName[AttributeNameLength] + // u_int32_t AttributeValueLength + // unsigned char AttributeValue[AttributeValueLength] + // AttributeName is 0 terminated, AttributeValue is not (and may be binary data) +} attr_StreamFormat_Unix; + +typedef struct +{ + int32_t AttributeType; + u_int32_t Attributes; + u_int64_t CreationTime; + u_int64_t LastWriteTime; +} attr_StreamFormat_Windows; + +// This has wire packing so it's compatible across platforms +// Use wider than necessary sizes, just to be careful. +typedef struct +{ + int32_t uid, gid, mode; +} attributeHashData; + +// Use default packing +#ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS +#include "EndStructPackForWire.h" +#else +END_STRUCTURE_PACKING_FOR_WIRE +#endif + // -------------------------------------------------------------------------- // // Class @@ -58,6 +121,14 @@ private: static void FillAttributes(StreamableMemBlock &outputBlock, const char *Filename, struct stat &st, bool ZeroModificationTimes); static void FillAttributesLink(StreamableMemBlock &outputBlock, const char *Filename, struct stat &st); + +#ifdef WIN32 + static void FillAttributesWindows(StreamableMemBlock &rOutputBlock, + const char* pFilename, struct stat &rStat, + bool ZeroModificationTimes); + void WriteAttributesWindows(const char *Filename) const; +#endif + void WriteExtendedAttr(const char *Filename, int xattrOffset) const; void RemoveClear() const; @@ -65,6 +136,13 @@ static StreamableMemBlock *MakeClear(const StreamableMemBlock &rEncrypted); void EncryptAttr(const StreamableMemBlock &rToEncrypt); +public: + const StreamableMemBlock& GetAttributes() + { + EnsureClearAvailable(); + return *mpClearAttributes; + } + private: mutable StreamableMemBlock *mpClearAttributes; }; Modified: box/chris/acl/lib/backupclient/BackupClientRestore.cpp =================================================================== --- box/chris/acl/lib/backupclient/BackupClientRestore.cpp 2006-08-20 22:46:33 UTC (rev 805) +++ box/chris/acl/lib/backupclient/BackupClientRestore.cpp 2006-08-20 22:52:09 UTC (rev 806) @@ -325,7 +325,12 @@ // Apply attributes to the directory const StreamableMemBlock &dirAttrBlock(dir.GetAttributes()); BackupClientFileAttributes dirAttr(dirAttrBlock); + + // too early to apply attributes on Win32: + // might prevent us from accessing or writing to the directory +#ifndef WIN32 dirAttr.WriteAttributes(rLocalDirectoryName.c_str()); +#endif int64_t bytesWrittenSinceLastRestoreInfoSave = 0; @@ -438,6 +443,10 @@ } } +#ifdef WIN32 + dirAttr.WriteAttributes(rLocalDirectoryName.c_str()); +#endif + return Restore_Complete; } Modified: box/chris/acl/lib/backupclient/BackupStoreException.txt =================================================================== --- box/chris/acl/lib/backupclient/BackupStoreException.txt 2006-08-20 22:46:33 UTC (rev 805) +++ box/chris/acl/lib/backupclient/BackupStoreException.txt 2006-08-20 22:52:09 UTC (rev 806) @@ -68,3 +68,4 @@ IncompatibleFromAndDiffFiles 65 Attempt to use a diff and a from file together, when they're not related DiffFromIDNotFoundInDirectory 66 When uploading via a diff, the diff from file must be in the same directory PatchChainInfoBadInDirectory 67 A directory contains inconsistent information. Run bbstoreaccounts check to fix it. +LookupAccountFailed 68 The file's security information refers to an account that could not be found Copied: box/chris/acl/lib/common/DiscardStream.cpp (from rev 532, box/chris/general/lib/common/CollectInBufferStream.cpp) =================================================================== --- box/chris/acl/lib/common/DiscardStream.cpp (rev 0) +++ box/chris/acl/lib/common/DiscardStream.cpp 2006-08-20 22:52:09 UTC (rev 806) @@ -0,0 +1,131 @@ +// -------------------------------------------------------------------------- +// +// File +// Name: DiscardStream.cpp +// Purpose: Discards data written to it +// Created: 2006/03/06 +// +// -------------------------------------------------------------------------- + +#include "Box.h" + +#include + +#include "DiscardStream.h" +#include "CommonException.h" + +#include "MemLeakFindOn.h" + +// -------------------------------------------------------------------------- +// +// Function +// Name: DiscardStream::DiscardStream() +// Purpose: Constructor +// Created: 2006/03/06 +// +// -------------------------------------------------------------------------- +DiscardStream::DiscardStream() +{ +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: DiscardStream::~DiscardStream() +// Purpose: Destructor +// Created: 2006/03/06 +// +// -------------------------------------------------------------------------- +DiscardStream::~DiscardStream() +{ +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: DiscardStream::Read(void *, int, int) +// Purpose: As interface. Never reads anything :-) +// Created: 2003/08/26 +// +// -------------------------------------------------------------------------- +int DiscardStream::Read(void *pBuffer, int NBytes, int Timeout) +{ + return 0; +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: DiscardStream::BytesLeftToRead() +// Purpose: As interface. Never anything to read. +// Created: 2006/03/06 +// +// -------------------------------------------------------------------------- +IOStream::pos_type DiscardStream::BytesLeftToRead() +{ + return 0; +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: DiscardStream::Write(void *, int) +// Purpose: As interface. Dicards written data. +// Created: 2006/03/06 +// +// -------------------------------------------------------------------------- +void DiscardStream::Write(const void *pBuffer, int NBytes) +{ +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: DiscardStream::GetPosition() +// Purpose: As interface. Always returns 0. +// Created: 2006/03/06 +// +// -------------------------------------------------------------------------- +IOStream::pos_type DiscardStream::GetPosition() const +{ + return 0; +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: DiscardStream::Seek(pos_type, int) +// Purpose: As interface. Does nothing. +// Created: 2006/03/06 +// +// -------------------------------------------------------------------------- +void DiscardStream::Seek(pos_type Offset, int SeekType) +{ +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: DiscardStream::StreamDataLeft() +// Purpose: As interface. Always returns false. +// Created: 2006/03/06 +// +// -------------------------------------------------------------------------- +bool DiscardStream::StreamDataLeft() +{ + return false; +} + +// -------------------------------------------------------------------------- +// +// Function +// Name: DiscardStream::StreamClosed() +// Purpose: As interface. Always returns false. +// Created: 2006/03/06 +// +// -------------------------------------------------------------------------- +bool DiscardStream::StreamClosed() +{ + return false; +} + Copied: box/chris/acl/lib/common/DiscardStream.h (from rev 532, box/chris/general/lib/common/CollectInBufferStream.h) =================================================================== --- box/chris/acl/lib/common/DiscardStream.h (rev 0) +++ box/chris/acl/lib/common/DiscardStream.h 2006-08-20 22:52:09 UTC (rev 806) @@ -0,0 +1,44 @@ +// -------------------------------------------------------------------------- +// +// File +// Name: DiscardStream.h +// Purpose: Discards data written to it +// Created: 2006/03/06 +// +// -------------------------------------------------------------------------- + +#ifndef DISCARDSTREAM__H +#define DISCARDSTREAM__H + +#include "IOStream.h" + +// -------------------------------------------------------------------------- +// +// Class +// Name: DiscardStream +// Purpose: Discards data written to it +// Created: 2006/03/06 +// +// -------------------------------------------------------------------------- +class DiscardStream : public IOStream +{ +public: + DiscardStream(); + ~DiscardStream(); +private: + // No copying + DiscardStream(const DiscardStream &); + DiscardStream(const IOStream &); +public: + + virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite); + virtual pos_type BytesLeftToRead(); + virtual void Write(const void *pBuffer, int NBytes); + virtual pos_type GetPosition() const; + virtual void Seek(pos_type Offset, int SeekType); + virtual bool StreamDataLeft(); + virtual bool StreamClosed(); +}; + +#endif // DISCARDSTREAM__H + Modified: box/chris/acl/lib/win32/emu.cpp =================================================================== --- box/chris/acl/lib/win32/emu.cpp 2006-08-20 22:46:33 UTC (rev 805) +++ box/chris/acl/lib/win32/emu.cpp 2006-08-20 22:52:09 UTC (rev 806) @@ -663,6 +663,43 @@ // -------------------------------------------------------------------------- // // Function +// Name: GetFileNameWide(const std::string& rIn, std::wstring& +// rOut) +// Purpose: Converts filename to Unicode and returns it +// in rOut, returning true. In case of error, +// sets errno, logs the error and returns false. +// Created: 2006/03/13 +// +// -------------------------------------------------------------------------- +bool GetFileNameWide(const std::string& rIn, std::wstring& rOut) +{ + std::string AbsPathWithUnicode = + ConvertPathToAbsoluteUnicode(rIn.c_str()); + + if (AbsPathWithUnicode.size() == 0) + { + // error already logged by ConvertPathToAbsoluteUnicode() + return false; + } + + WCHAR* pBuffer = ConvertUtf8ToWideString(AbsPathWithUnicode.c_str()); + // We are responsible for freeing pBuffer + + if (pBuffer == NULL) + { + // error already logged by ConvertUtf8ToWideString() + return false; + } + + rOut = pBuffer; + delete [] pBuffer; + return true; +} + + +// -------------------------------------------------------------------------- +// +// Function // Name: OpenFileByNameUtf8 // Purpose: Converts filename to Unicode and returns // a handle to it. In case of error, sets errno, Modified: box/chris/acl/lib/win32/emu.h =================================================================== --- box/chris/acl/lib/win32/emu.h 2006-08-20 22:46:33 UTC (rev 805) +++ box/chris/acl/lib/win32/emu.h 2006-08-20 22:52:09 UTC (rev 806) @@ -365,6 +365,10 @@ // replacement for _cgetws which requires a relatively recent C runtime lib int console_read(char* pBuffer, size_t BufferSize); +// used by BackupClientFileAttributes to get Windows file attributes +HANDLE OpenFileByNameUtf8(const char* pFileName); +bool GetFileNameWide(const std::string& rIn, std::wstring& rOut); + struct iovec { void *iov_base; /* Starting address */ size_t iov_len; /* Number of bytes */ Modified: box/chris/acl/test/win32/testlibwin32.cpp =================================================================== --- box/chris/acl/test/win32/testlibwin32.cpp 2006-08-20 22:46:33 UTC (rev 805) +++ box/chris/acl/test/win32/testlibwin32.cpp 2006-08-20 22:52:09 UTC (rev 806) @@ -329,6 +329,12 @@ closelog(); + struct stat st; + assert(!emu_stat("c:\\cygwin\\home\\administrator\\pcre-6.3\\.libs", &st)); + printf("%lld\n", (long long)st.st_size); + assert(!emu_stat("c:\\cygwin\\home\\administrator\\pcre-6.3\\.libs", &st)); + printf("%lld\n", (long long)st.st_size); + /* //first off get the path name for the default char buf[MAX_PATH]; From boxbackup-dev at fluffy.co.uk Mon Aug 21 00:12:32 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Mon, 21 Aug 2006 00:12:32 +0100 Subject: [Box Backup-dev] COMMIT r807 - box/trunk/bin/bbackupquery Message-ID: Author: chris Date: 2006-08-21 00:12:32 +0100 (Mon, 21 Aug 2006) New Revision: 807 Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp Log: * bin/bbackupquery/BackupQueries.cpp - Use a nicer data structure for commands and their options. Modified: box/trunk/bin/bbackupquery/BackupQueries.cpp =================================================================== --- box/trunk/bin/bbackupquery/BackupQueries.cpp 2006-08-20 22:52:09 UTC (rev 806) +++ box/trunk/bin/bbackupquery/BackupQueries.cpp 2006-08-20 23:12:32 UTC (rev 807) @@ -89,6 +89,12 @@ { } +typedef struct +{ + const char* name; + const char* opts; +} QueryCommandSpecification; + // -------------------------------------------------------------------------- // // Function @@ -166,8 +172,24 @@ } // Data about commands - static const char *commandNames[] = {"quit", "exit", "list", "pwd", "cd", "lcd", "sh", "getobject", "get", "compare", "restore", "help", "usage", "undelete", 0}; - static const char *validOptions[] = {"", "", "rodIFtsh", "", "od", "", "", "", "i", "alcqE", "dri", "", "", "", 0}; + static QueryCommandSpecification commands[] = + { + { "quit", "" }, + { "exit", "" }, + { "list", "rodIFtsh", }, + { "pwd", "" }, + { "cd", "od" }, + { "lcd", "" }, + { "sh", "" }, + { "getobject", "" }, + { "get", "i" }, + { "compare", "alcqE" }, + { "restore", "dri" }, + { "help", "" }, + { "usage", "" }, + { "undelete", "" }, + { NULL, NULL } + }; #define COMMAND_Quit 0 #define COMMAND_Exit 1 #define COMMAND_List 2 @@ -187,11 +209,11 @@ // Work out which command it is... int cmd = 0; - while(commandNames[cmd] != 0 && ::strcmp(cmdElements[0].c_str(), commandNames[cmd]) != 0) + while(commands[cmd].name != 0 && ::strcmp(cmdElements[0].c_str(), commands[cmd].name) != 0) { cmd++; } - if(commandNames[cmd] == 0) + if(commands[cmd].name == 0) { // Check for aliases int a; @@ -226,9 +248,10 @@ while(*c != 0) { // Valid option? - if(::strchr(validOptions[cmd], *c) == NULL) + if(::strchr(commands[cmd].opts, *c) == NULL) { - printf("Invalid option '%c' for command %s\n", *c, commandNames[cmd]); + printf("Invalid option '%c' for command %s\n", + *c, commands[cmd].name); return; } opts[(int)*c] = true; From boxbackup-dev at fluffy.co.uk Mon Aug 21 00:23:31 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Mon, 21 Aug 2006 00:23:31 +0100 Subject: [Box Backup-dev] COMMIT r808 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2006-08-21 00:23:31 +0100 (Mon, 21 Aug 2006) New Revision: 808 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Removed redundant exception handler (BoxException extends std::exception) - Changed error to warning if an exception is caught while trying to clean up from another exception on the command socket Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-20 23:12:32 UTC (rev 807) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-20 23:23:31 UTC (rev 808) @@ -274,13 +274,6 @@ { rSocket.Accept(BOX_NAMED_PIPE_NAME); } - catch(BoxException &e) - { - ::syslog(LOG_ERR, "Failed to open command socket: %s", - e.what()); - SetTerminateWanted(); - break; // this is fatal to listening thread - } catch(std::exception &e) { ::syslog(LOG_ERR, "Failed to open command socket: " @@ -465,7 +458,7 @@ } catch(std::exception &e) { - ::syslog(LOG_ERR, "Internal error while " + ::syslog(LOG_WARNING, "Internal error while " "closing command socket after " "another exception: %s", e.what()); } From boxbackup-dev at fluffy.co.uk Mon Aug 21 00:41:07 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Mon, 21 Aug 2006 00:41:07 +0100 Subject: [Box Backup-dev] COMMIT r809 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2006-08-21 00:41:07 +0100 (Mon, 21 Aug 2006) New Revision: 809 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Improved exception messages for reading and writing the StoreObjectInfoFile, and made them consistent. Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-20 23:23:31 UTC (rev 808) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-20 23:41:07 UTC (rev 809) @@ -2333,13 +2333,33 @@ ::syslog(LOG_INFO, "Saved store object info file '%s'", StoreObjectInfoFile.c_str()); } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error writing store object " + "info file (%s): %s", + StoreObjectInfoFile.c_str(), e.what()); + } catch(...) { - ::syslog(LOG_WARNING, "Requested store object info file '%s' " - "not accessible or could not be created", + ::syslog(LOG_ERR, "Internal error writing store object " + "info file (%s): unknown error", StoreObjectInfoFile.c_str()); } + DeleteAllLocations(); + catch(std::exception &e) + { + ::syslog(LOG_WARNING, "Requested store object info file '%s' " + "not accessible or could not be created: %s", + StoreObjectInfoFile.c_str(), e.what()); + } + catch(...) + { + ::syslog(LOG_WARNING, "Requested store object info file '%s' " + "not accessible or could not be created: " + "unknown error", StoreObjectInfoFile.c_str()); + } + return created; } @@ -2492,12 +2512,14 @@ catch(std::exception &e) { ::syslog(LOG_ERR, "Internal error reading store object " - "info file: %s", e.what()); + "info file (%s): %s", + StoreObjectInfoFile.c_str(), e.what()); } catch(...) { ::syslog(LOG_ERR, "Internal error reading store object " - "info file: unknown error"); + "info file (%s): unknown error", + StoreObjectInfoFile.c_str()); } DeleteAllLocations(); From boxbackup-dev at fluffy.co.uk Mon Aug 21 00:39:47 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Mon, 21 Aug 2006 00:39:47 +0100 (BST) Subject: [Box Backup-dev] Merges In-Reply-To: <1156113491.18437.12.camel@avenin.ebourne.me.uk> References: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> <1156025939.17028.50.camel@avenin.ebourne.me.uk> <1156065492.17028.63.camel@avenin.ebourne.me.uk> <1156113491.18437.12.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, On Sun, 20 Aug 2006, Martin Ebourne wrote: >> svn diff -r 748:803 \ >> http://bbdev.fluffy.co.uk/svn/box/chris/merge/bin/bbackupd/BackupDaemon.cpp > > catch(std::exception &e) > { > ::syslog(LOG_ERR, "Internal error while " > "closing command socket after " > "another exception: %s", e.what()); > } > catch(...) > { > ::syslog(LOG_WARNING, > "Error closing command socket " > "after exception, ignored."); > } > > Why is one an error and one a warning? I was trying to be consistent with other places where we caught std::exception, since it indicates an unexpected error rather than a (more likely) socket error, and therefore seemed more serious. But I've changed it because you asked, and because it's only during cleanup from an exception anyway. > Having been and looked at the code I can see that BoxException already > implements std::exception. At least the first try/catch in > RunHelperThread could therefore have the catch(BoxException) block > removed since the catch(std::exception) block will cover it and do > exactly the same thing. OK, done. > Probably also the one at the end of the same method (though keep the > message from the BoxException case to use for std::exception). I'm not sure about that. An internal error such as running out of memory is different to a socket error, so I think we should report them differently. > At line 804 it seems a shame that the standard exceptions can't be > reported like the box ones. Maybe if we reserved a type/subtype value > for std::exceptions we could use the same mechanism? Perhaps, but I'll wait for Ben to say what he wants to do here before I do that. In any case, we'd still need two blocks, and as the comments say, this part of the code should probably be reviewed for exception safety anyway. > I wonder if you intentionally skipped the one at line 2343? No, well spotted. > There were some waitpid changes in this diff that weren't in the > previous one. Were they accidental? No, deliberate. Rather than copying the same code yet again, I removed the existing duplication. I think the effect is identical. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Mon Aug 21 09:45:54 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Mon, 21 Aug 2006 09:45:54 +0100 Subject: [Box Backup-dev] COMMIT r810 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2006-08-21 09:45:54 +0100 (Mon, 21 Aug 2006) New Revision: 810 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Remove duplicated exception handlers Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-20 23:41:07 UTC (rev 809) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-21 08:45:54 UTC (rev 810) @@ -2346,20 +2346,6 @@ StoreObjectInfoFile.c_str()); } - DeleteAllLocations(); - catch(std::exception &e) - { - ::syslog(LOG_WARNING, "Requested store object info file '%s' " - "not accessible or could not be created: %s", - StoreObjectInfoFile.c_str(), e.what()); - } - catch(...) - { - ::syslog(LOG_WARNING, "Requested store object info file '%s' " - "not accessible or could not be created: " - "unknown error", StoreObjectInfoFile.c_str()); - } - return created; } From boxbackup-dev at fluffy.co.uk Tue Aug 22 20:15:29 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Tue, 22 Aug 2006 20:15:29 +0100 Subject: [Box Backup-dev] Merges In-Reply-To: <20060820144339.76041.qmail@web60619.mail.yahoo.com> References: <20060820144339.76041.qmail@web60619.mail.yahoo.com> Message-ID: Sounds interesting. Hasn't there been quite a lot of work on this area? I think mainly by commercial companies though. Ben On 20 Aug 2006, at 15:43, E.W. Peter Jalajas wrote: > One tiny development-side thing that I could contribute to the > project, > until the compiler --enforce-coding-stds option is created, that I've > always wanted to do and had a minor passion about, is to write scripts > that scan the entire source code tree for various issues, including > common security holes (for example, buffer overflows; un-validated > input strings), coding standards, copyright/license strings, string > capitalization, etc. > > At first, this script could be run manually periodically locally on my > computer and I'll report the issues found to the -dev list, but > then if > it proves worthy, it could maybe be added to the check-in validation > process at some level between simple reporting and heavy-handed > enforcement. At first it would have to be optional, lest nothing > would > get checked in any more :-). > > At first, it could just report issues; maybe later it could maybe > correct simple issues (for example, replace tabs with spaces, or > replace copyright 2001 with Copyright $CurrentYear). > > I tend to write things like this for my own use in shell (bash, and > less frequently now ksh), but I wouldn't have a problem coding it in > perl if preferred. > > Any interest in such a beast? Is there such a thing out there > already? > > Pete > --- Chris Wilson wrote: > >> Hi Ben, >> >> On Sun, 20 Aug 2006, Ben Summers wrote: >> >>> I hope everyone else thinks coding standards are important. > >>> I read a essay recently which suggested that the compilers should >>> enforce coding standards. >> I think it would be a good idea, but it would have to be optional, or >> else >> nothing would compile any more :-) > > _______________________________________________ > Boxbackup-dev mailing list > Boxbackup-dev at fluffy.co.uk > http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Tue Aug 22 20:18:23 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Tue, 22 Aug 2006 20:18:23 +0100 Subject: [Box Backup-dev] Merges In-Reply-To: <1156113491.18437.12.camel@avenin.ebourne.me.uk> References: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> <1156025939.17028.50.camel@avenin.ebourne.me.uk> <1156065492.17028.63.camel@avenin.ebourne.me.uk> <1156113491.18437.12.camel@avenin.ebourne.me.uk> Message-ID: <8BACB4F6-E94A-491C-BCBA-0ADDEC4C3710@fluffy.co.uk> These repeated exception handlers are getting a bit messy. Perhaps there's some way to make things easier? Perhaps an error reporting function which takes an std::exception? Ben On 20 Aug 2006, at 23:38, Martin Ebourne wrote: > On Sun, 2006-08-20 at 11:13 +0100, Chris Wilson wrote: >> OK, fixed, I think. Please review for merge: >> >> svn diff -r 748:803 \ >> http://bbdev.fluffy.co.uk/svn/box/chris/merge/bin/bbackupd/ >> BackupDaemon.cpp > > catch(std::exception &e) > { > ::syslog(LOG_ERR, "Internal error while " > "closing command socket after " > "another exception: %s", e.what()); > } > catch(...) > { > ::syslog(LOG_WARNING, > "Error closing command socket " > "after exception, ignored."); > } > > Why is one an error and one a warning? > > Having been and looked at the code I can see that BoxException already > implements std::exception. At least the first try/catch in > RunHelperThread could therefore have the catch(BoxException) block > removed since the catch(std::exception) block will cover it and do > exactly the same thing. Probably also the one at the end of the same > method (though keep the message from the BoxException case to use for > std::exception). > > At line 804 it seems a shame that the standard exceptions can't be > reported like the box ones. Maybe if we reserved a type/subtype value > for std::exceptions we could use the same mechanism? > > I wonder if you intentionally skipped the one at line 2343? > > There were some waitpid changes in this diff that weren't in the > previous one. Were they accidental? eg. > > - // Clean up though > - if(pid != 0) > - { > - int status = 0; > - ::waitpid(pid, &status, 0); > - } > >> Thanks, please review for merge: >> >> svn diff -r 755:802 >> http://bbdev.fluffy.co.uk/svn/box/chris/merge/bin/bbackupquery/ >> BackupQueries.cpp > > Yes, that's fine. > > Cheers, > > Martin. > > _______________________________________________ > Boxbackup-dev mailing list > Boxbackup-dev at fluffy.co.uk > http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Tue Aug 22 20:59:47 2006 From: boxbackup-dev at fluffy.co.uk (E.W. Peter Jalajas) Date: Tue, 22 Aug 2006 12:59:47 -0700 (PDT) Subject: [Box Backup-dev] Scanning source code, was Merges In-Reply-To: Message-ID: <20060822195947.24187.qmail@web60623.mail.yahoo.com> Phew, thanks for the reminder, Ben! Sourceforge didn't seem to have anything. I'll start here: http://www.linuxjournal.com/article/5673 which mentions Flawfinder, RATS and ITS4 (and lint and pscan), and then I'll follow the link from there to the Open Source Quality Project, http://osq.cs.berkeley.edu/ (ITS4 seems to have a funky license, with commercial restrictions under which I'm not sure if I would fall or not.) Thanks again, Pete --- Ben Summers wrote: > Sounds interesting. > Hasn't there been quite a lot of work on this area? I think mainly by > commercial companies though. > > Ben > > On 20 Aug 2006, at 15:43, E.W. Peter Jalajas wrote: > > > One tiny development-side thing that I could contribute is to write scripts that scan the entire source code tree for various issues, From boxbackup-dev at fluffy.co.uk Tue Aug 22 21:35:06 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Tue, 22 Aug 2006 21:35:06 +0100 Subject: [Box Backup-dev] COMMIT r811 - box/chris Message-ID: Author: chris Date: 2006-08-22 21:35:06 +0100 (Tue, 22 Aug 2006) New Revision: 811 Added: box/chris/retry-debug/ Log: * http://bbdev.fluffy.co.uk/svn/box/chris/retry-debug - Added branch with additional debug code for diagnosing infinite retries waiting on command socket after Box throws an exception. Copied: box/chris/retry-debug (from rev 810, box/trunk) From boxbackup-dev at fluffy.co.uk Tue Aug 22 22:43:22 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Tue, 22 Aug 2006 22:43:22 +0100 Subject: [Box Backup-dev] COMMIT r812 - in box/chris/retry-debug: bin/bbackupd lib/common Message-ID: Author: chris Date: 2006-08-22 22:43:22 +0100 (Tue, 22 Aug 2006) New Revision: 812 Modified: box/chris/retry-debug/bin/bbackupd/BackupDaemon.cpp box/chris/retry-debug/lib/common/BoxTime.cpp Log: * lib/common/BoxTime.cpp - Use gettimeofday() to return current time accurately, prevents looping on WaitOnCommandSocket with tiny delays * bin/bbackupd/BackupDaemon.cpp - Added a lot of debugging output to help diagnose interminable waits on the command socket Modified: box/chris/retry-debug/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/retry-debug/bin/bbackupd/BackupDaemon.cpp 2006-08-22 20:35:06 UTC (rev 811) +++ box/chris/retry-debug/bin/bbackupd/BackupDaemon.cpp 2006-08-22 21:43:22 UTC (rev 812) @@ -74,6 +74,7 @@ #include "IOStreamGetLine.h" #include "Conversion.h" #include "Archive.h" +#include "BoxTimeToText.h" #include "MemLeakFindOn.h" @@ -536,6 +537,7 @@ // If there isn't automatic backup happening, set a long delay. And limit delays at the same time. if(!automaticBackup || requiredDelay > SecondsToBoxTime(MAX_SLEEP_TIME)) requiredDelay = SecondsToBoxTime(MAX_SLEEP_TIME); + TRACE3("Current time is %lld, next backup at %lld, waiting %lld us\n", currentTime, nextSyncTime, requiredDelay); // Only do the delay if there is a delay required if(requiredDelay > 0) @@ -554,13 +556,31 @@ } } + if (!automaticBackup) + { + TRACE0("No automatic backups, still waiting for a backup command.\n"); + } + else if (currentTime < nextSyncTime) + { + std::string next = BoxTimeToISO8601String(nextSyncTime); + TRACE1("Still waiting for next backup at %s\n", next.c_str()); + } } while((!automaticBackup || (currentTime < nextSyncTime)) && !doSync && !StopRun()); + if (doSync) + { + TRACE0("User requested a sync, starting now.\n"); + } + else if (StopRun()) + { + TRACE0("User requested program shutdown.\n"); + } } // Time of sync start, and if it's time for another sync (and we're doing automatic syncs), set the flag box_time_t currentSyncStartTime = GetCurrentBoxTime(); if(automaticBackup && currentSyncStartTime >= nextSyncTime) { + TRACE0("Time for another sync.\n"); doSync = true; } @@ -570,6 +590,7 @@ int d = UseScriptToSeeIfSyncAllowed(); if(d > 0) { + TRACE1("SyncAllowScript asked for a delay of %d seconds\n", d); // Script has asked for a delay nextSyncTime = GetCurrentBoxTime() + SecondsToBoxTime(d); doSync = false; @@ -725,7 +746,9 @@ } // Calculate when the next sync run should be - nextSyncTime = currentSyncStartTime + updateStoreInterval + Random::RandomInt(updateStoreInterval >> SYNC_PERIOD_RANDOM_EXTRA_TIME_SHIFT_BY); + int64_t randomBit = Random::RandomInt(updateStoreInterval >> SYNC_PERIOD_RANDOM_EXTRA_TIME_SHIFT_BY); + TRACE3("Next sync at %lld (last start) + %lld (update interval) + %lld (random bit)\n", currentSyncStartTime, updateStoreInterval, randomBit); + nextSyncTime = currentSyncStartTime + updateStoreInterval + randomBit; // Commit the ID Maps CommitIDMapsAfterSync(); @@ -761,6 +784,8 @@ if(errorOccurred) { + TRACE0("An error occured during the backup run.\n"); + // Is it a berkely db failure? bool isBerkelyDbFailure = (errorCode == BackupStoreException::ExceptionType && errorSubCode == BackupStoreException::BerkelyDBFailure); @@ -959,6 +984,7 @@ { // If a connection didn't arrive, there was a timeout, which means we've // waited long enough and it's time to go. + TRACE1("Returned due to timeout (waited %d ms).\n", timeout); return; } else Modified: box/chris/retry-debug/lib/common/BoxTime.cpp =================================================================== --- box/chris/retry-debug/lib/common/BoxTime.cpp 2006-08-22 20:35:06 UTC (rev 811) +++ box/chris/retry-debug/lib/common/BoxTime.cpp 2006-08-22 21:43:22 UTC (rev 812) @@ -10,6 +10,7 @@ #include "Box.h" #include +#include #include "BoxTime.h" @@ -25,7 +26,14 @@ // -------------------------------------------------------------------------- box_time_t GetCurrentBoxTime() { - return SecondsToBoxTime(time(0)); + struct timeval tv; + int result = gettimeofday(&tv, NULL); + if (result != 0) + { + TRACE1("Error: gettimeofday returned %d, approximating\n", result); + return SecondsToBoxTime(time(0)); + } + return ((uint64_t)tv.tv_sec * MICRO_SEC_IN_SEC_LL) + tv.tv_usec; } From boxbackup-dev at fluffy.co.uk Fri Aug 25 06:13:42 2006 From: boxbackup-dev at fluffy.co.uk (E.W. Peter Jalajas) Date: Thu, 24 Aug 2006 22:13:42 -0700 (PDT) Subject: [Box Backup-dev] [Off Topic] Linux C/C++/Tcl project Message-ID: <20060825051342.59597.qmail@web60615.mail.yahoo.com> Hi all, Sorry, not sure if this is appropriate, but perhaps someone on the list would find this project useful. It's from a German company with an office in my town; they have a customer in a town nearby here (Massachusetts, USA) that needs the programming. Snips from emails below. Let me know if you're interested and I'll put you in touch. Pete ================= They claim to be looking for an advanced C/C++ programmer who has a lot of development experience under Linux. They also have a bit of Tcl (via C/C++) programming to be done as well. If you know of someone that might be a fit, we'd appreciate putting them in touch directly with our customer (in Beverly, Massachusetts USA). It sounds like this is on the order of magnitude of days to weeks of consulting, but I'm not 100% sure of that. > A client of ours is looking for some Linux talent, ideally with some > prior experience in the vision world too, but I suspect if push comes > to shove its programming/Linux they need and one can learn the rest? > It would be using http://www.alliedvisiontec.com/produktinfos.html?t=produktinfos&o=9&a=selectid and http://www.alliedvisiontec.com/actiondownload.html?t=downloads&a=subnav to help control http://www.alliedvisiontec.com/produktinfos.html?t=produktinfos&o=58&a=selectid From boxbackup-dev at fluffy.co.uk Fri Aug 25 09:34:32 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Fri, 25 Aug 2006 09:34:32 +0100 Subject: [Box Backup-dev] Merges In-Reply-To: <8BACB4F6-E94A-491C-BCBA-0ADDEC4C3710@fluffy.co.uk> References: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> <1156025939.17028.50.camel@avenin.ebourne.me.uk> <1156065492.17028.63.camel@avenin.ebourne.me.uk> <1156113491.18437.12.camel@avenin.ebourne.me.uk> <8BACB4F6-E94A-491C-BCBA-0ADDEC4C3710@fluffy.co.uk> Message-ID: <1156494872.2742.16.camel@avenin.ebourne.me.uk> On Tue, 2006-08-22 at 20:18 +0100, Ben Summers wrote: > These repeated exception handlers are getting a bit messy. Perhaps > there's some way to make things easier? Perhaps an error reporting > function which takes an std::exception? Unfortunately I don't think there's a really good solution for this one. The most common way round this is to use macros, but macros are nasty so I'd only use them as a last resort. Can work quite well though if you're prepared to put up with the pain. An exception handler function as you suggest could be written, but it can only handle one class of exceptions at a time. ie. You'd need one for std::exceptions, one for unknown exceptions, more for any other kinds. Hence you still end up with the same number of catch blocks, they just become smaller (maybe). A third route would be to use a method caller which provides the exception wrapping. This would be a template function to which you passed a functor or method pointer etc. It would then call the underlying function wrapped in a try catch and do the error handling. For the simple case this provides the cleanest code, but of course the called function doesn't get any access to local variables. You can arrange to have them passed in (by reference if needed) so this can be simulated, and of course the method still has access to the object it is called on. But depending on the code this can break up the flow. Options 2 & 3 also loose the location held in __FILE__ and __LINE__ which is sometimes useful when reporting where errors are caught, although again that could be passed in if required. The end result gets a bit messier though. I was going to use option (3) for a program I worked on earlier on this year but ultimately didn't due to the __FILE__ problem. I settled on copy and paste in the end :-( and this with about 8 catch blocks in each case, in about 6 different places. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Sun Aug 27 22:35:51 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 27 Aug 2006 22:35:51 +0100 Subject: [Box Backup-dev] COMMIT r813 - box/chris/general/lib/win32 Message-ID: Author: chris Date: 2006-08-27 22:35:50 +0100 (Sun, 27 Aug 2006) New Revision: 813 Modified: box/chris/general/lib/win32/emu.cpp Log: * lib/win32/emu.cpp - Added more friendly error messages for cases pointed out by Pete Jalajas Modified: box/chris/general/lib/win32/emu.cpp =================================================================== --- box/chris/general/lib/win32/emu.cpp 2006-08-22 21:43:22 UTC (rev 812) +++ box/chris/general/lib/win32/emu.cpp 2006-08-27 21:35:50 UTC (rev 813) @@ -551,8 +551,16 @@ if (hdir == INVALID_HANDLE_VALUE) { - ::syslog(LOG_WARNING, "Failed to open file %s: " - "error %i", pFileName, GetLastError()); + if (GetLastError() = ERROR_INVALID_NAME) + { + ::syslog(LOG_WARNING, "Failed to open file '%s': " + "invalid file name", pFileName); + } + else + { + ::syslog(LOG_WARNING, "Failed to open file '%s': " + "error %i", pFileName, GetLastError()); + } return INVALID_HANDLE_VALUE; } @@ -726,8 +734,16 @@ } else { - ::syslog(LOG_WARNING, - "Failed to open '%s': error %d", pFileName, err); + if (err == ERROR_ACCESS_DENIED) + { + ::syslog(LOG_WARNING, "Failed to open '%s': " + "access denied", pFileName); + } + else + { + ::syslog(LOG_WARNING, "Failed to open '%s': " + "error %d", pFileName, err); + } errno = EACCES; } From boxbackup-dev at fluffy.co.uk Sun Aug 27 22:36:35 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Sun, 27 Aug 2006 22:36:35 +0100 Subject: [Box Backup-dev] COMMIT r814 - box/chris/general/test/bbackupd Message-ID: Author: chris Date: 2006-08-27 22:36:35 +0100 (Sun, 27 Aug 2006) New Revision: 814 Modified: box/chris/general/test/bbackupd/testbbackupd.cpp Log: * test/bbackupd/testbbackupd.cpp - Fixed typo Modified: box/chris/general/test/bbackupd/testbbackupd.cpp =================================================================== --- box/chris/general/test/bbackupd/testbbackupd.cpp 2006-08-27 21:35:50 UTC (rev 813) +++ box/chris/general/test/bbackupd/testbbackupd.cpp 2006-08-27 21:36:35 UTC (rev 814) @@ -783,7 +783,7 @@ // Update a file (will be uploaded as a diff) { - // Check that the file is over the diffing threshold in the bbstored.conf file + // Check that the file is over the diffing threshold in the bbackupd.conf file TEST_THAT(TestGetFileSize("testfiles/TestDir1/f45.df") > 1024); // Add a bit to the end @@ -1601,4 +1601,3 @@ return 0; } - From boxbackup-dev at fluffy.co.uk Tue Aug 29 18:31:09 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Tue, 29 Aug 2006 18:31:09 +0100 (BST) Subject: [Box Backup-dev] Merges In-Reply-To: <1156494872.2742.16.camel@avenin.ebourne.me.uk> References: <20060809172750.BB8F296@s0g0.pems.testserver.co.uk> <1156025939.17028.50.camel@avenin.ebourne.me.uk> <1156065492.17028.63.camel@avenin.ebourne.me.uk> <1156113491.18437.12.camel@avenin.ebourne.me.uk> <8BACB4F6-E94A-491C-BCBA-0ADDEC4C3710@fluffy.co.uk> <1156494872.2742.16.camel@avenin.ebourne.me.uk> Message-ID: Hi Ben, On Fri, 25 Aug 2006, Martin Ebourne wrote: > On Tue, 2006-08-22 at 20:18 +0100, Ben Summers wrote: >> These repeated exception handlers are getting a bit messy. Perhaps >> there's some way to make things easier? Perhaps an error reporting >> function which takes an std::exception? > > Unfortunately I don't think there's a really good solution for this one. [...] > I was going to use option (3) for a program I worked on earlier on this > year but ultimately didn't due to the __FILE__ problem. I settled on > copy and paste in the end :-( and this with about 8 catch blocks in each > case, in about 6 different places. Are you happy to merge this patch? Otherwise, which option would you prefer, or can you suggest something else? Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Tue Aug 29 20:08:57 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Tue, 29 Aug 2006 20:08:57 +0100 (BST) Subject: [Box Backup-dev] Client bug when store full? Message-ID: Hi all, While writing unit tests for Boxi, I think I spotted a strange behaviour in Box Backup that seems like it might be a bug. I'd be interested to know what you think. When the client is started and the store is already full, the client does not create BackupClientDirectoryRecords for any subdirectories, or try to sync them. While I can understand that we don't want to upload any files in this state, it does mean that the client user cannot fix the problem by himself by excluding some files from the backup (unless they are in the root of the location). Because the directories are not synced, the newly excluded files are not marked as deleted on the server. I applied this patch to my copy in Boxi: svn diff -r 368:369 https://svn.sourceforge.net/svnroot/boxi/trunk/boxi/boxbackup/bin/bbackupd/BackupClientDirectoryRecord.cpp and it does seem to fix the problem for me. Can anyone see any problems with this patch? If not, can I merge it to the trunk? Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Tue Aug 29 20:13:29 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Tue, 29 Aug 2006 20:13:29 +0100 (BST) Subject: [Box Backup-dev] Access Denied common exception Message-ID: Hi all, I'd like to add a new common exception type to Box Backup. When file permissions stop a file or directory from being opened, the Common OSFileOpenError exception is thrown. In my opinion, this is not detailed enough to help the user to diagnose the problem. I applied this patch to Boxi's copy of Box Backup: svn diff -r 379:383 https://svn.sourceforge.net/svnroot/boxi/trunk/boxi/boxbackup/lib/common and also a separate patch to do the same thing for opendir() in bin/bbackupd/BackupClientDirectoryRecord.cpp, but I have not yet split that patch out from the other changes I've made to my copy of BackupClientDirectoryRecord. Are there any objections to doing this? Could it be merged into the trunk? If so, I'll split out the opendir() changes as well and put everything into the merge branch for review. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Tue Aug 29 20:17:18 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Tue, 29 Aug 2006 20:17:18 +0100 (BST) Subject: [Box Backup-dev] Duplicate local variables Message-ID: Hi Martin, This patch removes an unnecessary duplicate local variable. Please review for merge. svn diff -r 372:373 https://svn.sourceforge.net/svnroot/boxi/trunk/boxi/boxbackup/lib/backupstore/BackupStoreCheck.cpp Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Tue Aug 29 23:13:56 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Tue, 29 Aug 2006 23:13:56 +0100 Subject: [Box Backup-dev] Duplicate local variables In-Reply-To: References: Message-ID: <1156889636.11960.11.camel@avenin.ebourne.me.uk> On Tue, 2006-08-29 at 20:17 +0100, Chris Wilson wrote: > Hi Martin, > > This patch removes an unnecessary duplicate local variable. Please review > for merge. > > svn diff -r 372:373 > https://svn.sourceforge.net/svnroot/boxi/trunk/boxi/boxbackup/lib/backupstore/BackupStoreCheck.cpp Looks ok, but in future please propose merges from the main box repository since I've already got that checked out and it makes it a lot easier. Also trac has a very nice way of viewing changeset diffs eg. http://bbdev.fluffy.co.uk/trac/changeset/792 and you can jump off there to the files etc very easily. Can even review changes with just a webbrowser if there's no shell or svn access. I've been wondering if it would be a good idea to open a trac task for merging the windows changes back. It would be a place to, well, keep track of things! As it stands I'm concerned about missing stuff in email. How I think it would work is you add a comment to the task to say which revisions you want to merge, then I or someone else can review them and ack any which are good as is in another comment. If there are any which need work instead I'd follow up to the mailing list because that's a much better place to do discussions. What do you think? The idea is if it's just requests and acks it would have no noise and at a glance anyone would see what was outstanding. At the moment I'm not sure if I'm up to date with all your requests, I'm guessing I am since you haven't reminded me. :) Cheers, Martin. PS. I'm on holiday next week so won't be getting much done for a week. From boxbackup-dev at fluffy.co.uk Wed Aug 30 09:47:18 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 08:47:18 -0000 Subject: [Box Backup-dev] =?utf-8?q?=233=3A_Merge_Win32_branch?= Message-ID: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> --===============0806051959== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0r LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KIFJlcG9ydGVyOiAg Y2hyaXMgICAgICAgICAgICAgICB8ICAgICAgIE93bmVyOiAgYmVuICANCiAgICAgVHlwZTogIGRl ZmVjdCAgICAgICAgICAgICAgfCAgICAgIFN0YXR1czogIG5ldyAgDQogUHJpb3JpdHk6ICBub3Jt YWwgICAgICAgICAgICAgIHwgICBNaWxlc3RvbmU6ICAwLjExIA0KQ29tcG9uZW50OiAgYmJhY2t1 cGQgICAgICAgICAgICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsNCiBLZXl3b3JkczogIHdpbjMyIG1l cmdlIGJyYW5jaCAgfCAgDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSstLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQogVGhlIGNoYW5nZXMgZnJvbSB0 aGUNCiBbaHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL2Jyb3dzZXIvYm94L2NocmlzL2dl bmVyYWwgR2VuZXJhbF0gYnJhbmNoDQogbmVlZCB0byBiZSBtZXJnZWQgaW50byB0cnVuaywgb3Ig cmVqZWN0ZWQuDQoNCiBNZXJnZSB2aWEgdGhlIFtodHRwOi8vYmJkZXYuZmx1ZmZ5LmNvLnVrL3Ry YWMvYnJvd3Nlci9ib3gvY2hyaXMvbWVyZ2UNCiBNZXJnZV0gYnJhbmNoIGZvciByZXZpZXcgYW5k IHRlc3RpbmcuDQoNCi0tIA0KVGlja2V0IFVSTDogPGh0dHA6Ly9iYmRldi5mbHVmZnkuY28udWsv dHJhYy90aWNrZXQvMz4NCkJveCBCYWNrdXAgPGh0dHA6Ly93d3cuZmx1ZmZ5LmNvLnVrL2JveGJh Y2t1cC8+DQpBbiBvcGVuIHNvdXJjZSwgY29tcGxldGVseSBhdXRvbWF0aWMgb24tbGluZSBiYWNr dXAgc3lzdGVtIGZvciBVTklYLg== --===============0806051959==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 09:53:55 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 09:53:55 +0100 Subject: [Box Backup-dev] COMMIT r815 - in box/chris/merge: . bin/bbackupd infrastructure Message-ID: Author: chris Date: 2006-08-30 09:53:55 +0100 (Wed, 30 Aug 2006) New Revision: 815 Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp box/chris/merge/infrastructure/BoxPlatform.pm.in box/chris/merge/win32.bat Log: * infrastructure/BoxPlatform.pm.in * win32.bat * bin/bbackupd/BackupClientDirectoryRecord.cpp - Merged back changes from trunk Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-27 21:36:35 UTC (rev 814) +++ box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-30 08:53:55 UTC (rev 815) @@ -97,6 +97,33 @@ // -------------------------------------------------------------------------- // // Function +// Name: MakeFullPath(const std::string& rDir, const std::string& rFile) +// Purpose: Combine directory and file name +// Created: 2006/08/10 +// +// -------------------------------------------------------------------------- +static std::string MakeFullPath(const std::string& rDir, + const std::string& rFile) +{ + std::string result; + + if (rDir.size() > 0 && + rDir[rDir.size()-1] == DIRECTORY_SEPARATOR_ASCHAR) + { + result = rDir + rFile; + } + else + { + result = rDir + DIRECTORY_SEPARATOR + rFile; + } + + return result; +} + + +// -------------------------------------------------------------------------- +// +// Function // Name: BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::SyncParams &, int64_t, const std::string &, bool) // Purpose: Syncronise, recusively, a local directory with the server. // Created: 2003/10/08 @@ -207,8 +234,7 @@ } // Stat file to get info - filename = rLocalPath + DIRECTORY_SEPARATOR + - en->d_name; + filename = MakeFullPath(rLocalPath, en->d_name); if(::lstat(filename.c_str(), &st) != 0) { @@ -512,7 +538,7 @@ f != rFiles.end(); ++f) { // Filename of this file - std::string filename(rLocalPath + DIRECTORY_SEPARATOR + *f); + std::string filename(MakeFullPath(rLocalPath, *f)); // Get relevant info about file box_time_t modTime = 0; @@ -859,7 +885,7 @@ d != rDirs.end(); ++d) { // Get the local filename - std::string dirname(rLocalPath + DIRECTORY_SEPARATOR + *d); + std::string dirname(MakeFullPath(rLocalPath, *d)); // See if it's in the listing (if we have one) BackupStoreFilenameClear storeFilename(*d); @@ -1063,10 +1089,13 @@ BackupClientDirectoryRecord *rec = e->second; mSubDirectories.erase(e); delete rec; - TRACE2("Deleted directory record for " - "%s" DIRECTORY_SEPARATOR "%s\n", - rLocalPath.c_str(), - dirname.GetClearFilename().c_str()); + + std::string name = MakeFullPath( + rLocalPath, + dirname.GetClearFilename()); + + TRACE1("Deleted directory record for " + "%s\n", name.c_str()); } } } Modified: box/chris/merge/infrastructure/BoxPlatform.pm.in =================================================================== --- box/chris/merge/infrastructure/BoxPlatform.pm.in 2006-08-27 21:36:35 UTC (rev 814) +++ box/chris/merge/infrastructure/BoxPlatform.pm.in 2006-08-30 08:53:55 UTC (rev 815) @@ -1,7 +1,7 @@ package BoxPlatform; use Exporter; @ISA = qw/Exporter/; - at EXPORT = qw/$build_os $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 update_if_changed/; + at EXPORT = qw/$build_os $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 { @@ -24,7 +24,6 @@ # Cygwin Builds usually something like CYGWIN_NT-5.0, CYGWIN_NT-5.1 # Box Backup tried on Win2000,XP only :) - $build_os = 'CYGWIN' if $build_os =~ m/CYGWIN/; $make_command = ($build_os eq 'Darwin') ? 'bsdmake' : ($build_os eq 'SunOS') ? 'gmake' : 'make'; @@ -107,34 +106,5 @@ return $_[0].'=1'; } -sub update_if_changed ($) -{ - my ($file) = @_; - die "$file.new: not found" unless -r "$file.new"; - - if (-r $file) - { - die "$file.new: not found" unless -r "$file.new"; - if (system("diff --brief $file $file.new") == 0) - { - unlink "$file.new"; - return; - } - } - - if (system("cp $file.new $file") != 0) - { - die "failed to copy $file.new to $file"; - } - - if (system("diff --brief $file $file.new") != 0) - { - die "$file and $file.new are still different"; - } - - unlink "$file.new"; - return; -} - 1; Modified: box/chris/merge/win32.bat =================================================================== --- box/chris/merge/win32.bat 2006-08-27 21:36:35 UTC (rev 814) +++ box/chris/merge/win32.bat 2006-08-30 08:53:55 UTC (rev 815) @@ -5,26 +5,27 @@ copy .\infrastructure\BoxPlatform.pm.in .\infrastructure\BoxPlatform.pm -cd .\bin\bbackupquery\ & perl ./../../bin/bbackupquery/makedocumentation.pl +cd .\bin\bbackupquery\ & perl ./../../bin/bbackupquery/makedocumentation.pl.in cd ..\..\ -cd .\lib\backupclient & perl ./../../lib/common/makeexception.pl BackupStoreException.txt -perl ./../../lib/server/makeprotocol.pl Client ./../../bin/bbstored/backupprotocol.txt +cd .\lib\backupclient & perl ./../../lib/common/makeexception.pl.in BackupStoreException.txt & perl ./../../lib/server/makeprotocol.pl.in Client ./../../bin/bbstored/backupprotocol.txt cd ..\..\ -cd .\lib\compress & perl ./../../lib/common/makeexception.pl CompressException.txt +cd .\lib\compress & perl ./../../lib/common/makeexception.pl.in CompressException.txt cd ..\..\ -cd .\lib\common & perl ./../../lib/common/makeexception.pl CommonException.txt & perl ./../../lib/common/makeexception.pl ConversionException.txt +cd .\lib\common & perl ./../../lib/common/makeexception.pl.in CommonException.txt & perl ./../../lib/common/makeexception.pl.in ConversionException.txt cd ..\..\ -cd .\lib\crypto & perl ./../../lib/common/makeexception.pl CipherException.txt +cd .\lib\crypto & perl ./../../lib/common/makeexception.pl.in CipherException.txt cd ..\..\ echo server parts - which appears as though some of the clients rely on -cd .\lib\server & perl ./../../lib/common/makeexception.pl ServerException.txt & perl ./../../lib/common/makeexception.pl ConnectionException.txt +cd .\lib\server & perl ./../../lib/common/makeexception.pl.in ServerException.txt & perl ./../../lib/common/makeexception.pl.in ConnectionException.txt cd ..\..\ -perl -i.orig -pe 's/@PERL@/perl/' ./test/bbackupd/testfiles/bbackupd.conf +copy lib\win32\config.h.win32 lib\common\BoxConfig.h + +perl -pe 's/@PERL@/perl/' ./test/bbackupd/testfiles/bbackupd.conf.in > .\test\bbackupd\testfiles\bbackupd.conf From boxbackup-dev at fluffy.co.uk Wed Aug 30 12:03:48 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 11:03:48 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.64320fcd472b3992005f4c66630a3ed4@fluffy.co.uk> --===============1307881954== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNoYW5nZXMgKGJ5IG1hcnRpbik6DQoNCiAgKiBvd25lcjogIGJl biA9PiBjaHJpcw0KICAqIHR5cGU6ICBkZWZlY3QgPT4gdGFzaw0KDQotLSANClRpY2tldCBVUkw6 IDxodHRwOi8vYmJkZXYuZmx1ZmZ5LmNvLnVrL3RyYWMvdGlja2V0LzM+DQpCb3ggQmFja3VwIDxo dHRwOi8vd3d3LmZsdWZmeS5jby51ay9ib3hiYWNrdXAvPg0KQW4gb3BlbiBzb3VyY2UsIGNvbXBs ZXRlbHkgYXV0b21hdGljIG9uLWxpbmUgYmFja3VwIHN5c3RlbSBmb3IgVU5JWC4= --===============1307881954==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 14:46:28 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 14:46:28 +0100 Subject: [Box Backup-dev] COMMIT r816 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2006-08-30 14:46:28 +0100 (Wed, 30 Aug 2006) New Revision: 816 Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: * bin/bbackupd/BackupClientDirectoryRecord.cpp Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-30 08:53:55 UTC (rev 815) +++ box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-30 13:46:28 UTC (rev 816) @@ -674,73 +674,32 @@ // modification time within sync period // if it's been seen before but not uploaded, is the time from this first sight longer than the MaxUploadWait // and if we know about it from a directory listing, that it hasn't got the same upload time as on the store + if( + ( + // Check the file modified within the acceptable time period we're checking + // If the file isn't on the server, the acceptable time starts at zero. + // Check pDirOnStore and en, because if we didn't download a directory listing, + // pDirOnStore will be zero, but we know it's on the server. + ( ((pDirOnStore != 0 && en == 0) || (modTime >= rParams.mSyncPeriodStart)) && modTime < rParams.mSyncPeriodEnd) - bool doUpload = false; + // However, just in case things are continually modified, we check the first seen time. + // The two compares of syncPeriodEnd and pendingFirstSeenTime are because the values are unsigned. + || (pendingFirstSeenTime != 0 && + (rParams.mSyncPeriodEnd > pendingFirstSeenTime) + && ((rParams.mSyncPeriodEnd - pendingFirstSeenTime) > rParams.mMaxUploadWait)) - // Only upload a file if the mod time locally is - // different to that on the server. - - if (en == 0 || en->GetModificationTime() != modTime) + // Then make sure that if files are added with a time less than the sync period start + // (which can easily happen on file server), it gets uploaded. The directory contents checksum + // will pick up the fact it has been added, so the store listing will be available when this happens. + || ((modTime <= rParams.mSyncPeriodStart) && (en != 0) && (en->GetModificationTime() != modTime)) + + // And just to catch really badly off clocks in the future for file server clients, + // just upload the file if it's madly in the future. + || (modTime > rParams.mUploadAfterThisTimeInTheFuture) + ) + // But even then, only upload it if the mod time locally is different to that on the server. + && (en == 0 || en->GetModificationTime() != modTime)) { - // Check the file modified within the acceptable time period we're checking - // If the file isn't on the server, the acceptable time starts at zero. - // Check pDirOnStore and en, because if we didn't download a directory listing, - // pDirOnStore will be zero, but we know it's on the server. - if (modTime < rParams.mSyncPeriodEnd) - { - if (pDirOnStore != 0 && en == 0) - { - doUpload = true; - } - else if (modTime >= rParams.mSyncPeriodStart) - { - doUpload = true; - } - } - - // However, just in case things are continually - // modified, we check the first seen time. - // The two compares of syncPeriodEnd and - // pendingFirstSeenTime are because the values - // are unsigned. - - if (!doUpload && - pendingFirstSeenTime != 0 && - rParams.mSyncPeriodEnd > pendingFirstSeenTime && - (rParams.mSyncPeriodEnd - pendingFirstSeenTime) - > rParams.mMaxUploadWait) - { - doUpload = true; - } - - // Then make sure that if files are added with a - // time less than the sync period start - // (which can easily happen on file server), it - // gets uploaded. The directory contents checksum - // will pick up the fact it has been added, so the - // store listing will be available when this happens. - - if (!doUpload && - modTime <= rParams.mSyncPeriodStart && - en != 0 && - en->GetModificationTime() != modTime) - { - doUpload = true; - } - - // And just to catch really badly off clocks in - // the future for file server clients, - // just upload the file if it's madly in the future. - - if (!doUpload && modTime > - rParams.mUploadAfterThisTimeInTheFuture) - { - doUpload = true; - } - } - - if (doUpload) - { // Make sure we're connected -- must connect here so we know whether // the storage limit has been exceeded, and hence whether or not // to actually upload the file. From boxbackup-dev at fluffy.co.uk Wed Aug 30 14:47:35 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 14:47:35 +0100 Subject: [Box Backup-dev] COMMIT r817 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2006-08-30 14:47:35 +0100 (Wed, 30 Aug 2006) New Revision: 817 Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: * bin/bbackupd/BackupClientDirectoryRecord.cpp - Restructured the backup decision logic to make it easier to understand and debug Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-30 13:46:28 UTC (rev 816) +++ box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-30 13:47:35 UTC (rev 817) @@ -674,32 +674,73 @@ // modification time within sync period // if it's been seen before but not uploaded, is the time from this first sight longer than the MaxUploadWait // and if we know about it from a directory listing, that it hasn't got the same upload time as on the store - if( - ( - // Check the file modified within the acceptable time period we're checking - // If the file isn't on the server, the acceptable time starts at zero. - // Check pDirOnStore and en, because if we didn't download a directory listing, - // pDirOnStore will be zero, but we know it's on the server. - ( ((pDirOnStore != 0 && en == 0) || (modTime >= rParams.mSyncPeriodStart)) && modTime < rParams.mSyncPeriodEnd) - // However, just in case things are continually modified, we check the first seen time. - // The two compares of syncPeriodEnd and pendingFirstSeenTime are because the values are unsigned. - || (pendingFirstSeenTime != 0 && - (rParams.mSyncPeriodEnd > pendingFirstSeenTime) - && ((rParams.mSyncPeriodEnd - pendingFirstSeenTime) > rParams.mMaxUploadWait)) + bool doUpload = false; - // Then make sure that if files are added with a time less than the sync period start - // (which can easily happen on file server), it gets uploaded. The directory contents checksum - // will pick up the fact it has been added, so the store listing will be available when this happens. - || ((modTime <= rParams.mSyncPeriodStart) && (en != 0) && (en->GetModificationTime() != modTime)) - - // And just to catch really badly off clocks in the future for file server clients, - // just upload the file if it's madly in the future. - || (modTime > rParams.mUploadAfterThisTimeInTheFuture) - ) - // But even then, only upload it if the mod time locally is different to that on the server. - && (en == 0 || en->GetModificationTime() != modTime)) + // Only upload a file if the mod time locally is + // different to that on the server. + + if (en == 0 || en->GetModificationTime() != modTime) { + // Check the file modified within the acceptable time period we're checking + // If the file isn't on the server, the acceptable time starts at zero. + // Check pDirOnStore and en, because if we didn't download a directory listing, + // pDirOnStore will be zero, but we know it's on the server. + if (modTime < rParams.mSyncPeriodEnd) + { + if (pDirOnStore != 0 && en == 0) + { + doUpload = true; + } + else if (modTime >= rParams.mSyncPeriodStart) + { + doUpload = true; + } + } + + // However, just in case things are continually + // modified, we check the first seen time. + // The two compares of syncPeriodEnd and + // pendingFirstSeenTime are because the values + // are unsigned. + + if (!doUpload && + pendingFirstSeenTime != 0 && + rParams.mSyncPeriodEnd > pendingFirstSeenTime && + (rParams.mSyncPeriodEnd - pendingFirstSeenTime) + > rParams.mMaxUploadWait) + { + doUpload = true; + } + + // Then make sure that if files are added with a + // time less than the sync period start + // (which can easily happen on file server), it + // gets uploaded. The directory contents checksum + // will pick up the fact it has been added, so the + // store listing will be available when this happens. + + if (!doUpload && + modTime <= rParams.mSyncPeriodStart && + en != 0 && + en->GetModificationTime() != modTime) + { + doUpload = true; + } + + // And just to catch really badly off clocks in + // the future for file server clients, + // just upload the file if it's madly in the future. + + if (!doUpload && modTime > + rParams.mUploadAfterThisTimeInTheFuture) + { + doUpload = true; + } + } + + if (doUpload) + { // Make sure we're connected -- must connect here so we know whether // the storage limit has been exceeded, and hence whether or not // to actually upload the file. From boxbackup-dev at fluffy.co.uk Wed Aug 30 14:48:49 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 13:48:49 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.d44466fb447741002d19d2382436070b@fluffy.co.uk> --===============1494239778== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL2NoYW5nZXNldC84MTcNCg0KLS0gDQpUaWNr ZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL3RpY2tldC8zPg0KQm94IEJh Y2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3VwLz4NCkFuIG9wZW4gc291cmNl LCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBzeXN0ZW0gZm9yIFVOSVgu --===============1494239778==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 14:50:57 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 13:50:57 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.ed769b6dc1cfdc706aa9f37715a6e96b@fluffy.co.uk> --===============0279601982== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL2NoYW5nZXNldC84MTQNCg0KLS0gDQpUaWNr ZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL3RpY2tldC8zPg0KQm94IEJh Y2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3VwLz4NCkFuIG9wZW4gc291cmNl LCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBzeXN0ZW0gZm9yIFVOSVgu --===============0279601982==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 14:58:40 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 13:58:40 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.05e530d9b162512a373c658f0ed42bb8@fluffy.co.uk> --===============1507582174== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL2NoYW5nZXNldC83OTgNCg0KLS0gDQpUaWNr ZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL3RpY2tldC8zPg0KQm94IEJh Y2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3VwLz4NCkFuIG9wZW4gc291cmNl LCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBzeXN0ZW0gZm9yIFVOSVgu --===============1507582174==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 14:59:19 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 13:59:19 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.7896154c3a86a7d5ae3cd454ea7752a9@fluffy.co.uk> --===============1761009147== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL2NoYW5nZXNldC83NDkNCg0KLS0gDQpUaWNr ZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL3RpY2tldC8zPg0KQm94IEJh Y2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3VwLz4NCkFuIG9wZW4gc291cmNl LCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBzeXN0ZW0gZm9yIFVOSVgu --===============1761009147==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 15:02:30 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 15:02:30 +0100 Subject: [Box Backup-dev] COMMIT r818 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 15:02:30 +0100 (Wed, 30 Aug 2006) New Revision: 818 Modified: box/chris/merge/bin/bbstored/BackupCommands.cpp Log: * bin/bbstored/BackupCommands.cpp - Revert to trunk Modified: box/chris/merge/bin/bbstored/BackupCommands.cpp =================================================================== --- box/chris/merge/bin/bbstored/BackupCommands.cpp 2006-08-30 13:47:35 UTC (rev 817) +++ box/chris/merge/bin/bbstored/BackupCommands.cpp 2006-08-30 14:02:30 UTC (rev 818) @@ -9,13 +9,8 @@ #include "Box.h" -#ifdef HAVE_SYSLOG_H #include -#endif -#include -#include - #include "autogen_BackupProtocolServer.h" #include "BackupConstants.h" #include "BackupContext.h" @@ -332,15 +327,8 @@ std::auto_ptr diff2(rContext.OpenObject(patchID)); // Choose a temporary filename for the result of the combination -#ifdef WIN32 - std::ostringstream fs(rContext.GetStoreRoot()); - fs << ".recombinetemp."; - fs << p; - std::string tempFn(fs.str()); - tempFn = RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), tempFn, p + 16); -#else - std::string tempFn(RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), rContext.GetStoreRoot() + ".recombinetemp", p + 16 /* rotate which disc it's on */)); -#endif + std::string tempFn(RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), rContext.GetStoreRoot() + ".recombinetemp", + p + 16 /* rotate which disc it's on */)); // Open the temporary file std::auto_ptr combined; @@ -348,23 +336,14 @@ { { // Write nastily to allow this to work with gcc 2.x -#ifdef WIN32 - combined.reset(new FileStream( - tempFn.c_str(), - O_RDWR | O_CREAT | O_EXCL | - O_BINARY | O_TRUNC)); -#else std::auto_ptr t(new FileStream(tempFn.c_str(), O_RDWR | O_CREAT | O_EXCL)); combined = t; -#endif } -#ifndef WIN32 // Unlink immediately as it's a temporary file if(::unlink(tempFn.c_str()) != 0) { THROW_EXCEPTION(CommonException, OSFileError); } -#endif } catch(...) { @@ -380,9 +359,6 @@ combined->Seek(0, IOStream::SeekType_Absolute); // Then shuffle round for the next go -#ifdef WIN32 - if (from.get()) from->Close(); -#endif from = combined; } @@ -420,9 +396,8 @@ stream = t; } - // Object will be deleted when the stream is deleted, - // so can release the object auto_ptr here to avoid - // premature deletion + // Object will be deleted when the stream is deleted, so can release the object auto_ptr here to + // avoid premature deletiong object.release(); } From boxbackup-dev at fluffy.co.uk Wed Aug 30 15:13:21 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Wed, 30 Aug 2006 15:13:21 +0100 Subject: [Box Backup-dev] Tips on using trac comments Message-ID: <20060830151321.492tjpf7k0kko80s@ebourne.me.uk> A couple of useful pointers for people new to trac. Trac has a number of easy ways of cross referencing in messages. It =20 applies to tickets, wiki pages, and svn commit messages. It's well =20 worth taking a look at them here: http://bbdev.fluffy.co.uk/trac/wiki/TracLinks Eg. [791] for a changeset Also if it has been set up you can use svn commit messages to =20 automatically update and possibly close tickets. eg. When a commit =20 fixes a ticket put 'fixes #2' in the commit message. Or if it relates =20 to a ticket but doesn't close it put 'refs #2' instead. The message =20 will then also be written to the ticket. Full documentation on this is =20 at the top of the script that performs it (yeah, I know): http://trac.edgewall.org/browser/trunk/contrib/trac-post-commit-hook That's is presuming it's been setup like so. If not them maybe James =20 could add that one for us because it is very useful and really =20 integrates tickets into svn. More info here: http://trac.edgewall.org/wiki/TracFaq#can-trac-automatically-update-a-ticket= -when-i-commit-a-changeset Cheers, Martin. From boxbackup-dev at fluffy.co.uk Wed Aug 30 15:18:40 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 15:18:40 +0100 Subject: [Box Backup-dev] COMMIT r819 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 15:18:40 +0100 (Wed, 30 Aug 2006) New Revision: 819 Modified: box/chris/merge/bin/bbstored/BackupCommands.cpp Log: * bin/bbstored/BackupCommands.cpp - Can't unlink open files on Win32. This is not the correct fix, but it does work around the problem. - Only include syslog.h if we have it Modified: box/chris/merge/bin/bbstored/BackupCommands.cpp =================================================================== --- box/chris/merge/bin/bbstored/BackupCommands.cpp 2006-08-30 14:02:30 UTC (rev 818) +++ box/chris/merge/bin/bbstored/BackupCommands.cpp 2006-08-30 14:18:40 UTC (rev 819) @@ -9,8 +9,13 @@ #include "Box.h" +#ifdef HAVE_SYSLOG_H #include +#endif +#include +#include + #include "autogen_BackupProtocolServer.h" #include "BackupConstants.h" #include "BackupContext.h" @@ -327,8 +332,15 @@ std::auto_ptr diff2(rContext.OpenObject(patchID)); // Choose a temporary filename for the result of the combination - std::string tempFn(RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), rContext.GetStoreRoot() + ".recombinetemp", - p + 16 /* rotate which disc it's on */)); +#ifdef WIN32 + std::ostringstream fs(rContext.GetStoreRoot()); + fs << ".recombinetemp."; + fs << p; + std::string tempFn(fs.str()); + tempFn = RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), tempFn, p + 16); +#else + std::string tempFn(RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), rContext.GetStoreRoot() + ".recombinetemp", p + 16 /* rotate which disc it's on */)); +#endif // Open the temporary file std::auto_ptr combined; @@ -336,14 +348,23 @@ { { // Write nastily to allow this to work with gcc 2.x +#ifdef WIN32 + combined.reset(new FileStream( + tempFn.c_str(), + O_RDWR | O_CREAT | O_EXCL | + O_BINARY | O_TRUNC)); +#else std::auto_ptr t(new FileStream(tempFn.c_str(), O_RDWR | O_CREAT | O_EXCL)); combined = t; +#endif } +#ifndef WIN32 // Unlink immediately as it's a temporary file if(::unlink(tempFn.c_str()) != 0) { THROW_EXCEPTION(CommonException, OSFileError); } +#endif } catch(...) { @@ -359,6 +380,9 @@ combined->Seek(0, IOStream::SeekType_Absolute); // Then shuffle round for the next go +#ifdef WIN32 + if (from.get()) from->Close(); +#endif from = combined; } @@ -396,8 +420,9 @@ stream = t; } - // Object will be deleted when the stream is deleted, so can release the object auto_ptr here to - // avoid premature deletiong + // Object will be deleted when the stream is deleted, + // so can release the object auto_ptr here to avoid + // premature deletion object.release(); } From boxbackup-dev at fluffy.co.uk Wed Aug 30 15:20:13 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 14:20:13 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.38ace0894a11e19016a579799bab6f6d@fluffy.co.uk> --===============0125342216== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL2NoYW5nZXNldC84MTkNCg0KLS0gDQpUaWNr ZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL3RpY2tldC8zPg0KQm94IEJh Y2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3VwLz4NCkFuIG9wZW4gc291cmNl LCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBzeXN0ZW0gZm9yIFVOSVgu --===============0125342216==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:05:55 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:05:55 +0100 Subject: [Box Backup-dev] COMMIT r820 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2006-08-30 19:05:55 +0100 (Wed, 30 Aug 2006) New Revision: 820 Modified: box/chris/merge/bin/bbackupd/Win32BackupService.h Log: * bin/bbackupd/Win32BackupService.h - Revert to trunk Modified: box/chris/merge/bin/bbackupd/Win32BackupService.h =================================================================== --- box/chris/merge/bin/bbackupd/Win32BackupService.h 2006-08-30 14:18:40 UTC (rev 819) +++ box/chris/merge/bin/bbackupd/Win32BackupService.h 2006-08-30 18:05:55 UTC (rev 820) @@ -12,7 +12,7 @@ class Win32BackupService : public BackupDaemon { public: - DWORD WinService(const char* pConfigFileName); + DWORD WinService(void); }; #endif // WIN32 From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:06:30 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:06:30 +0100 Subject: [Box Backup-dev] COMMIT r821 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2006-08-30 19:06:30 +0100 (Wed, 30 Aug 2006) New Revision: 821 Modified: box/chris/merge/bin/bbackupd/Win32BackupService.h Log: * bin/bbackupd/Win32BackupService.h - Prototype update to match changes to Win32BackupService.cpp Modified: box/chris/merge/bin/bbackupd/Win32BackupService.h =================================================================== --- box/chris/merge/bin/bbackupd/Win32BackupService.h 2006-08-30 18:05:55 UTC (rev 820) +++ box/chris/merge/bin/bbackupd/Win32BackupService.h 2006-08-30 18:06:30 UTC (rev 821) @@ -12,7 +12,7 @@ class Win32BackupService : public BackupDaemon { public: - DWORD WinService(void); + DWORD WinService(const char* pConfigFileName); }; #endif // WIN32 From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:12:38 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 18:12:38 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.3552f78f33a0f232ed21e433222bf6c5@fluffy.co.uk> --===============1494141404== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg WzgyMV0NCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFj L3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3Vw Lz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBz eXN0ZW0gZm9yIFVOSVgu --===============1494141404==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:14:35 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:14:35 +0100 Subject: [Box Backup-dev] COMMIT r822 - box/chris/merge/bin/bbackupquery Message-ID: Author: chris Date: 2006-08-30 19:14:35 +0100 (Wed, 30 Aug 2006) New Revision: 822 Modified: box/chris/merge/bin/bbackupquery/BackupQueries.h Log: * bin/bbackupquery/BackupQueries.h - Revert to trunk Modified: box/chris/merge/bin/bbackupquery/BackupQueries.h =================================================================== --- box/chris/merge/bin/bbackupquery/BackupQueries.h 2006-08-30 18:06:30 UTC (rev 821) +++ box/chris/merge/bin/bbackupquery/BackupQueries.h 2006-08-30 18:14:35 UTC (rev 822) @@ -68,10 +68,8 @@ void DeleteExcludeLists(); bool mQuickCompare; bool mIgnoreExcludes; - bool mIgnoreAttributes; int mDifferences; int mDifferencesExplainedByModTime; - int mUncheckedFiles; int mExcludedDirs; int mExcludedFiles; const ExcludeList *mpExcludeFiles; From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:17:09 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:17:09 +0100 Subject: [Box Backup-dev] COMMIT r823 - box/chris/merge/bin/bbackupquery Message-ID: Author: chris Date: 2006-08-30 19:17:08 +0100 (Wed, 30 Aug 2006) New Revision: 823 Modified: box/chris/merge/bin/bbackupquery/documentation.txt Log: * bin/bbackupquery/documentation.txt - Revert to trunk Modified: box/chris/merge/bin/bbackupquery/documentation.txt =================================================================== --- box/chris/merge/bin/bbackupquery/documentation.txt 2006-08-30 18:14:35 UTC (rev 822) +++ box/chris/merge/bin/bbackupquery/documentation.txt 2006-08-30 18:17:08 UTC (rev 823) @@ -104,7 +104,6 @@ -c -- set return code -q -- quick compare. Only checks file contents against checksums, doesn't do a full download - -A -- ignore attribute differences -E -- ignore exclusion settings Comparing with the root directory is an error, use -a option instead. From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:20:09 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:20:09 +0100 Subject: [Box Backup-dev] COMMIT r824 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 19:20:08 +0100 (Wed, 30 Aug 2006) New Revision: 824 Modified: box/chris/merge/bin/bbstored/BackupContext.cpp Log: * bin/bbstored/BackupContext.cpp - Revert to trunk Modified: box/chris/merge/bin/bbstored/BackupContext.cpp =================================================================== --- box/chris/merge/bin/bbstored/BackupContext.cpp 2006-08-30 18:17:08 UTC (rev 823) +++ box/chris/merge/bin/bbstored/BackupContext.cpp 2006-08-30 18:20:08 UTC (rev 824) @@ -132,7 +132,6 @@ // Request the lock bool gotLock = mWriteLock.TryAndGetLock(writeLockFile.c_str(), 0600 /* restrictive file permissions */); -#ifndef WIN32 if(!gotLock) { // The housekeeping process might have the thing open -- ask it to stop @@ -151,7 +150,6 @@ } while(!gotLock && tries > 0); } -#endif if(gotLock) { @@ -455,21 +453,13 @@ try { // Open it twice -#ifdef WIN32 - FileStream diff(tempFn.c_str(), - O_RDWR | O_CREAT | O_BINARY); - FileStream diff2(tempFn.c_str(), - O_RDWR | O_BINARY); -#else FileStream diff(tempFn.c_str(), O_RDWR | O_CREAT | O_EXCL); FileStream diff2(tempFn.c_str(), O_RDONLY); - - // Unlink it immediately, so it definitely goes away + // Unlink it immediately, so it definately goes away if(::unlink(tempFn.c_str()) != 0) { THROW_EXCEPTION(CommonException, OSFileError); } -#endif // Stream the incoming diff to this temporary file if(!rFile.CopyStreamTo(diff, BACKUP_STORE_TIMEOUT)) @@ -518,14 +508,6 @@ ::unlink(tempFn.c_str()); throw; } - -#ifdef WIN32 - // we can't delete the file while it's open, above - if(::unlink(tempFn.c_str()) != 0) - { - THROW_EXCEPTION(CommonException, OSFileError); - } -#endif } // Get the blocks used From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:24:04 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:24:04 +0100 Subject: [Box Backup-dev] COMMIT r825 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 19:24:04 +0100 (Wed, 30 Aug 2006) New Revision: 825 Modified: box/chris/merge/bin/bbstored/BackupContext.cpp Log: * bin/bbstored/BackupContext.cpp - Removed locking on Win32, there is no housekeeping process to lock against - Open files with O_BINARY on Win32 - Fixed a cosmetic spelling mistake in a comment - Unlink file later on Windows, since we can't do it while it's open Modified: box/chris/merge/bin/bbstored/BackupContext.cpp =================================================================== --- box/chris/merge/bin/bbstored/BackupContext.cpp 2006-08-30 18:20:08 UTC (rev 824) +++ box/chris/merge/bin/bbstored/BackupContext.cpp 2006-08-30 18:24:04 UTC (rev 825) @@ -125,6 +125,7 @@ // -------------------------------------------------------------------------- bool BackupContext::AttemptToGetWriteLock() { +#ifndef WIN32 // Make the filename of the write lock file std::string writeLockFile; StoreStructure::MakeWriteLockFilename(mStoreRoot, mStoreDiscSet, writeLockFile); @@ -150,7 +151,7 @@ } while(!gotLock && tries > 0); } - + if(gotLock) { // Got the lock, mark as not read only @@ -158,6 +159,10 @@ } return gotLock; +#else // WIN32 + // no housekeeping process, we do have the lock + return true; +#endif // !WIN32 } @@ -453,13 +458,21 @@ try { // Open it twice +#ifdef WIN32 + FileStream diff(tempFn.c_str(), + O_RDWR | O_CREAT | O_BINARY); + FileStream diff2(tempFn.c_str(), + O_RDWR | O_BINARY); +#else FileStream diff(tempFn.c_str(), O_RDWR | O_CREAT | O_EXCL); FileStream diff2(tempFn.c_str(), O_RDONLY); - // Unlink it immediately, so it definately goes away + + // Unlink it immediately, so it definitely goes away if(::unlink(tempFn.c_str()) != 0) { THROW_EXCEPTION(CommonException, OSFileError); } +#endif // Stream the incoming diff to this temporary file if(!rFile.CopyStreamTo(diff, BACKUP_STORE_TIMEOUT)) @@ -508,6 +521,14 @@ ::unlink(tempFn.c_str()); throw; } + +#ifdef WIN32 + // we can't delete the file while it's open, above + if(::unlink(tempFn.c_str()) != 0) + { + THROW_EXCEPTION(CommonException, OSFileError); + } +#endif } // Get the blocks used From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:24:21 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 18:24:21 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.96db11c783f7e768e0ad8b497a55b631@fluffy.co.uk> --===============1662664947== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg WzgyNV0NCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFj L3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3Vw Lz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBz eXN0ZW0gZm9yIFVOSVgu --===============1662664947==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:26:11 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:26:11 +0100 Subject: [Box Backup-dev] COMMIT r826 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 19:26:11 +0100 (Wed, 30 Aug 2006) New Revision: 826 Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp Log: * bin/bbstored/BackupStoreDaemon.cpp - Revert to trunk Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp =================================================================== --- box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp 2006-08-30 18:24:04 UTC (rev 825) +++ box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp 2006-08-30 18:26:11 UTC (rev 826) @@ -11,12 +11,9 @@ #include #include +#include #include -#ifdef HAVE_SYSLOG_H -#include -#endif - #include "BackupContext.h" #include "BackupStoreDaemon.h" #include "BackupStoreConfigVerify.h" @@ -42,11 +39,7 @@ mExtendedLogging(false), mHaveForkedHousekeeping(false), mIsHousekeepingProcess(false), -#ifdef WIN32 - mHousekeepingInited(false) -#else mInterProcessComms(mInterProcessCommsSocket) -#endif { } @@ -163,7 +156,6 @@ const Configuration &config(GetConfiguration()); mExtendedLogging = config.GetKeyValueBool("ExtendedLogging"); -#ifndef WIN32 // Fork off housekeeping daemon -- must only do this the first time Run() is called if(!mHaveForkedHousekeeping) { @@ -227,11 +219,9 @@ } else { -#endif // !WIN32 // In server process -- use the base class to do the magic ServerTLS::Run(); -#ifndef WIN32 // Why did it stop? Tell the housekeeping process to do the same if(IsReloadConfigWanted()) { @@ -242,7 +232,6 @@ mInterProcessCommsSocket.Write("t\n", 2); } } -#endif } @@ -308,8 +297,6 @@ // Log the amount of data transferred ::syslog(LOG_INFO, "Connection statistics for %s: " "IN=%lld OUT=%lld TOTAL=%lld\n", commonName, - (long long)s.GetBytesRead(), - (long long)s.GetBytesWritten(), - (long long)s.GetBytesRead() + - (long long)s.GetBytesWritten()); + s.GetBytesRead(), s.GetBytesWritten(), + s.GetBytesRead() + s.GetBytesWritten()); } From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:26:45 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:26:45 +0100 Subject: [Box Backup-dev] COMMIT r827 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 19:26:45 +0100 (Wed, 30 Aug 2006) New Revision: 827 Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp Log: * bin/bbstored/BackupStoreDaemon.cpp - Only include if we have it Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp =================================================================== --- box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp 2006-08-30 18:26:11 UTC (rev 826) +++ box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp 2006-08-30 18:26:45 UTC (rev 827) @@ -11,9 +11,12 @@ #include #include -#include #include +#ifdef HAVE_SYSLOG_H + #include +#endif + #include "BackupContext.h" #include "BackupStoreDaemon.h" #include "BackupStoreConfigVerify.h" From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:27:01 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 18:27:01 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.99a6c76206163c35320ca182805ec69d@fluffy.co.uk> --===============0319841662== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg WzgyN10NCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFj L3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3Vw Lz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBz eXN0ZW0gZm9yIFVOSVgu --===============0319841662==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:28:30 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:28:30 +0100 Subject: [Box Backup-dev] COMMIT r828 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 19:28:29 +0100 (Wed, 30 Aug 2006) New Revision: 828 Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.h Log: * bin/bbstored/BackupStoreDaemon.h - Revert to trunk Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.h =================================================================== --- box/chris/merge/bin/bbstored/BackupStoreDaemon.h 2006-08-30 18:26:45 UTC (rev 827) +++ box/chris/merge/bin/bbstored/BackupStoreDaemon.h 2006-08-30 18:28:29 UTC (rev 828) @@ -38,13 +38,11 @@ BackupStoreDaemon(const BackupStoreDaemon &rToCopy); public: -#ifndef WIN32 // For BackupContext to comminicate with housekeeping process void SendMessageToHousekeepingProcess(const void *Msg, int MsgLen) { mInterProcessCommsSocket.Write(Msg, MsgLen); } -#endif protected: @@ -59,11 +57,9 @@ const ConfigurationVerify *GetConfigVerify() const; -#ifndef WIN32 // Housekeeping functions void HousekeepingProcess(); bool CheckForInterProcessMsg(int AccountNum = 0, int MaximumWaitTime = 0); -#endif void LogConnectionStats(const char *commonName, const SocketStreamTLS &s); @@ -74,17 +70,8 @@ bool mHaveForkedHousekeeping; bool mIsHousekeepingProcess; -#ifdef WIN32 - virtual void OnIdle(); - bool mHousekeepingInited; -#else SocketStream mInterProcessCommsSocket; IOStreamGetLine mInterProcessComms; -#endif - - void HousekeepingInit(); - void RunHousekeepingIfNeeded(); - int64_t mLastHousekeepingRun; }; From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:31:54 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:31:54 +0100 Subject: [Box Backup-dev] COMMIT r829 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 19:31:54 +0100 (Wed, 30 Aug 2006) New Revision: 829 Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp Log: * bin/bbstored/BackupStoreDaemon.cpp - Cast off_t to long long, in case they differ in size (e.g. Win32) Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp =================================================================== --- box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp 2006-08-30 18:28:29 UTC (rev 828) +++ box/chris/merge/bin/bbstored/BackupStoreDaemon.cpp 2006-08-30 18:31:54 UTC (rev 829) @@ -300,6 +300,8 @@ // Log the amount of data transferred ::syslog(LOG_INFO, "Connection statistics for %s: " "IN=%lld OUT=%lld TOTAL=%lld\n", commonName, - s.GetBytesRead(), s.GetBytesWritten(), - s.GetBytesRead() + s.GetBytesWritten()); + (long long)s.GetBytesRead(), + (long long)s.GetBytesWritten(), + (long long)s.GetBytesRead() + + (long long)s.GetBytesWritten()); } From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:32:07 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 18:32:07 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.7ac70a145dae71e879a591e8ff6b9227@fluffy.co.uk> --===============1766087447== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg WzgyOV0NCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFj L3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3Vw Lz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBz eXN0ZW0gZm9yIFVOSVgu --===============1766087447==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:37:38 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:37:38 +0100 Subject: [Box Backup-dev] COMMIT r830 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 19:37:38 +0100 (Wed, 30 Aug 2006) New Revision: 830 Modified: box/chris/merge/bin/bbstored/BBStoreDHousekeeping.cpp Log: * bin/bbstored/BBStoreDHousekeeping.cpp - Revert to trunk Modified: box/chris/merge/bin/bbstored/BBStoreDHousekeeping.cpp =================================================================== --- box/chris/merge/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-30 18:31:54 UTC (rev 829) +++ box/chris/merge/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-30 18:37:38 UTC (rev 830) @@ -10,10 +10,7 @@ #include "Box.h" #include - -#ifdef HAVE_SYSLOG_H #include -#endif #include "BackupStoreDaemon.h" #include "BackupStoreAccountDatabase.h" @@ -32,129 +29,96 @@ // Created: 11/12/03 // // -------------------------------------------------------------------------- -void BackupStoreDaemon::HousekeepingInit() -{ - - mLastHousekeepingRun = 0; -} - -#ifndef WIN32 void BackupStoreDaemon::HousekeepingProcess() { - HousekeepingInit(); - // Get the time between housekeeping runs const Configuration &rconfig(GetConfiguration()); int64_t housekeepingInterval = SecondsToBoxTime(rconfig.GetKeyValueInt("TimeBetweenHousekeeping")); + + int64_t lastHousekeepingRun = 0; while(!StopRun()) { - RunHousekeepingIfNeeded(); - - // Calculate how long should wait before doing the next housekeeping run + // Time now int64_t timeNow = GetCurrentBoxTime(); - time_t secondsToGo = BoxTimeToSeconds((mLastHousekeepingRun + housekeepingInterval) - timeNow); - if(secondsToGo < 1) secondsToGo = 1; - if(secondsToGo > 60) secondsToGo = 60; - int32_t millisecondsToGo = ((int)secondsToGo) * 1000; - - // Check to see if there's any message pending - CheckForInterProcessMsg(0 /* no account */, millisecondsToGo); - } -} -#endif + // Do housekeeping if the time interval has elapsed since the last check + if((timeNow - lastHousekeepingRun) >= housekeepingInterval) + { + // Store the time + lastHousekeepingRun = timeNow; + ::syslog(LOG_INFO, "Starting housekeeping"); -void BackupStoreDaemon::RunHousekeepingIfNeeded() -{ - // Get the time between housekeeping runs - const Configuration &rconfig(GetConfiguration()); - int64_t housekeepingInterval = SecondsToBoxTime(rconfig.GetKeyValueInt("TimeBetweenHousekeeping")); - - // Time now - int64_t timeNow = GetCurrentBoxTime(); - // Do housekeeping if the time interval has elapsed since the last check - if((timeNow - mLastHousekeepingRun) < housekeepingInterval) - { - return; - } - - // Store the time - mLastHousekeepingRun = timeNow; - ::syslog(LOG_INFO, "Starting housekeeping"); - - // Get the list of accounts - std::vector accounts; - if(mpAccountDatabase) - { - mpAccountDatabase->GetAllAccountIDs(accounts); - } + // Get the list of accounts + std::vector accounts; + if(mpAccountDatabase) + { + mpAccountDatabase->GetAllAccountIDs(accounts); + } - SetProcessTitle("housekeeping, active"); + SetProcessTitle("housekeeping, active"); - // Check them all - for(std::vector::const_iterator i = accounts.begin(); i != accounts.end(); ++i) - { - try - { - if(mpAccounts) + // Check them all + for(std::vector::const_iterator i = accounts.begin(); i != accounts.end(); ++i) { - // Get the account root - std::string rootDir; - int discSet = 0; - mpAccounts->GetAccountRoot(*i, rootDir, discSet); + try + { + if(mpAccounts) + { + // Get the account root + std::string rootDir; + int discSet = 0; + mpAccounts->GetAccountRoot(*i, rootDir, discSet); + + // Do housekeeping on this account + HousekeepStoreAccount housekeeping(*i, rootDir, discSet, *this); + housekeeping.DoHousekeeping(); + } + } + catch(BoxException &e) + { + ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s (%d/%d) -- aborting housekeeping run for this account", + *i, e.what(), e.GetType(), e.GetSubType()); + } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s -- aborting housekeeping run for this account", + *i, e.what()); + } + catch(...) + { + ::syslog(LOG_ERR, "while housekeeping account %08X, unknown exception -- aborting housekeeping run for this account", + *i); + } - // Do housekeeping on this account - HousekeepStoreAccount housekeeping(*i, rootDir, discSet, *this); - housekeeping.DoHousekeeping(); + // Check to see if there's any message pending + CheckForInterProcessMsg(0 /* no account */); + + // Stop early? + if(StopRun()) + { + break; + } } + + ::syslog(LOG_INFO, "Finished housekeeping"); } - catch(BoxException &e) - { - ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s (%d/%d) -- aborting housekeeping run for this account", - *i, e.what(), e.GetType(), e.GetSubType()); - } - catch(std::exception &e) - { - ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s -- aborting housekeeping run for this account", - *i, e.what()); - } - catch(...) - { - ::syslog(LOG_ERR, "while housekeeping account %08X, unknown exception -- aborting housekeeping run for this account", - *i); - } + + // Placed here for accuracy, if StopRun() is true, for example. + SetProcessTitle("housekeeping, idle"); + + // Calculate how long should wait before doing the next housekeeping run + timeNow = GetCurrentBoxTime(); + time_t secondsToGo = BoxTimeToSeconds((lastHousekeepingRun + housekeepingInterval) - timeNow); + if(secondsToGo < 1) secondsToGo = 1; + if(secondsToGo > 60) secondsToGo = 60; + int32_t millisecondsToGo = ((int)secondsToGo) * 1000; -#ifndef WIN32 // Check to see if there's any message pending - CheckForInterProcessMsg(0 /* no account */); -#endif - - // Stop early? - if(StopRun()) - { - break; - } + CheckForInterProcessMsg(0 /* no account */, millisecondsToGo); } - - ::syslog(LOG_INFO, "Finished housekeeping"); - - // Placed here for accuracy, if StopRun() is true, for example. - SetProcessTitle("housekeeping, idle"); } -#ifdef WIN32 -void BackupStoreDaemon::OnIdle() -{ - if (!mHousekeepingInited) - { - HousekeepingInit(); - mHousekeepingInited = true; - } - RunHousekeepingIfNeeded(); -} -#endif - // -------------------------------------------------------------------------- // // Function @@ -164,7 +128,6 @@ // Created: 11/12/03 // // -------------------------------------------------------------------------- -#ifndef WIN32 bool BackupStoreDaemon::CheckForInterProcessMsg(int AccountNum, int MaximumWaitTime) { // First, check to see if it's EOF -- this means something has gone wrong, and the housekeeping should terminate. @@ -208,6 +171,5 @@ return false; } -#endif From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:52:01 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:52:01 +0100 Subject: [Box Backup-dev] COMMIT r831 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 19:52:01 +0100 (Wed, 30 Aug 2006) New Revision: 831 Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.h Log: * bin/bbstored/BackupStoreDaemon.h - Removed SendMessageToHousekeepingProcess() on Win32, no longer needed Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.h =================================================================== --- box/chris/merge/bin/bbstored/BackupStoreDaemon.h 2006-08-30 18:37:38 UTC (rev 830) +++ box/chris/merge/bin/bbstored/BackupStoreDaemon.h 2006-08-30 18:52:01 UTC (rev 831) @@ -38,11 +38,13 @@ BackupStoreDaemon(const BackupStoreDaemon &rToCopy); public: - // For BackupContext to comminicate with housekeeping process +#ifndef WIN32 + // For BackupContext to communicate with housekeeping process void SendMessageToHousekeepingProcess(const void *Msg, int MsgLen) { mInterProcessCommsSocket.Write(Msg, MsgLen); } +#endif protected: From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:52:14 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 18:52:14 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.c5b62b9482668dfe1259a6efcac87e2e@fluffy.co.uk> --===============0125083451== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg WzgzMV0NCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFj L3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3Vw Lz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBz eXN0ZW0gZm9yIFVOSVgu --===============0125083451==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:54:32 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:54:32 +0100 Subject: [Box Backup-dev] COMMIT r832 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 19:54:31 +0100 (Wed, 30 Aug 2006) New Revision: 832 Modified: box/chris/merge/bin/bbstored/BBStoreDHousekeeping.cpp Log: * bin/bbstored/BBStoreDHousekeeping.cpp - Only include syslog.h if we have one Modified: box/chris/merge/bin/bbstored/BBStoreDHousekeeping.cpp =================================================================== --- box/chris/merge/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-30 18:52:01 UTC (rev 831) +++ box/chris/merge/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-30 18:54:31 UTC (rev 832) @@ -10,8 +10,11 @@ #include "Box.h" #include -#include +#ifdef HAVE_SYSLOG_H + #include +#endif + #include "BackupStoreDaemon.h" #include "BackupStoreAccountDatabase.h" #include "BackupStoreAccounts.h" From boxbackup-dev at fluffy.co.uk Wed Aug 30 19:54:50 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 18:54:50 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.61a5da0085a4851c28f4e15368a924a8@fluffy.co.uk> --===============1076881911== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg ODMyDQoNCi0tIA0KVGlja2V0IFVSTDogPGh0dHA6Ly9iYmRldi5mbHVmZnkuY28udWsvdHJhYy90 aWNrZXQvMz4NCkJveCBCYWNrdXAgPGh0dHA6Ly93d3cuZmx1ZmZ5LmNvLnVrL2JveGJhY2t1cC8+ DQpBbiBvcGVuIHNvdXJjZSwgY29tcGxldGVseSBhdXRvbWF0aWMgb24tbGluZSBiYWNrdXAgc3lz dGVtIGZvciBVTklYLg== --===============1076881911==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 20:01:05 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 20:01:05 +0100 Subject: [Box Backup-dev] COMMIT r833 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 20:01:05 +0100 (Wed, 30 Aug 2006) New Revision: 833 Modified: box/chris/merge/bin/bbstored/BBStoreDHousekeeping.cpp box/chris/merge/bin/bbstored/BackupStoreDaemon.h Log: * bin/bbstored/BackupStoreDaemon.h * bin/bbstored/BBStoreDHousekeeping.cpp - Split housekeeping process into separate initialisation, process loop and run methods (we don't want the process loop on Win32) Modified: box/chris/merge/bin/bbstored/BBStoreDHousekeeping.cpp =================================================================== --- box/chris/merge/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-30 18:54:31 UTC (rev 832) +++ box/chris/merge/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-30 19:01:05 UTC (rev 833) @@ -32,96 +32,122 @@ // Created: 11/12/03 // // -------------------------------------------------------------------------- +void BackupStoreDaemon::HousekeepingInit() +{ + + mLastHousekeepingRun = 0; +} + void BackupStoreDaemon::HousekeepingProcess() { + HousekeepingInit(); + // Get the time between housekeeping runs const Configuration &rconfig(GetConfiguration()); int64_t housekeepingInterval = SecondsToBoxTime(rconfig.GetKeyValueInt("TimeBetweenHousekeeping")); - - int64_t lastHousekeepingRun = 0; while(!StopRun()) { - // Time now + RunHousekeepingIfNeeded(); + + // Calculate how long should wait before doing the next housekeeping run int64_t timeNow = GetCurrentBoxTime(); - // Do housekeeping if the time interval has elapsed since the last check - if((timeNow - lastHousekeepingRun) >= housekeepingInterval) - { - // Store the time - lastHousekeepingRun = timeNow; - ::syslog(LOG_INFO, "Starting housekeeping"); + time_t secondsToGo = BoxTimeToSeconds( + (mLastHousekeepingRun + housekeepingInterval) - + timeNow); + if(secondsToGo < 1) secondsToGo = 1; + if(secondsToGo > 60) secondsToGo = 60; + int32_t millisecondsToGo = ((int)secondsToGo) * 1000; + + // Check to see if there's any message pending + CheckForInterProcessMsg(0 /* no account */, millisecondsToGo); + } +} - // Get the list of accounts - std::vector accounts; - if(mpAccountDatabase) - { - mpAccountDatabase->GetAllAccountIDs(accounts); - } +void BackupStoreDaemon::RunHousekeepingIfNeeded() +{ + // Get the time between housekeeping runs + const Configuration &rconfig(GetConfiguration()); + int64_t housekeepingInterval = SecondsToBoxTime(rconfig.GetKeyValueInt("TimeBetweenHousekeeping")); + + // Time now + int64_t timeNow = GetCurrentBoxTime(); + // Do housekeeping if the time interval has elapsed since the last check + if((timeNow - mLastHousekeepingRun) < housekeepingInterval) + { + return; + } + + // Store the time + mLastHousekeepingRun = timeNow; + ::syslog(LOG_INFO, "Starting housekeeping"); + + // Get the list of accounts + std::vector accounts; + if(mpAccountDatabase) + { + mpAccountDatabase->GetAllAccountIDs(accounts); + } - SetProcessTitle("housekeeping, active"); + SetProcessTitle("housekeeping, active"); - // Check them all - for(std::vector::const_iterator i = accounts.begin(); i != accounts.end(); ++i) + // Check them all + for(std::vector::const_iterator i = accounts.begin(); i != accounts.end(); ++i) + { + try + { + if(mpAccounts) { - try - { - if(mpAccounts) - { - // Get the account root - std::string rootDir; - int discSet = 0; - mpAccounts->GetAccountRoot(*i, rootDir, discSet); - - // Do housekeeping on this account - HousekeepStoreAccount housekeeping(*i, rootDir, discSet, *this); - housekeeping.DoHousekeeping(); - } - } - catch(BoxException &e) - { - ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s (%d/%d) -- aborting housekeeping run for this account", - *i, e.what(), e.GetType(), e.GetSubType()); - } - catch(std::exception &e) - { - ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s -- aborting housekeeping run for this account", - *i, e.what()); - } - catch(...) - { - ::syslog(LOG_ERR, "while housekeeping account %08X, unknown exception -- aborting housekeeping run for this account", - *i); - } + // Get the account root + std::string rootDir; + int discSet = 0; + mpAccounts->GetAccountRoot(*i, rootDir, discSet); - // Check to see if there's any message pending - CheckForInterProcessMsg(0 /* no account */); - - // Stop early? - if(StopRun()) - { - break; - } + // Do housekeeping on this account + HousekeepStoreAccount housekeeping(*i, rootDir, discSet, *this); + housekeeping.DoHousekeeping(); } - - ::syslog(LOG_INFO, "Finished housekeeping"); } - - // Placed here for accuracy, if StopRun() is true, for example. - SetProcessTitle("housekeeping, idle"); - - // Calculate how long should wait before doing the next housekeeping run - timeNow = GetCurrentBoxTime(); - time_t secondsToGo = BoxTimeToSeconds((lastHousekeepingRun + housekeepingInterval) - timeNow); + catch(BoxException &e) + { + ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s (%d/%d) -- aborting housekeeping run for this account", + *i, e.what(), e.GetType(), e.GetSubType()); + } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s -- aborting housekeeping run for this account", + *i, e.what()); + } + catch(...) + { + ::syslog(LOG_ERR, "while housekeeping account %08X, unknown exception -- aborting housekeeping run for this account", + *i); + } + + int64_t timeNow = GetCurrentBoxTime(); + time_t secondsToGo = BoxTimeToSeconds( + (mLastHousekeepingRun + housekeepingInterval) - + timeNow); if(secondsToGo < 1) secondsToGo = 1; if(secondsToGo > 60) secondsToGo = 60; int32_t millisecondsToGo = ((int)secondsToGo) * 1000; - + // Check to see if there's any message pending CheckForInterProcessMsg(0 /* no account */, millisecondsToGo); + + // Stop early? + if(StopRun()) + { + break; + } } + + ::syslog(LOG_INFO, "Finished housekeeping"); + + // Placed here for accuracy, if StopRun() is true, for example. + SetProcessTitle("housekeeping, idle"); } - // -------------------------------------------------------------------------- // // Function Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.h =================================================================== --- box/chris/merge/bin/bbstored/BackupStoreDaemon.h 2006-08-30 18:54:31 UTC (rev 832) +++ box/chris/merge/bin/bbstored/BackupStoreDaemon.h 2006-08-30 19:01:05 UTC (rev 833) @@ -74,6 +74,10 @@ SocketStream mInterProcessCommsSocket; IOStreamGetLine mInterProcessComms; + + void HousekeepingInit(); + void RunHousekeepingIfNeeded(); + int64_t mLastHousekeepingRun; }; From boxbackup-dev at fluffy.co.uk Wed Aug 30 20:01:20 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:01:20 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.7bebdc272df3c7ff899b5acecec2626f@fluffy.co.uk> --===============0225408995== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg WzgzM10NCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFj L3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3Vw Lz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBz eXN0ZW0gZm9yIFVOSVgu --===============0225408995==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 20:03:53 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:03:53 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.dccfafe6c13449dd5ff7f94b5c51a423@fluffy.co.uk> --===============0909827185== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgbWFydGluICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBhc3NpZ25lZCAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNoYW5nZXMgKGJ5IG1hcnRpbik6DQoNCiAgKiBvd25lcjogIGNo cmlzID0+IG1hcnRpbg0KICAqIHN0YXR1czogIG5ldyA9PiBhc3NpZ25lZA0KDQpDb21tZW50Og0K DQogWzgxN10gb2sgdG8gbWVyZ2UNCg0KIFs4MTRdIG9rIHRvIG1lcmdlDQoNCiBbNzk4XSBvayB0 byBtZXJnZSBidXQgbGluZXMgMjc3IHRvIDI4MyAoY2F0Y2ggQm94RXhjZXB0aW9uKSBhcmUNCiBy ZWR1bmRhbnQgYmVjYXVzZSBCb3hFeGNlcHRpb24gaXMgZGVyaXZlZCBmcm9tIHN0ZDo6ZXhjZXB0 aW9uLg0KDQogWzc0OV0gb2sgdG8gbWVyZ2UNCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2Ji ZGV2LmZsdWZmeS5jby51ay90cmFjL3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5m bHVmZnkuY28udWsvYm94YmFja3VwLz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9t YXRpYyBvbi1saW5lIGJhY2t1cCBzeXN0ZW0gZm9yIFVOSVgu --===============0909827185==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 20:04:11 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:04:11 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.6e8c6a4f761510ef881b5f4534914a1e@fluffy.co.uk> --===============0907840174== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNoYW5nZXMgKGJ5IG1hcnRpbik6DQoNCiAgKiBvd25lcjogIG1h cnRpbiA9PiBjaHJpcw0KICAqIHN0YXR1czogIGFzc2lnbmVkID0+IG5ldw0KDQotLSANClRpY2tl dCBVUkw6IDxodHRwOi8vYmJkZXYuZmx1ZmZ5LmNvLnVrL3RyYWMvdGlja2V0LzM+DQpCb3ggQmFj a3VwIDxodHRwOi8vd3d3LmZsdWZmeS5jby51ay9ib3hiYWNrdXAvPg0KQW4gb3BlbiBzb3VyY2Us IGNvbXBsZXRlbHkgYXV0b21hdGljIG9uLWxpbmUgYmFja3VwIHN5c3RlbSBmb3IgVU5JWC4= --===============0907840174==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 20:20:35 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 20:20:35 +0100 Subject: [Box Backup-dev] COMMIT r834 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 20:20:35 +0100 (Wed, 30 Aug 2006) New Revision: 834 Modified: box/chris/merge/bin/bbstored/HousekeepStoreAccount.cpp Log: * bin/bbstored/HousekeepStoreAccount.cpp - Revert to trunk Modified: box/chris/merge/bin/bbstored/HousekeepStoreAccount.cpp =================================================================== --- box/chris/merge/bin/bbstored/HousekeepStoreAccount.cpp 2006-08-30 19:01:05 UTC (rev 833) +++ box/chris/merge/bin/bbstored/HousekeepStoreAccount.cpp 2006-08-30 19:20:35 UTC (rev 834) @@ -225,7 +225,6 @@ // -------------------------------------------------------------------------- bool HousekeepStoreAccount::ScanDirectory(int64_t ObjectID) { -#ifndef WIN32 if((--mCountUntilNextInterprocessMsgCheck) <= 0) { mCountUntilNextInterprocessMsgCheck = POLL_INTERPROCESS_MSG_CHECK_FREQUENCY; @@ -236,7 +235,6 @@ return false; } } -#endif // Get the filename std::string objectFilename; @@ -253,7 +251,6 @@ // Read the directory in BackupStoreDirectory dir; dir.ReadFromStream(*dirStream, IOStream::TimeOutInfinite); - dirStream->Close(); // Is it empty? if(dir.GetNumberOfEntries() == 0) @@ -488,7 +485,6 @@ // (there is likely to be more in the set than should be actually deleted). for(std::set::iterator i(mPotentialDeletions.begin()); i != mPotentialDeletions.end(); ++i) { -#ifndef WIN32 if((--mCountUntilNextInterprocessMsgCheck) <= 0) { mCountUntilNextInterprocessMsgCheck = POLL_INTERPROCESS_MSG_CHECK_FREQUENCY; @@ -499,7 +495,6 @@ return true; } } -#endif // Load up the directory it's in // Get the filename @@ -734,7 +729,6 @@ // Go through list for(std::vector::const_iterator i(mEmptyDirectories.begin()); i != mEmptyDirectories.end(); ++i) { -#ifndef WIN32 if((--mCountUntilNextInterprocessMsgCheck) <= 0) { mCountUntilNextInterprocessMsgCheck = POLL_INTERPROCESS_MSG_CHECK_FREQUENCY; @@ -745,7 +739,6 @@ return true; } } -#endif // Do not delete the root directory if(*i == BACKUPSTORE_ROOT_DIRECTORY_ID) From boxbackup-dev at fluffy.co.uk Wed Aug 30 20:29:23 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 20:29:23 +0100 Subject: [Box Backup-dev] COMMIT r835 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-30 20:29:23 +0100 (Wed, 30 Aug 2006) New Revision: 835 Modified: box/chris/merge/bin/bbstored/HousekeepStoreAccount.cpp Log: * bin/bbstored/HousekeepStoreAccount.cpp - Disable checks for inter-process messages on Win32 (there is only one process) - Close directory immediately after we finish reading it Modified: box/chris/merge/bin/bbstored/HousekeepStoreAccount.cpp =================================================================== --- box/chris/merge/bin/bbstored/HousekeepStoreAccount.cpp 2006-08-30 19:20:35 UTC (rev 834) +++ box/chris/merge/bin/bbstored/HousekeepStoreAccount.cpp 2006-08-30 19:29:23 UTC (rev 835) @@ -225,6 +225,7 @@ // -------------------------------------------------------------------------- bool HousekeepStoreAccount::ScanDirectory(int64_t ObjectID) { +#ifndef WIN32 if((--mCountUntilNextInterprocessMsgCheck) <= 0) { mCountUntilNextInterprocessMsgCheck = POLL_INTERPROCESS_MSG_CHECK_FREQUENCY; @@ -235,6 +236,7 @@ return false; } } +#endif // Get the filename std::string objectFilename; @@ -251,6 +253,7 @@ // Read the directory in BackupStoreDirectory dir; dir.ReadFromStream(*dirStream, IOStream::TimeOutInfinite); + dirStream->Close(); // Is it empty? if(dir.GetNumberOfEntries() == 0) @@ -485,6 +488,7 @@ // (there is likely to be more in the set than should be actually deleted). for(std::set::iterator i(mPotentialDeletions.begin()); i != mPotentialDeletions.end(); ++i) { +#ifndef WIN32 if((--mCountUntilNextInterprocessMsgCheck) <= 0) { mCountUntilNextInterprocessMsgCheck = POLL_INTERPROCESS_MSG_CHECK_FREQUENCY; @@ -495,6 +499,7 @@ return true; } } +#endif // Load up the directory it's in // Get the filename @@ -729,6 +734,7 @@ // Go through list for(std::vector::const_iterator i(mEmptyDirectories.begin()); i != mEmptyDirectories.end(); ++i) { +#ifndef WIN32 if((--mCountUntilNextInterprocessMsgCheck) <= 0) { mCountUntilNextInterprocessMsgCheck = POLL_INTERPROCESS_MSG_CHECK_FREQUENCY; @@ -739,6 +745,7 @@ return true; } } +#endif // Do not delete the root directory if(*i == BACKUPSTORE_ROOT_DIRECTORY_ID) From boxbackup-dev at fluffy.co.uk Wed Aug 30 20:35:05 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Wed, 30 Aug 2006 20:35:05 +0100 Subject: [Box Backup-dev] Tips on using trac comments In-Reply-To: <20060830151321.492tjpf7k0kko80s@ebourne.me.uk> References: <20060830151321.492tjpf7k0kko80s@ebourne.me.uk> Message-ID: <20060830193504.GA81028@netinertia.co.uk> On Wed, Aug 30, 2006 at 03:13:21PM +0100, Martin Ebourne wrote: > Also if it has been set up you can use svn commit messages to > automatically update and possibly close tickets. eg. When a commit > fixes a ticket put 'fixes #2' in the commit message. Or if it relates > to a ticket but doesn't close it put 'refs #2' instead. The message > will then also be written to the ticket. Full documentation on this is > at the top of the script that performs it (yeah, I know): > > http://trac.edgewall.org/browser/trunk/contrib/trac-post-commit-hook Nifty! > That's is presuming it's been setup like so. If not them maybe James > could add that one for us because it is very useful and really > integrates tickets into svn. More info here: OK, that's been added to the post-commit hook. James From boxbackup-dev at fluffy.co.uk Wed Aug 30 20:39:23 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:39:23 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.44f03f65ca63e8cb62e2f22e230162cc@fluffy.co.uk> --===============0500862268== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg WzgzNV0NCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFj L3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3Vw Lz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBz eXN0ZW0gZm9yIFVOSVgu --===============0500862268==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 20:41:05 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 20:41:05 +0100 Subject: [Box Backup-dev] COMMIT r836 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2006-08-30 20:41:05 +0100 (Wed, 30 Aug 2006) New Revision: 836 Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: * bin/bbackupd/BackupClientDirectoryRecord.cpp - Restructured the backup decision logic to make it easier to understand and debug Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-30 19:29:23 UTC (rev 835) +++ box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-30 19:41:05 UTC (rev 836) @@ -674,32 +674,73 @@ // modification time within sync period // if it's been seen before but not uploaded, is the time from this first sight longer than the MaxUploadWait // and if we know about it from a directory listing, that it hasn't got the same upload time as on the store - if( - ( - // Check the file modified within the acceptable time period we're checking - // If the file isn't on the server, the acceptable time starts at zero. - // Check pDirOnStore and en, because if we didn't download a directory listing, - // pDirOnStore will be zero, but we know it's on the server. - ( ((pDirOnStore != 0 && en == 0) || (modTime >= rParams.mSyncPeriodStart)) && modTime < rParams.mSyncPeriodEnd) - // However, just in case things are continually modified, we check the first seen time. - // The two compares of syncPeriodEnd and pendingFirstSeenTime are because the values are unsigned. - || (pendingFirstSeenTime != 0 && - (rParams.mSyncPeriodEnd > pendingFirstSeenTime) - && ((rParams.mSyncPeriodEnd - pendingFirstSeenTime) > rParams.mMaxUploadWait)) + bool doUpload = false; - // Then make sure that if files are added with a time less than the sync period start - // (which can easily happen on file server), it gets uploaded. The directory contents checksum - // will pick up the fact it has been added, so the store listing will be available when this happens. - || ((modTime <= rParams.mSyncPeriodStart) && (en != 0) && (en->GetModificationTime() != modTime)) - - // And just to catch really badly off clocks in the future for file server clients, - // just upload the file if it's madly in the future. - || (modTime > rParams.mUploadAfterThisTimeInTheFuture) - ) - // But even then, only upload it if the mod time locally is different to that on the server. - && (en == 0 || en->GetModificationTime() != modTime)) + // Only upload a file if the mod time locally is + // different to that on the server. + + if (en == 0 || en->GetModificationTime() != modTime) { + // Check the file modified within the acceptable time period we're checking + // If the file isn't on the server, the acceptable time starts at zero. + // Check pDirOnStore and en, because if we didn't download a directory listing, + // pDirOnStore will be zero, but we know it's on the server. + if (modTime < rParams.mSyncPeriodEnd) + { + if (pDirOnStore != 0 && en == 0) + { + doUpload = true; + } + else if (modTime >= rParams.mSyncPeriodStart) + { + doUpload = true; + } + } + + // However, just in case things are continually + // modified, we check the first seen time. + // The two compares of syncPeriodEnd and + // pendingFirstSeenTime are because the values + // are unsigned. + + if (!doUpload && + pendingFirstSeenTime != 0 && + rParams.mSyncPeriodEnd > pendingFirstSeenTime && + (rParams.mSyncPeriodEnd - pendingFirstSeenTime) + > rParams.mMaxUploadWait) + { + doUpload = true; + } + + // Then make sure that if files are added with a + // time less than the sync period start + // (which can easily happen on file server), it + // gets uploaded. The directory contents checksum + // will pick up the fact it has been added, so the + // store listing will be available when this happens. + + if (!doUpload && + modTime <= rParams.mSyncPeriodStart && + en != 0 && + en->GetModificationTime() != modTime) + { + doUpload = true; + } + + // And just to catch really badly off clocks in + // the future for file server clients, + // just upload the file if it's madly in the future. + + if (!doUpload && modTime > + rParams.mUploadAfterThisTimeInTheFuture) + { + doUpload = true; + } + } + + if (doUpload) + { // Make sure we're connected -- must connect here so we know whether // the storage limit has been exceeded, and hence whether or not // to actually upload the file. From boxbackup-dev at fluffy.co.uk Wed Aug 30 20:42:27 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 20:42:27 +0100 Subject: [Box Backup-dev] COMMIT r837 - box/trunk/test/bbackupd Message-ID: Author: chris Date: 2006-08-30 20:42:27 +0100 (Wed, 30 Aug 2006) New Revision: 837 Modified: box/trunk/test/bbackupd/testbbackupd.cpp Log: * test/bbackupd/testbbackupd.cpp - Fixed typo Modified: box/trunk/test/bbackupd/testbbackupd.cpp =================================================================== --- box/trunk/test/bbackupd/testbbackupd.cpp 2006-08-30 19:41:05 UTC (rev 836) +++ box/trunk/test/bbackupd/testbbackupd.cpp 2006-08-30 19:42:27 UTC (rev 837) @@ -576,7 +576,7 @@ // Update a file (will be uploaded as a diff) { - // Check that the file is over the diffing threshold in the bbstored.conf file + // Check that the file is over the diffing threshold in the bbackupd.conf file TEST_THAT(TestGetFileSize("testfiles/TestDir1/f45.df") > 1024); // Add a bit to the end @@ -1055,4 +1055,3 @@ return 0; } - From boxbackup-dev at fluffy.co.uk Wed Aug 30 20:50:08 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 20:50:08 +0100 Subject: [Box Backup-dev] COMMIT r838 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2006-08-30 20:50:08 +0100 (Wed, 30 Aug 2006) New Revision: 838 Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Changed handling of all catch(...) blocks, which don't have an obvious outer exception handler, to catch std::exception first and report it with e.what(), as suggested by Martin. - Fixed some catch blocks to match coding standards. Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.cpp 2006-08-30 19:42:27 UTC (rev 837) +++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2006-08-30 19:50:08 UTC (rev 838) @@ -272,6 +272,21 @@ { mpCommandSocketInfo->mListeningSocket.Accept( BOX_NAMED_PIPE_NAME); + } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Failed to open command socket: " + "%s", e.what()); + SetTerminateWanted(); + break; // this is fatal to listening thread + } + catch(...) + { + ::syslog(LOG_ERR, "Failed to open command socket: " + "unknown error"); + SetTerminateWanted(); + break; // this is fatal to listening thread + } // This next section comes from Ben's original function // Log @@ -357,13 +372,18 @@ mpCommandSocketInfo->mListeningSocket.Close(); } - catch (BoxException &e) + catch(BoxException &e) { ::syslog(LOG_ERR, "Communication error with " "control client: %s", e.what()); } - catch (...) + catch(std::exception &e) { + ::syslog(LOG_ERR, "Internal error in command socket " + "thread: %s", e.what()); + } + catch(...) + { ::syslog(LOG_ERR, "Communication error with control client"); } } @@ -423,6 +443,12 @@ { delete mpCommandSocketInfo; } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error while " + "closing command socket after " + "another exception: %s", e.what()); + } catch(...) { ::syslog(LOG_WARNING, @@ -753,6 +779,12 @@ errorCode = e.GetType(); errorSubCode = e.GetSubType(); } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error during " + "backup run: %s", e.what()); + errorOccurred = true; + } catch(...) { // TODO: better handling of exceptions here... need to be very careful @@ -884,6 +916,17 @@ int status = 0; ::waitpid(pid, &status, 0); } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error running SyncAllowScript: " + "%s", e.what()); + // Clean up + if(pid != 0) + { + int status = 0; + ::waitpid(pid, &status, 0); + } + } catch(...) { // Ignore any exceptions @@ -1090,13 +1133,19 @@ CloseCommandConnection(); } } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error in command socket thread: " + "%s", e.what()); + throw; // thread will die + } catch(...) { // If an error occurs, and there is a connection active, just close that // connection and continue. Otherwise, let the error propagate. if(mpCommandSocketInfo->mpConnectedSocket.get() == 0) { - throw; + throw; // thread will die } else { @@ -1130,6 +1179,11 @@ } mpCommandSocketInfo->mpConnectedSocket.reset(); } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error while closing command " + "socket: %s", e.what()); + } catch(...) { // Ignore any errors @@ -1175,6 +1229,12 @@ strlen(message)); #endif } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error while sending to " + "command socket client: %s", e.what()); + CloseCommandConnection(); + } catch(...) { CloseCommandConnection(); @@ -1284,7 +1344,7 @@ } catch(...) { - ::endmntent(mountPointsFile); + ::endmntent(mountPointsFile); throw; } #else // ! HAVE_STRUCT_MNTENT_MNT_DIR @@ -1784,6 +1844,12 @@ { mpCommandSocketInfo->mListeningSocket.Write(newState, newStateSize); } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error while writing state " + "to command socket: %s", e.what()); + CloseCommandConnection(); + } catch(...) { CloseCommandConnection(); @@ -1797,6 +1863,12 @@ { mpCommandSocketInfo->mpConnectedSocket->Write(newState, newStateSize); } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error while writing state " + "to command socket: %s", e.what()); + CloseCommandConnection(); + } catch(...) { CloseCommandConnection(); @@ -2246,7 +2318,7 @@ ::syslog(LOG_INFO, "Saved store object info file '%s'", StoreObjectInfoFile.c_str()); } - catch (...) + catch(...) { ::syslog(LOG_WARNING, "Requested store object info file '%s' " "not accessible or could not be created", @@ -2401,22 +2473,29 @@ iVersion); return true; + } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error reading store object " + "info file: %s", e.what()); } - catch (...) + catch(...) { - DeleteAllLocations(); + ::syslog(LOG_ERR, "Internal error reading store object " + "info file: unknown error"); + } - aClientStoreMarker = - BackupClientContext::ClientStoreMarker_NotKnown; - theLastSyncTime = 0; - theNextSyncTime = 0; + DeleteAllLocations(); - ::syslog(LOG_WARNING, "Requested store object info file '%s' " - "does not exist, not accessible, or inconsistent. " - "Will re-cache from store.", - StoreObjectInfoFile.c_str()); - } + aClientStoreMarker = BackupClientContext::ClientStoreMarker_NotKnown; + theLastSyncTime = 0; + theNextSyncTime = 0; + ::syslog(LOG_WARNING, "Requested store object info file '%s' " + "does not exist, not accessible, or inconsistent. " + "Will re-cache from store.", + StoreObjectInfoFile.c_str()); + return false; } From boxbackup-dev at fluffy.co.uk Wed Aug 30 20:51:59 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 20:51:59 +0100 Subject: [Box Backup-dev] COMMIT r839 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2006-08-30 20:51:59 +0100 (Wed, 30 Aug 2006) New Revision: 839 Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Made the code more readable by defining a reference rSocket to mpCommandSocketInfo->mListeningSocket which is used several times. - Terminate the listening thread if it fails to bind a command socket. - Log any unrecognised commands received over the command socket. Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.cpp 2006-08-30 19:50:08 UTC (rev 838) +++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2006-08-30 19:51:59 UTC (rev 839) @@ -263,16 +263,31 @@ void BackupDaemon::RunHelperThread(void) { mpCommandSocketInfo = new CommandSocketInfo; - this->mReceivedCommandConn = false; + WinNamedPipeStream& rSocket(mpCommandSocketInfo->mListeningSocket); - // loop until the parent process exits - while (TRUE) + // loop until the parent process exits, or we decide + // to kill the thread ourselves + while (!IsTerminateWanted()) { try { - mpCommandSocketInfo->mListeningSocket.Accept( - BOX_NAMED_PIPE_NAME); + rSocket.Accept(BOX_NAMED_PIPE_NAME); } + catch (BoxException &e) + { + ::syslog(LOG_ERR, "Failed to open command socket: %s", + e.what()); + SetTerminateWanted(); + break; // this is fatal to listening thread + } + catch (...) + { + ::syslog(LOG_ERR, "Failed to open command socket: " + "unknown error"); + SetTerminateWanted(); + break; // this is fatal to listening thread + } + } catch(std::exception &e) { ::syslog(LOG_ERR, "Failed to open command socket: " @@ -288,6 +303,11 @@ break; // this is fatal to listening thread } + try + { + // Errors here do not kill the thread, + // only the current connection. + // This next section comes from Ben's original function // Log ::syslog(LOG_INFO, "Connection from command socket"); @@ -304,16 +324,17 @@ conf.GetKeyValueInt("MaxUploadWait"), mState); - mpCommandSocketInfo->mListeningSocket.Write(summary, summarySize); - mpCommandSocketInfo->mListeningSocket.Write("ping\n", 5); + rSocket.Write(summary, summarySize); + rSocket.Write("ping\n", 5); - IOStreamGetLine readLine(mpCommandSocketInfo->mListeningSocket); + IOStreamGetLine readLine(rSocket); std::string command; - while (mpCommandSocketInfo->mListeningSocket.IsConnected() && - readLine.GetLine(command) ) + while (rSocket.IsConnected() && + readLine.GetLine(command) && + !IsTerminateWanted()) { - TRACE1("Receiving command '%s' over " + TRACE1("Received command '%s' over " "command socket\n", command.c_str()); bool sendOK = false; @@ -353,12 +374,18 @@ SetTerminateWanted(); sendOK = true; } + else + { + ::syslog(LOG_ERR, "Received unknown command '%s' from client", command.c_str()); + sendResponse = true; + sendOK = false; + } // Send a response back? if (sendResponse) { const char* response = sendOK ? "ok\n" : "error\n"; - mpCommandSocketInfo->mListeningSocket.Write( + rSocket.Write( response, strlen(response)); } @@ -370,7 +397,7 @@ this->mReceivedCommandConn = true; } - mpCommandSocketInfo->mListeningSocket.Close(); + rSocket.Close(); } catch(BoxException &e) { From boxbackup-dev at fluffy.co.uk Wed Aug 30 20:53:16 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 19:53:16 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.03285e835bac611d2b5356d00bc96a5d@fluffy.co.uk> --===============1995126793== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFRoYW5rcyBNYXJ0aW4s IEkndmUgbWVyZ2VkIDgxNywgODE0LCA3OTggKHdpdGggY2hhbmdlKSBhbmQgNzQ5Lg0KDQotLSAN ClRpY2tldCBVUkw6IDxodHRwOi8vYmJkZXYuZmx1ZmZ5LmNvLnVrL3RyYWMvdGlja2V0LzM+DQpC b3ggQmFja3VwIDxodHRwOi8vd3d3LmZsdWZmeS5jby51ay9ib3hiYWNrdXAvPg0KQW4gb3BlbiBz b3VyY2UsIGNvbXBsZXRlbHkgYXV0b21hdGljIG9uLWxpbmUgYmFja3VwIHN5c3RlbSBmb3IgVU5J WC4= --===============1995126793==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 23:08:23 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Wed, 30 Aug 2006 23:08:23 +0100 Subject: [Box Backup-dev] changeset [819] Message-ID: <1156975704.2413.1.camel@avenin.ebourne.me.uk> Chris, I can't see why this code from bin/bbstored/BackupCommands.cpp needs to be conditionalised: +#ifdef WIN32 + std::ostringstream fs(rContext.GetStoreRoot()); + fs << ".recombinetemp."; + fs << p; + std::string tempFn(fs.str()); + tempFn = RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), tempFn, p + 16); +#else + std::string tempFn(RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), rContext.GetStoreRoot() + ".recombinetemp", p + 16 /* rotate which disc it's on */)); +#endif Cheers, Martin. From boxbackup-dev at fluffy.co.uk Wed Aug 30 23:20:14 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 22:20:14 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.c9f51a9be24f7b936e1026d3fb823bea@fluffy.co.uk> --===============1936278246== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IG1hcnRpbik6DQoNCiBPayB0byBtZXJnZTog WzgyMV0gWzgyNV0gWzgyN10gWzgyOV0gWzgzMV0gWzgzMl0NCg0KLS0gDQpUaWNrZXQgVVJMOiA8 aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0 cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3VwLz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0 ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBzeXN0ZW0gZm9yIFVOSVgu --===============1936278246==-- From boxbackup-dev at fluffy.co.uk Wed Aug 30 23:45:00 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 22:45:00 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.f5668d8ab3818f0202d919ef4398fca2@fluffy.co.uk> --===============0107639696== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IG1hcnRpbik6DQoNCiBPayB0byBtZXJnZTog WzgzM10gWzgzNV0NCg0KIEV4Y2VwdGluZyBbODE5XSBxdWVyaWVkIG9uIC1kZXYsIHVwIHRvIGRh dGUgYXQgdGhpcyBwb2ludC4NCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZm eS5jby51ay90cmFjL3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28u dWsvYm94YmFja3VwLz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1s aW5lIGJhY2t1cCBzeXN0ZW0gZm9yIFVOSVgu --===============0107639696==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 00:00:28 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 23:00:28 -0000 Subject: [Box Backup-dev] =?utf-8?q?=234=3A_Port_Box_Backup_to_AIX?= Message-ID: <072.59c24116ecc59a50bad958908bfd81d3@fluffy.co.uk> --===============1870928258== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzQ6IFBvcnQgQm94IEJhY2t1cCB0byBBSVgNCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSst LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCiBSZXBvcnRl cjogIG1hcnRpbiAgICAgICAgIHwgICAgICAgT3duZXI6ICAgICAgDQogICAgIFR5cGU6ICB0YXNr ICAgICAgICAgICB8ICAgICAgU3RhdHVzOiAgbmV3IA0KIFByaW9yaXR5OiAgbm9ybWFsICAgICAg ICAgfCAgIE1pbGVzdG9uZTogICAgICANCkNvbXBvbmVudDogIGJveCBsaWJyYXJpZXMgIHwgICAg IFZlcnNpb246ICAwLjEwDQogS2V5d29yZHM6ICAgICAgICAgICAgICAgICB8ICANCi0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLSstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0NCiBTdGVmYW4gTm9ybGluIG1hZGUgYW4gaW5pdGlhbCBwb3J0IG9mIGJveCB0 byBBSVguIEl0IGludm9sdmVzIHNvbWUgaGFja3MNCiBzbyBpbnZlc3RpZ2F0aW9uIG5lZWRzIHRv IGJlIGRvbmUgdG8gZmluZCBiZXR0ZXIgc29sdXRpb25zIHdoZXJlIHBvc3NpYmxlLg0KDQogU3Rl ZmFuIHdyb3RlOg0KDQogICB3aXRoIHRoZSBhdHRhY2hlZCBkaWZmIEkgY2FuIGNvbXBpbGUgb24g QUlYIDUgYW5kIEJveCBCYWNrdXANCiB3b3JrcyBzZWVtaW5nbHkgb2suIEkgZG8gbm90IGNvbnNp ZGVyIGl0IGEgY2xlYW4gcG9ydGFiaWxpdHkgd29yayBidXQgaXQNCiBpcyBhbiBpbmRpY2F0aW9u IHdoZXJlIHNvbWV0aGluZyBuZWVkcyB0byBiZSBkb25lLiBBbHNvIHRoZXJlIGFyZSB2ZXJ5IGZl dw0KIGFuZCBtaW5vciBjaGFuZ2VzIHdoaWNoIEkgdGhpbmsgaXMgZ29vZC4NCg0KICAgQWxsIHRl c3RzIGRvIG5vdCBwYXNzLCBJIGFtIGxvb2tpbmcgYXQgdGhhdC4gcmFpZGZpbGUgaXMgb25lIHBy b2JsZW0gYW5kDQogYSBiYnN0b3JlZCB0aGF0IGRvZXMgbm90IHN0b3AgaXMgYW5vdGhlci4NCg0K ICAgSG93ZXZlciwgSSBhbSBhYmxlIHRvIHRha2Ugc25hcHNob3QgYmFja3VwLCBicm93c2UgaXQg YW5kIGNvbXBhcmUgaXQgb2sNCiB1c2luZyBiYmFja3VwcXVlcnkuDQoNCiAgIFRoZSB3b3JrYXJv dW5kIGZvciBtYWxsb2MoMCkgaXMgbm90IGJlYXRpZnVsIGJ1dCBpdCBzb2x2ZXMgbXkgcHJvYmxl bQ0KIHRlbXBvcmFyaWx5Lg0KDQogICBUaGUgaW5zdGFsbGVkIHZlcnNpb24gb2YgQkRCIDQuNCBk ZXBlbmRzIG9uIHB0aHJlYWQgbGlicmFyeSBmcm9tIHdoaWNoDQogdGhlICJoYWNrIiBpbiBjb25m aWd1cmUuYWMgb3JpZ2luYXRlcy4NCg0KICAgSXQgd291bGQgYmUgZ3JlYXQgdG8gYmUgYWJsZSB0 byBsaW5rIE9wZW5TU0wgYW5kIGxpYmRiIHN0YXRpY2FsbHkgaW4NCiBvcmRlciB0byBub3QgaGF2 ZSB0byBjb21waWxlIEJveCBmb3IgZWFjaCBpbnN0YWxsYXRpb24gd2hlbiB0aGUgT1MNCiB2ZXJz aW9ucyBhcmUgbm90IGV4YWN0bHkgdGhlIHNhbWUgYW5kIHRoZXJlZm9yZSBkZXBlbmRlbmNpZXMg ZG8gbm90IGFsd2F5cw0KIHdvcmsgb3V0IHdpdGggZHluYW1pYyBsaWJyYXJpZXMuDQoNCi0tIA0K VGlja2V0IFVSTDogPGh0dHA6Ly9iYmRldi5mbHVmZnkuY28udWsvdHJhYy90aWNrZXQvND4NCkJv eCBCYWNrdXAgPGh0dHA6Ly93d3cuZmx1ZmZ5LmNvLnVrL2JveGJhY2t1cC8+DQpBbiBvcGVuIHNv dXJjZSwgY29tcGxldGVseSBhdXRvbWF0aWMgb24tbGluZSBiYWNrdXAgc3lzdGVtIGZvciBVTklY Lg== --===============1870928258==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 00:01:50 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 31 Aug 2006 00:01:50 +0100 Subject: [Box Backup-dev] Can't add attachments in trac Message-ID: <1156978910.2413.2.camel@avenin.ebourne.me.uk> Gives this permissions error when trying to add an attachment: Trac detected an internal error: [Errno 13] Permission denied: '/data/trac/boxbackup/attachments/ticket' Guessing it's trying to create the directory or a file under it or something. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 31 00:13:39 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Wed, 30 Aug 2006 23:13:39 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=234=3A_Port_Box_Backup_to_AIX?= In-Reply-To: <072.59c24116ecc59a50bad958908bfd81d3@fluffy.co.uk> References: <072.59c24116ecc59a50bad958908bfd81d3@fluffy.co.uk> Message-ID: <081.98a1a5829579841cf5fd7e39b4370be3@fluffy.co.uk> --===============1370722973== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzQ6IFBvcnQgQm94IEJhY2t1cCB0byBBSVgNCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0r LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCiAgUmVwb3J0 ZXI6ICBtYXJ0aW4gICAgICAgICB8ICAgICAgIE93bmVyOiAgbWFydGluDQogICAgICBUeXBlOiAg dGFzayAgICAgICAgICAgfCAgICAgIFN0YXR1czogIG5ldyAgIA0KICBQcmlvcml0eTogIG5vcm1h bCAgICAgICAgIHwgICBNaWxlc3RvbmU6ICAgICAgICANCiBDb21wb25lbnQ6ICBib3ggbGlicmFy aWVzICB8ICAgICBWZXJzaW9uOiAgMC4xMCAgDQpSZXNvbHV0aW9uOiAgICAgICAgICAgICAgICAg fCAgICBLZXl3b3JkczogICAgICAgIA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSstLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KQ2hhbmdlcyAoYnkg bWFydGluKToNCg0KICAqIG93bmVyOiAgPT4gbWFydGluDQoNCi0tIA0KVGlja2V0IFVSTDogPGh0 dHA6Ly9iYmRldi5mbHVmZnkuY28udWsvdHJhYy90aWNrZXQvND4NCkJveCBCYWNrdXAgPGh0dHA6 Ly93d3cuZmx1ZmZ5LmNvLnVrL2JveGJhY2t1cC8+DQpBbiBvcGVuIHNvdXJjZSwgY29tcGxldGVs eSBhdXRvbWF0aWMgb24tbGluZSBiYWNrdXAgc3lzdGVtIGZvciBVTklYLg== --===============1370722973==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 08:18:58 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Thu, 31 Aug 2006 08:18:58 +0100 Subject: [Box Backup-dev] Can't add attachments in trac In-Reply-To: <1156978910.2413.2.camel@avenin.ebourne.me.uk> References: <1156978910.2413.2.camel@avenin.ebourne.me.uk> Message-ID: <20060831071858.GB81028@netinertia.co.uk> On Thu, Aug 31, 2006 at 12:01:50AM +0100, Martin Ebourne wrote: > Gives this permissions error when trying to add an attachment: > > Trac detected an internal error: > [Errno 13] Permission denied: '/data/trac/boxbackup/attachments/ticket' > > Guessing it's trying to create the directory or a file under it or > something. Sorry, forgot to add the ACL for that directory. Should be fixed now, but let me know if not. James From boxbackup-dev at fluffy.co.uk Thu Aug 31 08:41:40 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 31 Aug 2006 08:41:40 +0100 Subject: [Box Backup-dev] Can't add attachments in trac In-Reply-To: <20060831071858.GB81028@netinertia.co.uk> References: <1156978910.2413.2.camel@avenin.ebourne.me.uk> <20060831071858.GB81028@netinertia.co.uk> Message-ID: <1157010100.14100.3.camel@avenin.ebourne.me.uk> On Thu, 2006-08-31 at 08:18 +0100, James O'Gorman wrote: > Sorry, forgot to add the ACL for that directory. Should be fixed now, > but let me know if not. That's working now thanks. But the next thing is that attachments are not being displayed as diffs. On ticket #4 (http://bbdev.fluffy.co.uk/trac/ticket/4) I've attached a patch as both .patch and .diff but it's being displayed as a regular text file. cf. http://svn.mythtv.org/trac/ticket/800 if you click on the .patch in that ticket you'll see it's displayed as a diff in the same way as the svn changesets. Maybe an issue with mime types/or file type detection? Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:01:44 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:01:44 +0100 Subject: [Box Backup-dev] COMMIT r840 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2006-08-31 09:01:43 +0100 (Thu, 31 Aug 2006) New Revision: 840 Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp Log: * bin/bbackupd/BackupClientDirectoryRecord.cpp - Sync subdirectories even when store is full, allows user to exclude files to free up space to complete their backups Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-30 19:51:59 UTC (rev 839) +++ box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-08-31 08:01:43 UTC (rev 840) @@ -922,11 +922,15 @@ // In the list, just use this pointer psubDirRecord = e->second; } - else if(!rParams.mrContext.StorageLimitExceeded()) // know we've got a connection if we get this far, as dir will have been modified. + else { - // Note: only think about adding directory records if there's space left on the server. - // If there isn't, this step will be repeated when there is some available. - + // Note: if we have exceeded our storage limit, then + // we should not upload any more data, nor create any + // DirectoryRecord representing data that would have + // been uploaded. This step will be repeated when + // there is some space available. + bool doCreateDirectoryRecord = true; + // Need to create the record. But do we need to create the directory on the server? int64_t subDirObjectID = 0; if(en != 0) @@ -934,6 +938,12 @@ // No. Exists on the server, and we know about it from the listing. subDirObjectID = en->GetObjectID(); } + else if(rParams.mrContext.StorageLimitExceeded()) + // know we've got a connection if we get this far, + // as dir will have been modified. + { + doCreateDirectoryRecord = false; + } else { // Yes, creation required! @@ -1016,21 +1026,24 @@ haveJustCreatedDirOnServer = true; } } - - // New an object for this - psubDirRecord = new BackupClientDirectoryRecord(subDirObjectID, *d); - - // Store in list - try - { - mSubDirectories[*d] = psubDirRecord; + + if (doCreateDirectoryRecord) + { + // New an object for this + psubDirRecord = new BackupClientDirectoryRecord(subDirObjectID, *d); + + // Store in list + try + { + mSubDirectories[*d] = psubDirRecord; + } + catch(...) + { + delete psubDirRecord; + psubDirRecord = 0; + throw; + } } - catch(...) - { - delete psubDirRecord; - psubDirRecord = 0; - throw; - } } ASSERT(psubDirRecord != 0 || rParams.mrContext.StorageLimitExceeded()); From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:02:28 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 08:02:28 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.681a14d40887abc3df7f70baa8564073@fluffy.co.uk> --===============0920151748== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFRoYW5rcyBhZ2FpbiBN YXJ0aW4sIHBsZWFzZSByZXZpZXcgWzg0MF0uDQoNCi0tIA0KVGlja2V0IFVSTDogPGh0dHA6Ly9i YmRldi5mbHVmZnkuY28udWsvdHJhYy90aWNrZXQvMz4NCkJveCBCYWNrdXAgPGh0dHA6Ly93d3cu Zmx1ZmZ5LmNvLnVrL2JveGJhY2t1cC8+DQpBbiBvcGVuIHNvdXJjZSwgY29tcGxldGVseSBhdXRv bWF0aWMgb24tbGluZSBiYWNrdXAgc3lzdGVtIGZvciBVTklYLg== --===============0920151748==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:06:44 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 31 Aug 2006 09:06:44 +0100 (BST) Subject: [Box Backup-dev] changeset [819] In-Reply-To: <1156975704.2413.1.camel@avenin.ebourne.me.uk> References: <1156975704.2413.1.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, On Wed, 30 Aug 2006, Martin Ebourne wrote: > I can't see why this code from bin/bbstored/BackupCommands.cpp needs to > be conditionalised: On Windows, we cannot reuse the same recombinetemp file, because we still have it open so we can't delete the old one, so we can't create a new one with the same name. Therefore, I added a unique part to the end of the filename (p). This would probably also work on other platforms, so I can remove the conditionality if you prefer. The larger problem is that, on Windows, we never delete these temp files! It's OK for unit tests, but would be horrible for a real store. Cheers, Chris. > +#ifdef WIN32 > + std::ostringstream fs(rContext.GetStoreRoot()); > + fs << ".recombinetemp."; > + fs << p; > + std::string tempFn(fs.str()); > + tempFn = > RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), tempFn, p + 16); > +#else > + std::string > tempFn(RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), rContext.GetStoreRoot() + ".recombinetemp", p + 16 /* rotate which disc it's on */)); > +#endif -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:10:48 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:10:48 +0100 Subject: [Box Backup-dev] COMMIT r841 - box/chris/retry-debug/lib/backupstore Message-ID: Author: chris Date: 2006-08-31 09:10:48 +0100 (Thu, 31 Aug 2006) New Revision: 841 Modified: box/chris/retry-debug/lib/backupstore/BackupStoreCheck.cpp Log: * lib/backupstore/BackupStoreCheck.cpp - Reuse existing variable rather than duplicating it Modified: box/chris/retry-debug/lib/backupstore/BackupStoreCheck.cpp =================================================================== --- box/chris/retry-debug/lib/backupstore/BackupStoreCheck.cpp 2006-08-31 08:01:43 UTC (rev 840) +++ box/chris/retry-debug/lib/backupstore/BackupStoreCheck.cpp 2006-08-31 08:10:48 UTC (rev 841) @@ -466,11 +466,10 @@ } // Add to usage counts - int64_t s = file->GetDiscUsageInBlocks(); - mBlocksUsed += s; + mBlocksUsed += size; if(!isFile) { - mBlocksInDirectories += s; + mBlocksInDirectories += size; } } catch(...) From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:12:00 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:12:00 +0100 Subject: [Box Backup-dev] COMMIT r842 - box/chris/retry-debug/bin/bbackupd Message-ID: Author: chris Date: 2006-08-31 09:12:00 +0100 (Thu, 31 Aug 2006) New Revision: 842 Modified: box/chris/retry-debug/bin/bbackupd/Win32BackupService.h Log: * bin/bbackupd/Win32BackupService.h - Prototype update to match changes to Win32BackupService.cpp Modified: box/chris/retry-debug/bin/bbackupd/Win32BackupService.h =================================================================== --- box/chris/retry-debug/bin/bbackupd/Win32BackupService.h 2006-08-31 08:10:48 UTC (rev 841) +++ box/chris/retry-debug/bin/bbackupd/Win32BackupService.h 2006-08-31 08:12:00 UTC (rev 842) @@ -12,7 +12,7 @@ class Win32BackupService : public BackupDaemon { public: - DWORD WinService(void); + DWORD WinService(const char* pConfigFileName); }; #endif // WIN32 From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:12:48 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:12:48 +0100 Subject: [Box Backup-dev] COMMIT r843 - box/chris/retry-debug/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:12:47 +0100 (Thu, 31 Aug 2006) New Revision: 843 Modified: box/chris/retry-debug/bin/bbstored/BackupContext.cpp Log: * bin/bbstored/BackupContext.cpp - Removed locking on Win32, there is no housekeeping process to lock against - Open files with O_BINARY on Win32 - Fixed a cosmetic spelling mistake in a comment - Unlink file later on Windows, since we can't do it while it's open Modified: box/chris/retry-debug/bin/bbstored/BackupContext.cpp =================================================================== --- box/chris/retry-debug/bin/bbstored/BackupContext.cpp 2006-08-31 08:12:00 UTC (rev 842) +++ box/chris/retry-debug/bin/bbstored/BackupContext.cpp 2006-08-31 08:12:47 UTC (rev 843) @@ -125,6 +125,7 @@ // -------------------------------------------------------------------------- bool BackupContext::AttemptToGetWriteLock() { +#ifndef WIN32 // Make the filename of the write lock file std::string writeLockFile; StoreStructure::MakeWriteLockFilename(mStoreRoot, mStoreDiscSet, writeLockFile); @@ -150,7 +151,7 @@ } while(!gotLock && tries > 0); } - + if(gotLock) { // Got the lock, mark as not read only @@ -158,6 +159,10 @@ } return gotLock; +#else // WIN32 + // no housekeeping process, we do have the lock + return true; +#endif // !WIN32 } @@ -453,13 +458,21 @@ try { // Open it twice +#ifdef WIN32 + FileStream diff(tempFn.c_str(), + O_RDWR | O_CREAT | O_BINARY); + FileStream diff2(tempFn.c_str(), + O_RDWR | O_BINARY); +#else FileStream diff(tempFn.c_str(), O_RDWR | O_CREAT | O_EXCL); FileStream diff2(tempFn.c_str(), O_RDONLY); - // Unlink it immediately, so it definately goes away + + // Unlink it immediately, so it definitely goes away if(::unlink(tempFn.c_str()) != 0) { THROW_EXCEPTION(CommonException, OSFileError); } +#endif // Stream the incoming diff to this temporary file if(!rFile.CopyStreamTo(diff, BACKUP_STORE_TIMEOUT)) @@ -508,6 +521,14 @@ ::unlink(tempFn.c_str()); throw; } + +#ifdef WIN32 + // we can't delete the file while it's open, above + if(::unlink(tempFn.c_str()) != 0) + { + THROW_EXCEPTION(CommonException, OSFileError); + } +#endif } // Get the blocks used From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:13:39 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:13:39 +0100 Subject: [Box Backup-dev] COMMIT r844 - box/chris/retry-debug/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:13:39 +0100 (Thu, 31 Aug 2006) New Revision: 844 Modified: box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.cpp Log: * bin/bbstored/BackupStoreDaemon.cpp - Only include if we have it Modified: box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.cpp =================================================================== --- box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.cpp 2006-08-31 08:12:47 UTC (rev 843) +++ box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.cpp 2006-08-31 08:13:39 UTC (rev 844) @@ -11,9 +11,12 @@ #include #include -#include #include +#ifdef HAVE_SYSLOG_H + #include +#endif + #include "BackupContext.h" #include "BackupStoreDaemon.h" #include "BackupStoreConfigVerify.h" From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:14:19 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:14:19 +0100 Subject: [Box Backup-dev] COMMIT r845 - box/chris/retry-debug/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:14:19 +0100 (Thu, 31 Aug 2006) New Revision: 845 Modified: box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.cpp Log: * bin/bbstored/BackupStoreDaemon.cpp - Cast off_t to long long, in case they differ in size (e.g. Win32) Modified: box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.cpp =================================================================== --- box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.cpp 2006-08-31 08:13:39 UTC (rev 844) +++ box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.cpp 2006-08-31 08:14:19 UTC (rev 845) @@ -300,6 +300,8 @@ // Log the amount of data transferred ::syslog(LOG_INFO, "Connection statistics for %s: " "IN=%lld OUT=%lld TOTAL=%lld\n", commonName, - s.GetBytesRead(), s.GetBytesWritten(), - s.GetBytesRead() + s.GetBytesWritten()); + (long long)s.GetBytesRead(), + (long long)s.GetBytesWritten(), + (long long)s.GetBytesRead() + + (long long)s.GetBytesWritten()); } From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:15:01 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:15:01 +0100 Subject: [Box Backup-dev] COMMIT r846 - box/chris/retry-debug/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:15:01 +0100 (Thu, 31 Aug 2006) New Revision: 846 Modified: box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.h Log: * bin/bbstored/BackupStoreDaemon.h - Removed SendMessageToHousekeepingProcess() on Win32, no longer needed Modified: box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.h =================================================================== --- box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.h 2006-08-31 08:14:19 UTC (rev 845) +++ box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.h 2006-08-31 08:15:01 UTC (rev 846) @@ -38,11 +38,13 @@ BackupStoreDaemon(const BackupStoreDaemon &rToCopy); public: - // For BackupContext to comminicate with housekeeping process +#ifndef WIN32 + // For BackupContext to communicate with housekeeping process void SendMessageToHousekeepingProcess(const void *Msg, int MsgLen) { mInterProcessCommsSocket.Write(Msg, MsgLen); } +#endif protected: From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:16:26 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:16:26 +0100 Subject: [Box Backup-dev] COMMIT r847 - box/chris/retry-debug/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:16:26 +0100 (Thu, 31 Aug 2006) New Revision: 847 Modified: box/chris/retry-debug/bin/bbstored/BBStoreDHousekeeping.cpp Log: * bin/bbstored/BBStoreDHousekeeping.cpp - Only include syslog.h if we have one Modified: box/chris/retry-debug/bin/bbstored/BBStoreDHousekeeping.cpp =================================================================== --- box/chris/retry-debug/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-31 08:15:01 UTC (rev 846) +++ box/chris/retry-debug/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-31 08:16:26 UTC (rev 847) @@ -10,8 +10,11 @@ #include "Box.h" #include -#include +#ifdef HAVE_SYSLOG_H + #include +#endif + #include "BackupStoreDaemon.h" #include "BackupStoreAccountDatabase.h" #include "BackupStoreAccounts.h" From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:17:04 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:17:04 +0100 Subject: [Box Backup-dev] COMMIT r848 - box/chris/retry-debug/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:17:04 +0100 (Thu, 31 Aug 2006) New Revision: 848 Modified: box/chris/retry-debug/bin/bbstored/BBStoreDHousekeeping.cpp box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.h Log: * bin/bbstored/BackupStoreDaemon.h * bin/bbstored/BBStoreDHousekeeping.cpp - Split housekeeping process into separate initialisation, process loop and run methods (we don't want the process loop on Win32) Modified: box/chris/retry-debug/bin/bbstored/BBStoreDHousekeeping.cpp =================================================================== --- box/chris/retry-debug/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-31 08:16:26 UTC (rev 847) +++ box/chris/retry-debug/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-31 08:17:04 UTC (rev 848) @@ -32,96 +32,122 @@ // Created: 11/12/03 // // -------------------------------------------------------------------------- +void BackupStoreDaemon::HousekeepingInit() +{ + + mLastHousekeepingRun = 0; +} + void BackupStoreDaemon::HousekeepingProcess() { + HousekeepingInit(); + // Get the time between housekeeping runs const Configuration &rconfig(GetConfiguration()); int64_t housekeepingInterval = SecondsToBoxTime(rconfig.GetKeyValueInt("TimeBetweenHousekeeping")); - - int64_t lastHousekeepingRun = 0; while(!StopRun()) { - // Time now + RunHousekeepingIfNeeded(); + + // Calculate how long should wait before doing the next housekeeping run int64_t timeNow = GetCurrentBoxTime(); - // Do housekeeping if the time interval has elapsed since the last check - if((timeNow - lastHousekeepingRun) >= housekeepingInterval) - { - // Store the time - lastHousekeepingRun = timeNow; - ::syslog(LOG_INFO, "Starting housekeeping"); + time_t secondsToGo = BoxTimeToSeconds( + (mLastHousekeepingRun + housekeepingInterval) - + timeNow); + if(secondsToGo < 1) secondsToGo = 1; + if(secondsToGo > 60) secondsToGo = 60; + int32_t millisecondsToGo = ((int)secondsToGo) * 1000; + + // Check to see if there's any message pending + CheckForInterProcessMsg(0 /* no account */, millisecondsToGo); + } +} - // Get the list of accounts - std::vector accounts; - if(mpAccountDatabase) - { - mpAccountDatabase->GetAllAccountIDs(accounts); - } +void BackupStoreDaemon::RunHousekeepingIfNeeded() +{ + // Get the time between housekeeping runs + const Configuration &rconfig(GetConfiguration()); + int64_t housekeepingInterval = SecondsToBoxTime(rconfig.GetKeyValueInt("TimeBetweenHousekeeping")); + + // Time now + int64_t timeNow = GetCurrentBoxTime(); + // Do housekeeping if the time interval has elapsed since the last check + if((timeNow - mLastHousekeepingRun) < housekeepingInterval) + { + return; + } + + // Store the time + mLastHousekeepingRun = timeNow; + ::syslog(LOG_INFO, "Starting housekeeping"); + + // Get the list of accounts + std::vector accounts; + if(mpAccountDatabase) + { + mpAccountDatabase->GetAllAccountIDs(accounts); + } - SetProcessTitle("housekeeping, active"); + SetProcessTitle("housekeeping, active"); - // Check them all - for(std::vector::const_iterator i = accounts.begin(); i != accounts.end(); ++i) + // Check them all + for(std::vector::const_iterator i = accounts.begin(); i != accounts.end(); ++i) + { + try + { + if(mpAccounts) { - try - { - if(mpAccounts) - { - // Get the account root - std::string rootDir; - int discSet = 0; - mpAccounts->GetAccountRoot(*i, rootDir, discSet); - - // Do housekeeping on this account - HousekeepStoreAccount housekeeping(*i, rootDir, discSet, *this); - housekeeping.DoHousekeeping(); - } - } - catch(BoxException &e) - { - ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s (%d/%d) -- aborting housekeeping run for this account", - *i, e.what(), e.GetType(), e.GetSubType()); - } - catch(std::exception &e) - { - ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s -- aborting housekeeping run for this account", - *i, e.what()); - } - catch(...) - { - ::syslog(LOG_ERR, "while housekeeping account %08X, unknown exception -- aborting housekeeping run for this account", - *i); - } + // Get the account root + std::string rootDir; + int discSet = 0; + mpAccounts->GetAccountRoot(*i, rootDir, discSet); - // Check to see if there's any message pending - CheckForInterProcessMsg(0 /* no account */); - - // Stop early? - if(StopRun()) - { - break; - } + // Do housekeeping on this account + HousekeepStoreAccount housekeeping(*i, rootDir, discSet, *this); + housekeeping.DoHousekeeping(); } - - ::syslog(LOG_INFO, "Finished housekeeping"); } - - // Placed here for accuracy, if StopRun() is true, for example. - SetProcessTitle("housekeeping, idle"); - - // Calculate how long should wait before doing the next housekeeping run - timeNow = GetCurrentBoxTime(); - time_t secondsToGo = BoxTimeToSeconds((lastHousekeepingRun + housekeepingInterval) - timeNow); + catch(BoxException &e) + { + ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s (%d/%d) -- aborting housekeeping run for this account", + *i, e.what(), e.GetType(), e.GetSubType()); + } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s -- aborting housekeeping run for this account", + *i, e.what()); + } + catch(...) + { + ::syslog(LOG_ERR, "while housekeeping account %08X, unknown exception -- aborting housekeeping run for this account", + *i); + } + + int64_t timeNow = GetCurrentBoxTime(); + time_t secondsToGo = BoxTimeToSeconds( + (mLastHousekeepingRun + housekeepingInterval) - + timeNow); if(secondsToGo < 1) secondsToGo = 1; if(secondsToGo > 60) secondsToGo = 60; int32_t millisecondsToGo = ((int)secondsToGo) * 1000; - + // Check to see if there's any message pending CheckForInterProcessMsg(0 /* no account */, millisecondsToGo); + + // Stop early? + if(StopRun()) + { + break; + } } + + ::syslog(LOG_INFO, "Finished housekeeping"); + + // Placed here for accuracy, if StopRun() is true, for example. + SetProcessTitle("housekeeping, idle"); } - // -------------------------------------------------------------------------- // // Function Modified: box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.h =================================================================== --- box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.h 2006-08-31 08:16:26 UTC (rev 847) +++ box/chris/retry-debug/bin/bbstored/BackupStoreDaemon.h 2006-08-31 08:17:04 UTC (rev 848) @@ -74,6 +74,10 @@ SocketStream mInterProcessCommsSocket; IOStreamGetLine mInterProcessComms; + + void HousekeepingInit(); + void RunHousekeepingIfNeeded(); + int64_t mLastHousekeepingRun; }; From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:17:39 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:17:39 +0100 Subject: [Box Backup-dev] COMMIT r849 - box/chris/retry-debug/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:17:39 +0100 (Thu, 31 Aug 2006) New Revision: 849 Modified: box/chris/retry-debug/bin/bbstored/HousekeepStoreAccount.cpp Log: * bin/bbstored/HousekeepStoreAccount.cpp - Disable checks for inter-process messages on Win32 (there is only one process) - Close directory immediately after we finish reading it Modified: box/chris/retry-debug/bin/bbstored/HousekeepStoreAccount.cpp =================================================================== --- box/chris/retry-debug/bin/bbstored/HousekeepStoreAccount.cpp 2006-08-31 08:17:04 UTC (rev 848) +++ box/chris/retry-debug/bin/bbstored/HousekeepStoreAccount.cpp 2006-08-31 08:17:39 UTC (rev 849) @@ -225,6 +225,7 @@ // -------------------------------------------------------------------------- bool HousekeepStoreAccount::ScanDirectory(int64_t ObjectID) { +#ifndef WIN32 if((--mCountUntilNextInterprocessMsgCheck) <= 0) { mCountUntilNextInterprocessMsgCheck = POLL_INTERPROCESS_MSG_CHECK_FREQUENCY; @@ -235,6 +236,7 @@ return false; } } +#endif // Get the filename std::string objectFilename; @@ -251,6 +253,7 @@ // Read the directory in BackupStoreDirectory dir; dir.ReadFromStream(*dirStream, IOStream::TimeOutInfinite); + dirStream->Close(); // Is it empty? if(dir.GetNumberOfEntries() == 0) @@ -485,6 +488,7 @@ // (there is likely to be more in the set than should be actually deleted). for(std::set::iterator i(mPotentialDeletions.begin()); i != mPotentialDeletions.end(); ++i) { +#ifndef WIN32 if((--mCountUntilNextInterprocessMsgCheck) <= 0) { mCountUntilNextInterprocessMsgCheck = POLL_INTERPROCESS_MSG_CHECK_FREQUENCY; @@ -495,6 +499,7 @@ return true; } } +#endif // Load up the directory it's in // Get the filename @@ -729,6 +734,7 @@ // Go through list for(std::vector::const_iterator i(mEmptyDirectories.begin()); i != mEmptyDirectories.end(); ++i) { +#ifndef WIN32 if((--mCountUntilNextInterprocessMsgCheck) <= 0) { mCountUntilNextInterprocessMsgCheck = POLL_INTERPROCESS_MSG_CHECK_FREQUENCY; @@ -739,6 +745,7 @@ return true; } } +#endif // Do not delete the root directory if(*i == BACKUPSTORE_ROOT_DIRECTORY_ID) From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:18:08 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Thu, 31 Aug 2006 09:18:08 +0100 Subject: [Box Backup-dev] Can't add attachments in trac In-Reply-To: <1157010100.14100.3.camel@avenin.ebourne.me.uk> References: <1156978910.2413.2.camel@avenin.ebourne.me.uk> <20060831071858.GB81028@netinertia.co.uk> <1157010100.14100.3.camel@avenin.ebourne.me.uk> Message-ID: <20060831081808.GD81028@netinertia.co.uk> On Thu, Aug 31, 2006 at 08:41:40AM +0100, Martin Ebourne wrote: > On Thu, 2006-08-31 at 08:18 +0100, James O'Gorman wrote: > > Sorry, forgot to add the ACL for that directory. Should be fixed now, > > but let me know if not. > > That's working now thanks. Great. > But the next thing is that attachments are not being displayed as diffs. > On ticket #4 (http://bbdev.fluffy.co.uk/trac/ticket/4) I've attached a > patch as both .patch and .diff but it's being displayed as a regular > text file. > > cf. http://svn.mythtv.org/trac/ticket/800 if you click on the .patch in > that ticket you'll see it's displayed as a diff in the same way as the > svn changesets. > > Maybe an issue with mime types/or file type detection? Ah, a limitation of SilverCity (see http://trac.edgewall.org/wiki/TracSyntaxColoring). I'll have a go at installing enscript later, but there's no FreeBSD port currently so I'll quickly write one... James From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:18:24 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 08:18:24 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.7cb218973ffb75672f4da24ea1e0fa63@fluffy.co.uk> --===============0318154469== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIEFsbCBtZXJnZWQgdG8g ZGF0ZSBleGNlcHQgWzgxOV0gYW5kIFs4NDBdLg0KDQotLSANClRpY2tldCBVUkw6IDxodHRwOi8v YmJkZXYuZmx1ZmZ5LmNvLnVrL3RyYWMvdGlja2V0LzM+DQpCb3ggQmFja3VwIDxodHRwOi8vd3d3 LmZsdWZmeS5jby51ay9ib3hiYWNrdXAvPg0KQW4gb3BlbiBzb3VyY2UsIGNvbXBsZXRlbHkgYXV0 b21hdGljIG9uLWxpbmUgYmFja3VwIHN5c3RlbSBmb3IgVU5JWC4= --===============0318154469==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:39:52 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:39:52 +0100 Subject: [Box Backup-dev] COMMIT r850 - box/trunk/bin/bbackupd Message-ID: Author: chris Date: 2006-08-31 09:39:51 +0100 (Thu, 31 Aug 2006) New Revision: 850 Modified: box/trunk/bin/bbackupd/Win32BackupService.h Log: * bin/bbackupd/Win32BackupService.h - Prototype update to match changes to Win32BackupService.cpp Modified: box/trunk/bin/bbackupd/Win32BackupService.h =================================================================== --- box/trunk/bin/bbackupd/Win32BackupService.h 2006-08-31 08:17:39 UTC (rev 849) +++ box/trunk/bin/bbackupd/Win32BackupService.h 2006-08-31 08:39:51 UTC (rev 850) @@ -12,7 +12,7 @@ class Win32BackupService : public BackupDaemon { public: - DWORD WinService(void); + DWORD WinService(const char* pConfigFileName); }; #endif // WIN32 From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:40:31 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:40:31 +0100 Subject: [Box Backup-dev] COMMIT r851 - box/trunk/lib/backupstore Message-ID: Author: chris Date: 2006-08-31 09:40:31 +0100 (Thu, 31 Aug 2006) New Revision: 851 Modified: box/trunk/lib/backupstore/BackupStoreCheck.cpp Log: * boxbackup/lib/backupstore/BackupStoreCheck.cpp - Reuse existing variable rather than duplicating it Modified: box/trunk/lib/backupstore/BackupStoreCheck.cpp =================================================================== --- box/trunk/lib/backupstore/BackupStoreCheck.cpp 2006-08-31 08:39:51 UTC (rev 850) +++ box/trunk/lib/backupstore/BackupStoreCheck.cpp 2006-08-31 08:40:31 UTC (rev 851) @@ -466,11 +466,10 @@ } // Add to usage counts - int64_t s = file->GetDiscUsageInBlocks(); - mBlocksUsed += s; + mBlocksUsed += size; if(!isFile) { - mBlocksInDirectories += s; + mBlocksInDirectories += size; } } catch(...) From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:41:05 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:41:05 +0100 Subject: [Box Backup-dev] COMMIT r852 - box/trunk/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:41:05 +0100 (Thu, 31 Aug 2006) New Revision: 852 Modified: box/trunk/bin/bbstored/BackupContext.cpp Log: * bin/bbstored/BackupContext.cpp - Removed locking on Win32, there is no housekeeping process to lock against - Open files with O_BINARY on Win32 - Fixed a cosmetic spelling mistake in a comment - Unlink file later on Windows, since we can't do it while it's open Modified: box/trunk/bin/bbstored/BackupContext.cpp =================================================================== --- box/trunk/bin/bbstored/BackupContext.cpp 2006-08-31 08:40:31 UTC (rev 851) +++ box/trunk/bin/bbstored/BackupContext.cpp 2006-08-31 08:41:05 UTC (rev 852) @@ -125,6 +125,7 @@ // -------------------------------------------------------------------------- bool BackupContext::AttemptToGetWriteLock() { +#ifndef WIN32 // Make the filename of the write lock file std::string writeLockFile; StoreStructure::MakeWriteLockFilename(mStoreRoot, mStoreDiscSet, writeLockFile); @@ -150,7 +151,7 @@ } while(!gotLock && tries > 0); } - + if(gotLock) { // Got the lock, mark as not read only @@ -158,6 +159,10 @@ } return gotLock; +#else // WIN32 + // no housekeeping process, we do have the lock + return true; +#endif // !WIN32 } @@ -453,13 +458,21 @@ try { // Open it twice +#ifdef WIN32 + FileStream diff(tempFn.c_str(), + O_RDWR | O_CREAT | O_BINARY); + FileStream diff2(tempFn.c_str(), + O_RDWR | O_BINARY); +#else FileStream diff(tempFn.c_str(), O_RDWR | O_CREAT | O_EXCL); FileStream diff2(tempFn.c_str(), O_RDONLY); - // Unlink it immediately, so it definately goes away + + // Unlink it immediately, so it definitely goes away if(::unlink(tempFn.c_str()) != 0) { THROW_EXCEPTION(CommonException, OSFileError); } +#endif // Stream the incoming diff to this temporary file if(!rFile.CopyStreamTo(diff, BACKUP_STORE_TIMEOUT)) @@ -508,6 +521,14 @@ ::unlink(tempFn.c_str()); throw; } + +#ifdef WIN32 + // we can't delete the file while it's open, above + if(::unlink(tempFn.c_str()) != 0) + { + THROW_EXCEPTION(CommonException, OSFileError); + } +#endif } // Get the blocks used From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:41:33 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:41:33 +0100 Subject: [Box Backup-dev] COMMIT r853 - box/trunk/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:41:33 +0100 (Thu, 31 Aug 2006) New Revision: 853 Modified: box/trunk/bin/bbstored/BackupStoreDaemon.cpp Log: * bin/bbstored/BackupStoreDaemon.cpp - Only include if we have it Modified: box/trunk/bin/bbstored/BackupStoreDaemon.cpp =================================================================== --- box/trunk/bin/bbstored/BackupStoreDaemon.cpp 2006-08-31 08:41:05 UTC (rev 852) +++ box/trunk/bin/bbstored/BackupStoreDaemon.cpp 2006-08-31 08:41:33 UTC (rev 853) @@ -11,9 +11,12 @@ #include #include -#include #include +#ifdef HAVE_SYSLOG_H + #include +#endif + #include "BackupContext.h" #include "BackupStoreDaemon.h" #include "BackupStoreConfigVerify.h" From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:41:58 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:41:58 +0100 Subject: [Box Backup-dev] COMMIT r854 - box/trunk/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:41:58 +0100 (Thu, 31 Aug 2006) New Revision: 854 Modified: box/trunk/bin/bbstored/BackupStoreDaemon.cpp Log: * bin/bbstored/BackupStoreDaemon.cpp - Cast off_t to long long, in case they differ in size (e.g. Win32) Modified: box/trunk/bin/bbstored/BackupStoreDaemon.cpp =================================================================== --- box/trunk/bin/bbstored/BackupStoreDaemon.cpp 2006-08-31 08:41:33 UTC (rev 853) +++ box/trunk/bin/bbstored/BackupStoreDaemon.cpp 2006-08-31 08:41:58 UTC (rev 854) @@ -300,6 +300,8 @@ // Log the amount of data transferred ::syslog(LOG_INFO, "Connection statistics for %s: " "IN=%lld OUT=%lld TOTAL=%lld\n", commonName, - s.GetBytesRead(), s.GetBytesWritten(), - s.GetBytesRead() + s.GetBytesWritten()); + (long long)s.GetBytesRead(), + (long long)s.GetBytesWritten(), + (long long)s.GetBytesRead() + + (long long)s.GetBytesWritten()); } From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:42:30 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:42:30 +0100 Subject: [Box Backup-dev] COMMIT r855 - box/trunk/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:42:30 +0100 (Thu, 31 Aug 2006) New Revision: 855 Modified: box/trunk/bin/bbstored/BackupStoreDaemon.h Log: * bin/bbstored/BackupStoreDaemon.h - Removed SendMessageToHousekeepingProcess() on Win32, no longer needed Modified: box/trunk/bin/bbstored/BackupStoreDaemon.h =================================================================== --- box/trunk/bin/bbstored/BackupStoreDaemon.h 2006-08-31 08:41:58 UTC (rev 854) +++ box/trunk/bin/bbstored/BackupStoreDaemon.h 2006-08-31 08:42:30 UTC (rev 855) @@ -38,11 +38,13 @@ BackupStoreDaemon(const BackupStoreDaemon &rToCopy); public: - // For BackupContext to comminicate with housekeeping process +#ifndef WIN32 + // For BackupContext to communicate with housekeeping process void SendMessageToHousekeepingProcess(const void *Msg, int MsgLen) { mInterProcessCommsSocket.Write(Msg, MsgLen); } +#endif protected: From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:42:51 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:42:51 +0100 Subject: [Box Backup-dev] COMMIT r856 - box/trunk/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:42:51 +0100 (Thu, 31 Aug 2006) New Revision: 856 Modified: box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp Log: * bin/bbstored/BBStoreDHousekeeping.cpp - Only include syslog.h if we have one Modified: box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp =================================================================== --- box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-31 08:42:30 UTC (rev 855) +++ box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-31 08:42:51 UTC (rev 856) @@ -10,8 +10,11 @@ #include "Box.h" #include -#include +#ifdef HAVE_SYSLOG_H + #include +#endif + #include "BackupStoreDaemon.h" #include "BackupStoreAccountDatabase.h" #include "BackupStoreAccounts.h" From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:43:17 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:43:17 +0100 Subject: [Box Backup-dev] COMMIT r857 - box/trunk/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:43:17 +0100 (Thu, 31 Aug 2006) New Revision: 857 Modified: box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp box/trunk/bin/bbstored/BackupStoreDaemon.h Log: * bin/bbstored/BackupStoreDaemon.h * bin/bbstored/BBStoreDHousekeeping.cpp - Split housekeeping process into separate initialisation, process loop and run methods (we don't want the process loop on Win32) Modified: box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp =================================================================== --- box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-31 08:42:51 UTC (rev 856) +++ box/trunk/bin/bbstored/BBStoreDHousekeeping.cpp 2006-08-31 08:43:17 UTC (rev 857) @@ -32,96 +32,122 @@ // Created: 11/12/03 // // -------------------------------------------------------------------------- +void BackupStoreDaemon::HousekeepingInit() +{ + + mLastHousekeepingRun = 0; +} + void BackupStoreDaemon::HousekeepingProcess() { + HousekeepingInit(); + // Get the time between housekeeping runs const Configuration &rconfig(GetConfiguration()); int64_t housekeepingInterval = SecondsToBoxTime(rconfig.GetKeyValueInt("TimeBetweenHousekeeping")); - - int64_t lastHousekeepingRun = 0; while(!StopRun()) { - // Time now + RunHousekeepingIfNeeded(); + + // Calculate how long should wait before doing the next housekeeping run int64_t timeNow = GetCurrentBoxTime(); - // Do housekeeping if the time interval has elapsed since the last check - if((timeNow - lastHousekeepingRun) >= housekeepingInterval) - { - // Store the time - lastHousekeepingRun = timeNow; - ::syslog(LOG_INFO, "Starting housekeeping"); + time_t secondsToGo = BoxTimeToSeconds( + (mLastHousekeepingRun + housekeepingInterval) - + timeNow); + if(secondsToGo < 1) secondsToGo = 1; + if(secondsToGo > 60) secondsToGo = 60; + int32_t millisecondsToGo = ((int)secondsToGo) * 1000; + + // Check to see if there's any message pending + CheckForInterProcessMsg(0 /* no account */, millisecondsToGo); + } +} - // Get the list of accounts - std::vector accounts; - if(mpAccountDatabase) - { - mpAccountDatabase->GetAllAccountIDs(accounts); - } +void BackupStoreDaemon::RunHousekeepingIfNeeded() +{ + // Get the time between housekeeping runs + const Configuration &rconfig(GetConfiguration()); + int64_t housekeepingInterval = SecondsToBoxTime(rconfig.GetKeyValueInt("TimeBetweenHousekeeping")); + + // Time now + int64_t timeNow = GetCurrentBoxTime(); + // Do housekeeping if the time interval has elapsed since the last check + if((timeNow - mLastHousekeepingRun) < housekeepingInterval) + { + return; + } + + // Store the time + mLastHousekeepingRun = timeNow; + ::syslog(LOG_INFO, "Starting housekeeping"); + + // Get the list of accounts + std::vector accounts; + if(mpAccountDatabase) + { + mpAccountDatabase->GetAllAccountIDs(accounts); + } - SetProcessTitle("housekeeping, active"); + SetProcessTitle("housekeeping, active"); - // Check them all - for(std::vector::const_iterator i = accounts.begin(); i != accounts.end(); ++i) + // Check them all + for(std::vector::const_iterator i = accounts.begin(); i != accounts.end(); ++i) + { + try + { + if(mpAccounts) { - try - { - if(mpAccounts) - { - // Get the account root - std::string rootDir; - int discSet = 0; - mpAccounts->GetAccountRoot(*i, rootDir, discSet); - - // Do housekeeping on this account - HousekeepStoreAccount housekeeping(*i, rootDir, discSet, *this); - housekeeping.DoHousekeeping(); - } - } - catch(BoxException &e) - { - ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s (%d/%d) -- aborting housekeeping run for this account", - *i, e.what(), e.GetType(), e.GetSubType()); - } - catch(std::exception &e) - { - ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s -- aborting housekeeping run for this account", - *i, e.what()); - } - catch(...) - { - ::syslog(LOG_ERR, "while housekeeping account %08X, unknown exception -- aborting housekeeping run for this account", - *i); - } + // Get the account root + std::string rootDir; + int discSet = 0; + mpAccounts->GetAccountRoot(*i, rootDir, discSet); - // Check to see if there's any message pending - CheckForInterProcessMsg(0 /* no account */); - - // Stop early? - if(StopRun()) - { - break; - } + // Do housekeeping on this account + HousekeepStoreAccount housekeeping(*i, rootDir, discSet, *this); + housekeeping.DoHousekeeping(); } - - ::syslog(LOG_INFO, "Finished housekeeping"); } - - // Placed here for accuracy, if StopRun() is true, for example. - SetProcessTitle("housekeeping, idle"); - - // Calculate how long should wait before doing the next housekeeping run - timeNow = GetCurrentBoxTime(); - time_t secondsToGo = BoxTimeToSeconds((lastHousekeepingRun + housekeepingInterval) - timeNow); + catch(BoxException &e) + { + ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s (%d/%d) -- aborting housekeeping run for this account", + *i, e.what(), e.GetType(), e.GetSubType()); + } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "while housekeeping account %08X, exception %s -- aborting housekeeping run for this account", + *i, e.what()); + } + catch(...) + { + ::syslog(LOG_ERR, "while housekeeping account %08X, unknown exception -- aborting housekeeping run for this account", + *i); + } + + int64_t timeNow = GetCurrentBoxTime(); + time_t secondsToGo = BoxTimeToSeconds( + (mLastHousekeepingRun + housekeepingInterval) - + timeNow); if(secondsToGo < 1) secondsToGo = 1; if(secondsToGo > 60) secondsToGo = 60; int32_t millisecondsToGo = ((int)secondsToGo) * 1000; - + // Check to see if there's any message pending CheckForInterProcessMsg(0 /* no account */, millisecondsToGo); + + // Stop early? + if(StopRun()) + { + break; + } } + + ::syslog(LOG_INFO, "Finished housekeeping"); + + // Placed here for accuracy, if StopRun() is true, for example. + SetProcessTitle("housekeeping, idle"); } - // -------------------------------------------------------------------------- // // Function Modified: box/trunk/bin/bbstored/BackupStoreDaemon.h =================================================================== --- box/trunk/bin/bbstored/BackupStoreDaemon.h 2006-08-31 08:42:51 UTC (rev 856) +++ box/trunk/bin/bbstored/BackupStoreDaemon.h 2006-08-31 08:43:17 UTC (rev 857) @@ -74,6 +74,10 @@ SocketStream mInterProcessCommsSocket; IOStreamGetLine mInterProcessComms; + + void HousekeepingInit(); + void RunHousekeepingIfNeeded(); + int64_t mLastHousekeepingRun; }; From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:43:42 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:43:42 +0100 Subject: [Box Backup-dev] COMMIT r858 - box/trunk/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 09:43:42 +0100 (Thu, 31 Aug 2006) New Revision: 858 Modified: box/trunk/bin/bbstored/HousekeepStoreAccount.cpp Log: * bin/bbstored/HousekeepStoreAccount.cpp - Disable checks for inter-process messages on Win32 (there is only one process) - Close directory immediately after we finish reading it Modified: box/trunk/bin/bbstored/HousekeepStoreAccount.cpp =================================================================== --- box/trunk/bin/bbstored/HousekeepStoreAccount.cpp 2006-08-31 08:43:17 UTC (rev 857) +++ box/trunk/bin/bbstored/HousekeepStoreAccount.cpp 2006-08-31 08:43:42 UTC (rev 858) @@ -225,6 +225,7 @@ // -------------------------------------------------------------------------- bool HousekeepStoreAccount::ScanDirectory(int64_t ObjectID) { +#ifndef WIN32 if((--mCountUntilNextInterprocessMsgCheck) <= 0) { mCountUntilNextInterprocessMsgCheck = POLL_INTERPROCESS_MSG_CHECK_FREQUENCY; @@ -235,6 +236,7 @@ return false; } } +#endif // Get the filename std::string objectFilename; @@ -251,6 +253,7 @@ // Read the directory in BackupStoreDirectory dir; dir.ReadFromStream(*dirStream, IOStream::TimeOutInfinite); + dirStream->Close(); // Is it empty? if(dir.GetNumberOfEntries() == 0) @@ -485,6 +488,7 @@ // (there is likely to be more in the set than should be actually deleted). for(std::set::iterator i(mPotentialDeletions.begin()); i != mPotentialDeletions.end(); ++i) { +#ifndef WIN32 if((--mCountUntilNextInterprocessMsgCheck) <= 0) { mCountUntilNextInterprocessMsgCheck = POLL_INTERPROCESS_MSG_CHECK_FREQUENCY; @@ -495,6 +499,7 @@ return true; } } +#endif // Load up the directory it's in // Get the filename @@ -729,6 +734,7 @@ // Go through list for(std::vector::const_iterator i(mEmptyDirectories.begin()); i != mEmptyDirectories.end(); ++i) { +#ifndef WIN32 if((--mCountUntilNextInterprocessMsgCheck) <= 0) { mCountUntilNextInterprocessMsgCheck = POLL_INTERPROCESS_MSG_CHECK_FREQUENCY; @@ -739,6 +745,7 @@ return true; } } +#endif // Do not delete the root directory if(*i == BACKUPSTORE_ROOT_DIRECTORY_ID) From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:49:52 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:49:52 +0100 Subject: [Box Backup-dev] COMMIT r859 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2006-08-31 09:49:52 +0100 (Thu, 31 Aug 2006) New Revision: 859 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Revert to trunk Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-31 08:43:42 UTC (rev 858) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-31 08:49:52 UTC (rev 859) @@ -262,7 +262,6 @@ #ifdef WIN32 void BackupDaemon::RunHelperThread(void) { - this->mReceivedCommandConn = false; mpCommandSocketInfo = new CommandSocketInfo; WinNamedPipeStream& rSocket(mpCommandSocketInfo->mListeningSocket); @@ -274,6 +273,21 @@ { rSocket.Accept(BOX_NAMED_PIPE_NAME); } + catch (BoxException &e) + { + ::syslog(LOG_ERR, "Failed to open command socket: %s", + e.what()); + SetTerminateWanted(); + break; // this is fatal to listening thread + } + catch (...) + { + ::syslog(LOG_ERR, "Failed to open command socket: " + "unknown error"); + SetTerminateWanted(); + break; // this is fatal to listening thread + } + } catch(std::exception &e) { ::syslog(LOG_ERR, "Failed to open command socket: " @@ -458,7 +472,7 @@ } catch(std::exception &e) { - ::syslog(LOG_WARNING, "Internal error while " + ::syslog(LOG_ERR, "Internal error while " "closing command socket after " "another exception: %s", e.what()); } @@ -925,26 +939,34 @@ } } + // Wait and then cleanup child process + int status = 0; + ::waitpid(pid, &status, 0); } catch(std::exception &e) { ::syslog(LOG_ERR, "Internal error running SyncAllowScript: " "%s", e.what()); + // Clean up + if(pid != 0) + { + int status = 0; + ::waitpid(pid, &status, 0); + } } catch(...) { // Ignore any exceptions // Log that something bad happened ::syslog(LOG_ERR, "Error running SyncAllowScript '%s'", conf.GetKeyValue("SyncAllowScript").c_str()); + // Clean up though + if(pid != 0) + { + int status = 0; + ::waitpid(pid, &status, 0); + } } - // Wait and then cleanup child process, if any - if (pid != 0) - { - int status = 0; - ::waitpid(pid, &status, 0); - } - return waitInSeconds; } @@ -1142,17 +1164,7 @@ { ::syslog(LOG_ERR, "Internal error in command socket thread: " "%s", e.what()); - // If an error occurs, and there is a connection active, just close that - // connection and continue. Otherwise, let the error propagate. - if(mpCommandSocketInfo->mpConnectedSocket.get() == 0) - { - throw; // thread will die - } - else - { - // Close socket and ignore error - CloseCommandConnection(); - } + throw; // thread will die } catch(...) { @@ -2333,16 +2345,10 @@ ::syslog(LOG_INFO, "Saved store object info file '%s'", StoreObjectInfoFile.c_str()); } - catch(std::exception &e) - { - ::syslog(LOG_ERR, "Internal error writing store object " - "info file (%s): %s", - StoreObjectInfoFile.c_str(), e.what()); - } catch(...) { - ::syslog(LOG_ERR, "Internal error writing store object " - "info file (%s): unknown error", + ::syslog(LOG_WARNING, "Requested store object info file '%s' " + "not accessible or could not be created", StoreObjectInfoFile.c_str()); } @@ -2498,14 +2504,12 @@ catch(std::exception &e) { ::syslog(LOG_ERR, "Internal error reading store object " - "info file (%s): %s", - StoreObjectInfoFile.c_str(), e.what()); + "info file: %s", e.what()); } catch(...) { ::syslog(LOG_ERR, "Internal error reading store object " - "info file (%s): unknown error", - StoreObjectInfoFile.c_str()); + "info file: unknown error"); } DeleteAllLocations(); From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:51:45 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 09:51:45 +0100 Subject: [Box Backup-dev] COMMIT r860 - box/chris/merge/bin/bbackupd Message-ID: Author: chris Date: 2006-08-31 09:51:44 +0100 (Thu, 31 Aug 2006) New Revision: 860 Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp Log: * bin/bbackupd/BackupDaemon.cpp - Reinstate missing mReceivedCommandConn - Clean up exception handling Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-31 08:49:52 UTC (rev 859) +++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp 2006-08-31 08:51:44 UTC (rev 860) @@ -262,6 +262,7 @@ #ifdef WIN32 void BackupDaemon::RunHelperThread(void) { + this->mReceivedCommandConn = false; mpCommandSocketInfo = new CommandSocketInfo; WinNamedPipeStream& rSocket(mpCommandSocketInfo->mListeningSocket); @@ -472,7 +473,7 @@ } catch(std::exception &e) { - ::syslog(LOG_ERR, "Internal error while " + ::syslog(LOG_WARNING, "Internal error while " "closing command socket after " "another exception: %s", e.what()); } @@ -939,34 +940,26 @@ } } - // Wait and then cleanup child process - int status = 0; - ::waitpid(pid, &status, 0); } catch(std::exception &e) { ::syslog(LOG_ERR, "Internal error running SyncAllowScript: " "%s", e.what()); - // Clean up - if(pid != 0) - { - int status = 0; - ::waitpid(pid, &status, 0); - } } catch(...) { // Ignore any exceptions // Log that something bad happened ::syslog(LOG_ERR, "Error running SyncAllowScript '%s'", conf.GetKeyValue("SyncAllowScript").c_str()); - // Clean up though - if(pid != 0) - { - int status = 0; - ::waitpid(pid, &status, 0); - } } + // Wait and then cleanup child process, if any + if (pid != 0) + { + int status = 0; + ::waitpid(pid, &status, 0); + } + return waitInSeconds; } @@ -1164,7 +1157,17 @@ { ::syslog(LOG_ERR, "Internal error in command socket thread: " "%s", e.what()); - throw; // thread will die + // If an error occurs, and there is a connection active, just close that + // connection and continue. Otherwise, let the error propagate. + if(mpCommandSocketInfo->mpConnectedSocket.get() == 0) + { + throw; // thread will die + } + else + { + // Close socket and ignore error + CloseCommandConnection(); + } } catch(...) { @@ -2345,10 +2348,16 @@ ::syslog(LOG_INFO, "Saved store object info file '%s'", StoreObjectInfoFile.c_str()); } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Internal error writing store object " + "info file (%s): %s", + StoreObjectInfoFile.c_str(), e.what()); + } catch(...) { - ::syslog(LOG_WARNING, "Requested store object info file '%s' " - "not accessible or could not be created", + ::syslog(LOG_ERR, "Internal error writing store object " + "info file (%s): unknown error", StoreObjectInfoFile.c_str()); } @@ -2504,12 +2513,14 @@ catch(std::exception &e) { ::syslog(LOG_ERR, "Internal error reading store object " - "info file: %s", e.what()); + "info file (%s): %s", + StoreObjectInfoFile.c_str(), e.what()); } catch(...) { ::syslog(LOG_ERR, "Internal error reading store object " - "info file: unknown error"); + "info file (%s): unknown error", + StoreObjectInfoFile.c_str()); } DeleteAllLocations(); From boxbackup-dev at fluffy.co.uk Thu Aug 31 09:52:48 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 08:52:48 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.bf8698d27c4e24351fccb684b9e4f888@fluffy.co.uk> --===============1195115227== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg Wzg2MF0NCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFj L3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3Vw Lz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBz eXN0ZW0gZm9yIFVOSVgu --===============1195115227==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 10:24:59 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 31 Aug 2006 10:24:59 +0100 Subject: [Box Backup-dev] changeset [819] In-Reply-To: References: <1156975704.2413.1.camel@avenin.ebourne.me.uk> Message-ID: <20060831102459.fvnuefdw0848gscc@ebourne.me.uk> Chris Wilson wrote: > On Windows, we cannot reuse the same recombinetemp file, because we > still have it open so we can't delete the old one, so we can't create a > new one with the same name. Therefore, I added a unique part to the end > of the filename (p). This would probably also work on other platforms, > so I can remove the conditionality if you prefer. Yes, I would prefer please. From my point of view there is a simply scary amount of conditional =20 compilation for the windows port. The problem with conditional =20 compilation is that it makes development much harder on every platform =20 and makes it highly likely that breakages are going to occur. This is =20 because (i) large conditional compilations are difficult to read (ii) =20 it is not possible to compile all the code on any platform. Thus as =20 one platform makes changes the other(s) will break from time to time. =20 It similarly makes testing harder. And some changes (such as changing =20 the signature for a method say) where you could rely on the compiler =20 to make sure you did the complete change will now need manual auditing =20 instead. Having said that the priority at the moment is to get a working =20 windows port merged so I'm ignoring this for now. But we should avoid =20 unnecessary conditional compilation where we can and in the future =20 we'll need to go back over all of this lot and rearchitect to reduce =20 the conditional compilation down to a minimum. Many of these could be =20 solved by better division of responsibility and encapsulation in the =20 code. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 31 10:30:17 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 31 Aug 2006 10:30:17 +0100 Subject: [Box Backup-dev] Can't add attachments in trac In-Reply-To: <20060831081808.GD81028@netinertia.co.uk> References: <1156978910.2413.2.camel@avenin.ebourne.me.uk> <20060831071858.GB81028@netinertia.co.uk> <1157010100.14100.3.camel@avenin.ebourne.me.uk> <20060831081808.GD81028@netinertia.co.uk> Message-ID: <20060831103017.zu9mdor7hw8sw4cw@ebourne.me.uk> James O'Gorman wrote: > Ah, a limitation of SilverCity (see > http://trac.edgewall.org/wiki/TracSyntaxColoring). I'll have a go at > installing enscript later, but there's no FreeBSD port currently so I'll > quickly write one... Ah, ok. If it's a lot of trouble then don't waste time on it. It only affects patches and really the syntax formatting stuff is just a nice to have. I was guessing it might have been a configuration issue. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 31 10:49:14 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Thu, 31 Aug 2006 10:49:14 +0100 Subject: [Box Backup-dev] Can't add attachments in trac In-Reply-To: <20060831103017.zu9mdor7hw8sw4cw@ebourne.me.uk> References: <1156978910.2413.2.camel@avenin.ebourne.me.uk> <20060831071858.GB81028@netinertia.co.uk> <1157010100.14100.3.camel@avenin.ebourne.me.uk> <20060831081808.GD81028@netinertia.co.uk> <20060831103017.zu9mdor7hw8sw4cw@ebourne.me.uk> Message-ID: <20060831094914.GE81028@netinertia.co.uk> On Thu, Aug 31, 2006 at 10:30:17AM +0100, Martin Ebourne wrote: > James O'Gorman wrote: > >Ah, a limitation of SilverCity (see > >http://trac.edgewall.org/wiki/TracSyntaxColoring). I'll have a go at > >installing enscript later, but there's no FreeBSD port currently so I'll > >quickly write one... > > Ah, ok. If it's a lot of trouble then don't waste time on it. It only > affects patches and really the syntax formatting stuff is just a nice > to have. I was guessing it might have been a configuration issue. You would think so, wouldn't you. I find it odd that the browser can display diffs OK but attachments can't... Apparently Trac 0.10 is due out any day now so I might see if that will add any worthwhile features or fix things like this. James From boxbackup-dev at fluffy.co.uk Thu Aug 31 12:30:32 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Thu, 31 Aug 2006 12:30:32 +0100 Subject: [Box Backup-dev] changeset [819] In-Reply-To: References: <1156975704.2413.1.camel@avenin.ebourne.me.uk> Message-ID: <44607E9F-2FA6-4A53-9FB3-4E77D7495F8D@fluffy.co.uk> I don't remember writing any 'recombinetemp' things or using the horrid << notation. What exactly is this for? Ben On 31 Aug 2006, at 09:06, Chris Wilson wrote: > Hi Martin, > > On Wed, 30 Aug 2006, Martin Ebourne wrote: > >> I can't see why this code from bin/bbstored/BackupCommands.cpp >> needs to >> be conditionalised: > > On Windows, we cannot reuse the same recombinetemp file, because we > still have it open so we can't delete the old one, so we can't > create a new one with the same name. Therefore, I added a unique > part to the end of the filename (p). This would probably also work > on other platforms, so I can remove the conditionality if you prefer. > > The larger problem is that, on Windows, we never delete these temp > files! It's OK for unit tests, but would be horrible for a real store. > > Cheers, Chris. > >> +#ifdef WIN32 >> + std::ostringstream fs(rContext.GetStoreRoot >> ()); >> + fs << ".recombinetemp."; >> + fs << p; >> + std::string tempFn(fs.str()); >> + tempFn = >> RaidFileController::DiscSetPathToFileSystemPath >> (rContext.GetStoreDiscSet(), tempFn, p + 16); >> +#else >> + std::string >> tempFn(RaidFileController::DiscSetPathToFileSystemPath >> (rContext.GetStoreDiscSet(), rContext.GetStoreRoot() + >> ".recombinetemp", p + 16 /* rotate which disc it's on */)); >> +#endif > -- > _ ___ __ _ > / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | > / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | > \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | > > _______________________________________________ > Boxbackup-dev mailing list > Boxbackup-dev at fluffy.co.uk > http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Thu Aug 31 12:35:24 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 31 Aug 2006 12:35:24 +0100 (BST) Subject: [Box Backup-dev] changeset [819] In-Reply-To: <44607E9F-2FA6-4A53-9FB3-4E77D7495F8D@fluffy.co.uk> References: <1156975704.2413.1.camel@avenin.ebourne.me.uk> <44607E9F-2FA6-4A53-9FB3-4E77D7495F8D@fluffy.co.uk> Message-ID: Hi Ben, On Thu, 31 Aug 2006, Ben Summers wrote: > I don't remember writing any 'recombinetemp' things or using the horrid > << notation. What exactly is this for? You're looking at my patch which adds support for win32. The original code does use recombinetemp but not <<, because it doesn't need to convert ints to strings, which I do (to make unique filenames for each step). As far as I understand, this is the code to produce older versions of store files on demand by applying successive patches (reverse diffs) to the latest version. But I'm not 100% sure, I didn't analyse it in detail, I only fixed it to work on Win32 :-) Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 31 12:54:45 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Thu, 31 Aug 2006 12:54:45 +0100 Subject: [Box Backup-dev] COMMIT r843 - box/chris/retry-debug/bin/bbstored In-Reply-To: References: Message-ID: Probably not important as you can't use the server for real, but this stops the server from being able to detect and prevent two writeable connections at once. Should be documented somewhere at least, in comments here. I presume the store is marked as "for tests only" on Win32? Ben On 31 Aug 2006, at 09:12, subversion at fluffy.co.uk wrote: > Author: chris > Date: 2006-08-31 09:12:47 +0100 (Thu, 31 Aug 2006) > New Revision: 843 > > Modified: > box/chris/retry-debug/bin/bbstored/BackupContext.cpp > Log: > * bin/bbstored/BackupContext.cpp > - Removed locking on Win32, there is no housekeeping process to lock > against > - Open files with O_BINARY on Win32 > - Fixed a cosmetic spelling mistake in a comment > - Unlink file later on Windows, since we can't do it while it's open > > > Modified: box/chris/retry-debug/bin/bbstored/BackupContext.cpp > =================================================================== > --- box/chris/retry-debug/bin/bbstored/BackupContext.cpp 2006-08-31 > 08:12:00 UTC (rev 842) > +++ box/chris/retry-debug/bin/bbstored/BackupContext.cpp 2006-08-31 > 08:12:47 UTC (rev 843) > @@ -125,6 +125,7 @@ > // > ---------------------------------------------------------------------- > ---- > bool BackupContext::AttemptToGetWriteLock() > { > +#ifndef WIN32 > // Make the filename of the write lock file > std::string writeLockFile; > StoreStructure::MakeWriteLockFilename(mStoreRoot, mStoreDiscSet, > writeLockFile); > @@ -150,7 +151,7 @@ > > } while(!gotLock && tries > 0); > } > - > + > if(gotLock) > { > // Got the lock, mark as not read only > @@ -158,6 +159,10 @@ > } > > return gotLock; > +#else // WIN32 > + // no housekeeping process, we do have the lock > + return true; > +#endif // !WIN32 > } > > > @@ -453,13 +458,21 @@ > try > { > // Open it twice > +#ifdef WIN32 > + FileStream diff(tempFn.c_str(), > + O_RDWR | O_CREAT | O_BINARY); > + FileStream diff2(tempFn.c_str(), > + O_RDWR | O_BINARY); > +#else > FileStream diff(tempFn.c_str(), O_RDWR | O_CREAT | O_EXCL); > FileStream diff2(tempFn.c_str(), O_RDONLY); > - // Unlink it immediately, so it definately goes away > + > + // Unlink it immediately, so it definitely goes away > if(::unlink(tempFn.c_str()) != 0) > { > THROW_EXCEPTION(CommonException, OSFileError); > } > +#endif > > // Stream the incoming diff to this temporary file > if(!rFile.CopyStreamTo(diff, BACKUP_STORE_TIMEOUT)) > @@ -508,6 +521,14 @@ > ::unlink(tempFn.c_str()); > throw; > } > + > +#ifdef WIN32 > + // we can't delete the file while it's open, above > + if(::unlink(tempFn.c_str()) != 0) > + { > + THROW_EXCEPTION(CommonException, OSFileError); > + } > +#endif > } > > // Get the blocks used > > _______________________________________________ > Boxbackup-dev mailing list > Boxbackup-dev at fluffy.co.uk > http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Thu Aug 31 12:59:06 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Thu, 31 Aug 2006 12:59:06 +0100 Subject: [Box Backup-dev] changeset [819] In-Reply-To: References: <1156975704.2413.1.camel@avenin.ebourne.me.uk> <44607E9F-2FA6-4A53-9FB3-4E77D7495F8D@fluffy.co.uk> Message-ID: <84AB0933-5854-4985-BA87-A01232311401@fluffy.co.uk> On 31 Aug 2006, at 12:35, Chris Wilson wrote: > Hi Ben, > > On Thu, 31 Aug 2006, Ben Summers wrote: > >> I don't remember writing any 'recombinetemp' things or using the >> horrid << notation. What exactly is this for? > > You're looking at my patch which adds support for win32. The > original code does use recombinetemp but not <<, because it doesn't > need to convert ints to strings, which I do (to make unique > filenames for each step). > > As far as I understand, this is the code to produce older versions > of store files on demand by applying successive patches (reverse > diffs) to the latest version. But I'm not 100% sure, I didn't > analyse it in detail, I only fixed it to work on Win32 :-) Ah, my error. Still don't like << though, but hey... Amusingly, I'm doing quite a bit in ruby at the moment and they use << as one of their important stylistic things, for arrays and in- place string concatenation and things. And I find myself using it. It feels wrong. Ben From boxbackup-dev at fluffy.co.uk Thu Aug 31 13:00:36 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Thu, 31 Aug 2006 13:00:36 +0100 Subject: [Box Backup-dev] COMMIT r840 - box/chris/merge/bin/bbackupd In-Reply-To: References: Message-ID: Without an associated test, this scares me. There's a lot of complexity in the syncing mechanism, and I worry that little changes can break it. You've already re-written the main if statement for whether to update a file or not. Ben On 31 Aug 2006, at 09:01, subversion at fluffy.co.uk wrote: > Author: chris > Date: 2006-08-31 09:01:43 +0100 (Thu, 31 Aug 2006) > New Revision: 840 > > Modified: > box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp > Log: > * bin/bbackupd/BackupClientDirectoryRecord.cpp > - Sync subdirectories even when store is full, allows user to exclude > files to free up space to complete their backups > > > Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp > =================================================================== > --- box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp > 2006-08-30 19:51:59 UTC (rev 839) > +++ box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp > 2006-08-31 08:01:43 UTC (rev 840) > @@ -922,11 +922,15 @@ > // In the list, just use this pointer > psubDirRecord = e->second; > } > - else if(!rParams.mrContext.StorageLimitExceeded()) // know we've > got a connection if we get this far, as dir will have been modified. > + else > { > - // Note: only think about adding directory records if there's > space left on the server. > - // If there isn't, this step will be repeated when there is > some available. > - > + // Note: if we have exceeded our storage limit, then > + // we should not upload any more data, nor create any > + // DirectoryRecord representing data that would have > + // been uploaded. This step will be repeated when > + // there is some space available. > + bool doCreateDirectoryRecord = true; > + > // Need to create the record. But do we need to create the > directory on the server? > int64_t subDirObjectID = 0; > if(en != 0) > @@ -934,6 +938,12 @@ > // No. Exists on the server, and we know about it from the > listing. > subDirObjectID = en->GetObjectID(); > } > + else if(rParams.mrContext.StorageLimitExceeded()) > + // know we've got a connection if we get this far, > + // as dir will have been modified. > + { > + doCreateDirectoryRecord = false; > + } > else > { > // Yes, creation required! > @@ -1016,21 +1026,24 @@ > haveJustCreatedDirOnServer = true; > } > } > - > - // New an object for this > - psubDirRecord = new BackupClientDirectoryRecord(subDirObjectID, > *d); > - > - // Store in list > - try > - { > - mSubDirectories[*d] = psubDirRecord; > + > + if (doCreateDirectoryRecord) > + { > + // New an object for this > + psubDirRecord = new BackupClientDirectoryRecord > (subDirObjectID, *d); > + > + // Store in list > + try > + { > + mSubDirectories[*d] = psubDirRecord; > + } > + catch(...) > + { > + delete psubDirRecord; > + psubDirRecord = 0; > + throw; > + } > } > - catch(...) > - { > - delete psubDirRecord; > - psubDirRecord = 0; > - throw; > - } > } > > ASSERT(psubDirRecord != 0 || > rParams.mrContext.StorageLimitExceeded()); > > _______________________________________________ > Boxbackup-dev mailing list > Boxbackup-dev at fluffy.co.uk > http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Thu Aug 31 13:04:24 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Thu, 31 Aug 2006 13:04:24 +0100 Subject: [Box Backup-dev] changeset [819] In-Reply-To: <20060831102459.fvnuefdw0848gscc@ebourne.me.uk> References: <1156975704.2413.1.camel@avenin.ebourne.me.uk> <20060831102459.fvnuefdw0848gscc@ebourne.me.uk> Message-ID: <1D3961A7-0885-41CC-9F73-273CE2BB3AFA@fluffy.co.uk> On 31 Aug 2006, at 10:24, Martin Ebourne wrote: > Chris Wilson wrote: >> On Windows, we cannot reuse the same recombinetemp file, because we >> still have it open so we can't delete the old one, so we can't >> create a >> new one with the same name. Therefore, I added a unique part to >> the end >> of the filename (p). This would probably also work on other >> platforms, >> so I can remove the conditionality if you prefer. > > Yes, I would prefer please. > > From my point of view there is a simply scary amount of conditional > compilation for the windows port. The problem with conditional > compilation is that it makes development much harder on every > platform and makes it highly likely that breakages are going to > occur. This is because (i) large conditional compilations are > difficult to read (ii) it is not possible to compile all the code > on any platform. Thus as one platform makes changes the other(s) > will break from time to time. It similarly makes testing harder. > And some changes (such as changing the signature for a method say) > where you could rely on the compiler to make sure you did the > complete change will now need manual auditing instead. > > Having said that the priority at the moment is to get a working > windows port merged so I'm ignoring this for now. But we should > avoid unnecessary conditional compilation where we can and in the > future we'll need to go back over all of this lot and rearchitect > to reduce the conditional compilation down to a minimum. Many of > these could be solved by better division of responsibility and > encapsulation in the code. I agree. Perhaps for future work you could try and use the minimum possible #ifdefs. For example, because you no longer have the housekeeping process, you ifdef out everything related. However, you could have left it all in, and just ifdefs out the code which does the actual connection and talking, and level everything else in place. Might not have made all that difference though. When we come to reorganise things later, we shall use the experience of the Win32 port to make sure it's all encapsulated nicely. Ben From boxbackup-dev at fluffy.co.uk Thu Aug 31 13:13:22 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 31 Aug 2006 13:13:22 +0100 (BST) Subject: [Box Backup-dev] COMMIT r843 - box/chris/retry-debug/bin/bbstored In-Reply-To: References: Message-ID: Hi Ben, > Probably not important as you can't use the server for real, but this > stops the server from being able to detect and prevent two writeable > connections at once. Should be documented somewhere at least, in > comments here. I presume the store is marked as "for tests only" on > Win32? Yes, it's actually impossible with the current design, since there is no fork() on Windows and the shared variable make it dangerous to use threads instead. So the server runs in a single process with synchronous housekeeping. But I could reinstate the locks if you prefer, since they don't actually do any harm. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 31 13:17:47 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Thu, 31 Aug 2006 13:17:47 +0100 Subject: [Box Backup-dev] COMMIT r843 - box/chris/retry-debug/bin/bbstored In-Reply-To: References: Message-ID: <5146AA68-1640-43BC-B7EF-CAED0D08EC68@fluffy.co.uk> On 31 Aug 2006, at 13:13, Chris Wilson wrote: > Hi Ben, > >> Probably not important as you can't use the server for real, but >> this stops the server from being able to detect and prevent two >> writeable connections at once. Should be documented somewhere at >> least, in comments here. I presume the store is marked as "for >> tests only" on Win32? > > Yes, it's actually impossible with the current design, since there > is no fork() on Windows and the shared variable make it dangerous > to use threads instead. So the server runs in a single process with > synchronous housekeeping. But I could reinstate the locks if you > prefer, since they don't actually do any harm. So why disable them then? Just adds #ifdefs which are a maintenance issue? Surely you're not that worried about 'efficiency' and 'correctness' in a server which is for testing only? Or even for real use? Ben From boxbackup-dev at fluffy.co.uk Thu Aug 31 13:18:48 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Thu, 31 Aug 2006 13:18:48 +0100 Subject: [Box Backup-dev] COMMIT r843 - box/chris/retry-debug/bin/bbstored In-Reply-To: References: Message-ID: <1FC0D7A8-D387-40C9-B39F-9254E9274CA9@fluffy.co.uk> Actually if you do need housekeeping, now you have a LocalProcessStream thing working on Win32, you could use that to have a separate housekeeping process. On 31 Aug 2006, at 13:13, Chris Wilson wrote: > Hi Ben, > >> Probably not important as you can't use the server for real, but >> this stops the server from being able to detect and prevent two >> writeable connections at once. Should be documented somewhere at >> least, in comments here. I presume the store is marked as "for >> tests only" on Win32? > > Yes, it's actually impossible with the current design, since there > is no fork() on Windows and the shared variable make it dangerous > to use threads instead. So the server runs in a single process with > synchronous housekeeping. But I could reinstate the locks if you > prefer, since they don't actually do any harm. > > Cheers, Chris. > -- > _ ___ __ _ > / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | > / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | > \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | > _______________________________________________ > Boxbackup-dev mailing list > Boxbackup-dev at fluffy.co.uk > http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev From boxbackup-dev at fluffy.co.uk Thu Aug 31 13:18:20 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 31 Aug 2006 13:18:20 +0100 (BST) Subject: [Box Backup-dev] COMMIT r840 - box/chris/merge/bin/bbackupd In-Reply-To: References: Message-ID: Hi Ben, > Without an associated test, this scares me. I can write a test, I already did it for Boxi. > There's a lot of complexity in the syncing mechanism, and I worry that > little changes can break it. True, but the unit tests exercise most of it. If you can see a bit that they don't cover, I'll happily write a test for it. > You've already re-written the main if statement for whether to update a > file or not. Yes, but that is covered by unit tests. And you've got to admit that if there is a bug with the upload decision, whether introduced by me or carried forward, it's now about 100x easier to debug it :-) Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 31 13:22:25 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 31 Aug 2006 13:22:25 +0100 (BST) Subject: [Box Backup-dev] changeset [819] In-Reply-To: <1D3961A7-0885-41CC-9F73-273CE2BB3AFA@fluffy.co.uk> References: <1156975704.2413.1.camel@avenin.ebourne.me.uk> <20060831102459.fvnuefdw0848gscc@ebourne.me.uk> <1D3961A7-0885-41CC-9F73-273CE2BB3AFA@fluffy.co.uk> Message-ID: Hi Ben, On Thu, 31 Aug 2006, Ben Summers wrote: > I agree. Me too. One thing though: removing code from Win32 does seem to make it less likely that compatibility problems and changes to unused bits of code (such as STL problems) will not affect the Win32 port, and also makes it clearer that the code is not used. On the other hand, adding new code makes it more likely that changes on other bits of code will cause problems for Win32. So I would say that #ifndef WIN32 ... #endif seems to be OK, but we should be very cautious about #ifdef WIN32. > Perhaps for future work you could try and use the minimum possible #ifdefs. > For example, because you no longer have the housekeeping process, you ifdef > out everything related. However, you could have left it all in, and just > ifdefs out the code which does the actual connection and talking, and level > everything else in place. Might not have made all that difference though. OK, will do. Would you like me to remove them? > When we come to reorganise things later, we shall use the experience of > the Win32 port to make sure it's all encapsulated nicely. Suggestions welcome at any time, I want to improve the code and not make it worse. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 31 13:37:14 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 31 Aug 2006 13:37:14 +0100 (BST) Subject: [Box Backup-dev] COMMIT r843 - box/chris/retry-debug/bin/bbstored In-Reply-To: <1FC0D7A8-D387-40C9-B39F-9254E9274CA9@fluffy.co.uk> References: <1FC0D7A8-D387-40C9-B39F-9254E9274CA9@fluffy.co.uk> Message-ID: Hi Ben, > Actually if you do need housekeeping, now you have a LocalProcessStream > thing working on Win32, you could use that to have a separate > housekeeping process. We do have housekeeping, but it runs synchronously, when no clients are connected and a timer expires. This seems reasonable for unit tests and for single-user applications. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 31 13:41:20 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 31 Aug 2006 13:41:20 +0100 (BST) Subject: [Box Backup-dev] COMMIT r843 - box/chris/retry-debug/bin/bbstored In-Reply-To: <5146AA68-1640-43BC-B7EF-CAED0D08EC68@fluffy.co.uk> References: <5146AA68-1640-43BC-B7EF-CAED0D08EC68@fluffy.co.uk> Message-ID: Hi Ben, On Thu, 31 Aug 2006, Ben Summers wrote: > So why disable them then? Just adds #ifdefs which are a maintenance issue? > Surely you're not that worried about 'efficiency' and 'correctness' in a > server which is for testing only? Or even for real use? I had to disable something because SendMessageToHousekeepingProcess() cannot work on Win32. I chose the route that allowed me to remove the most code, and hence simplify as much as possible. Perhaps that was the wrong decision since we all agree to minimise #ifdefs, and in this case the locking might be useful in future. It's probably better if I just #ifdef out just the lock waiting loop on Win32. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 31 13:49:17 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 31 Aug 2006 13:49:17 +0100 Subject: [Box Backup-dev] changeset [819] In-Reply-To: References: <1156975704.2413.1.camel@avenin.ebourne.me.uk> <20060831102459.fvnuefdw0848gscc@ebourne.me.uk> <1D3961A7-0885-41CC-9F73-273CE2BB3AFA@fluffy.co.uk> Message-ID: <20060831134917.d3rpxireaskksgwc@ebourne.me.uk> Chris Wilson wrote: > So I would say that #ifndef WIN32 ... #endif seems to be OK, but we > should be very cautious about #ifdef WIN32. Depends on your point of view. #ifndef WIN32 makes it more likely that =20 a windows change breaks a unix platform. Disable stuff if it breaks =20 win32 but not otherwise. >> Perhaps for future work you could try and use the minimum possible =20 >> #ifdefs. For example, because you no longer have the housekeeping =20 >> process, you ifdef out everything related. However, you could have =20 >> left it all in, and just ifdefs out the code which does the actual =20 >> connection and talking, and level everything else in place. Might =20 >> not have made all that difference though. > > OK, will do. Would you like me to remove them? I certainly would. Only passed the code review because I assumed you =20 needed to disable it. > Suggestions welcome at any time, I want to improve the code and not > make it worse. No worries, we all know that. And things seem to be getting better as =20 we go further on here. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 31 13:50:36 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 31 Aug 2006 13:50:36 +0100 Subject: [Box Backup-dev] changeset [819] In-Reply-To: <84AB0933-5854-4985-BA87-A01232311401@fluffy.co.uk> References: <1156975704.2413.1.camel@avenin.ebourne.me.uk> <44607E9F-2FA6-4A53-9FB3-4E77D7495F8D@fluffy.co.uk> <84AB0933-5854-4985-BA87-A01232311401@fluffy.co.uk> Message-ID: <20060831135036.w3y3ybqhno4cggco@ebourne.me.uk> Ben Summers wrote: > Amusingly, I'm doing quite a bit in ruby at the moment and they use << > as one of their important stylistic things, for arrays and in-place > string concatenation and things. And I find myself using it. It feels > wrong. Don't worry, you'll get used to it eventually. Then it will feel ok. Heck, maybe one day you may even come to like it!! ;) Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 31 13:52:53 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 31 Aug 2006 13:52:53 +0100 Subject: [Box Backup-dev] COMMIT r840 - box/chris/merge/bin/bbackupd In-Reply-To: References: Message-ID: <20060831135253.57h782n1w8c40ws0@ebourne.me.uk> Ben Summers wrote: > You've already re-written the main if statement for whether to update a > file or not. Tell me about it! I confess to being horrified when that one came through. I'd have rejected it had I not agreed with Chris that the original was more difficult to understand and impossible to debug. But it took me ages going over it bit by bit, and twice as well, to try and convince myself it was correct. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 31 14:04:27 2006 From: boxbackup-dev at fluffy.co.uk (Ben Summers) Date: Thu, 31 Aug 2006 14:04:27 +0100 Subject: [Box Backup-dev] COMMIT r840 - box/chris/merge/bin/bbackupd In-Reply-To: <20060831135253.57h782n1w8c40ws0@ebourne.me.uk> References: <20060831135253.57h782n1w8c40ws0@ebourne.me.uk> Message-ID: <070AA7AB-DC0D-4283-BEDA-8D51D8AB2CC9@fluffy.co.uk> On 31 Aug 2006, at 13:52, Martin Ebourne wrote: > Ben Summers wrote: >> You've already re-written the main if statement for whether to >> update a >> file or not. > > Tell me about it! I confess to being horrified when that one came > through. I'd have rejected it had I not agreed with Chris that the > original was more difficult to understand and impossible to debug. > > But it took me ages going over it bit by bit, and twice as well, to > try and convince myself it was correct. I think it's correct too. And the tests still pass. The original was not one of my finest hours, I think it ended up that way because I was trying to work out the best way to do it as I went along. Ben From boxbackup-dev at fluffy.co.uk Thu Aug 31 20:51:51 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 31 Aug 2006 20:51:51 +0100 (BST) Subject: [Box Backup-dev] changeset [819] In-Reply-To: <20060831134917.d3rpxireaskksgwc@ebourne.me.uk> References: <1156975704.2413.1.camel@avenin.ebourne.me.uk> <20060831102459.fvnuefdw0848gscc@ebourne.me.uk> <1D3961A7-0885-41CC-9F73-273CE2BB3AFA@fluffy.co.uk> <20060831134917.d3rpxireaskksgwc@ebourne.me.uk> Message-ID: Hi Martin and Ben, >> > Perhaps for future work you could try and use the minimum possible >> > #ifdefs. For example, because you no longer have the housekeeping >> > process, you ifdef out everything related. However, you could have >> > left it all in, and just ifdefs out the code which does the actual >> > connection and talking, and level everything else in place. Might >> > not have made all that difference though. >> >> OK, will do. Would you like me to remove them? > > I certainly would. Only passed the code review because I assumed you > needed to disable it. I have a question about what to do with the #ifdefs in bin/bbstored/BackupCommands.cpp (changeset 819, http://bbdev.fluffy.co.uk/trac/changeset/819). I can remove the first one without problems, and use the same temporary file name on Win32 and other platforms. However, the second one, which deletes the temporary files, is tricky. Under Win32, we simply cannot delete the last file, which is returned to the caller to be streamed to the client, because it's still open at the time, and Windows won't allow us to delete it. The caller can't delete it either, because it doesn't know whether that file is a temporary file, or the last one in the patch set, which is the actual current revision. Only this function, BackupProtocolServerGetFile::DoCommand, knows whether it should be deleted or not. At the moment, I don't delete the files at all on Windows, which is obviously a bug, and requires an #ifdef. There is a possible clean solution, which is to use the Windows flag FILE_FLAG_DELETE_ON_CLOSE when opening the file. To avoid the #ifdef, I think I would have to invent a new flag to pass to the FileStream constructor, which does nothing (define to zero) on other platforms, but activates this Windows flag in openfile() on Win32. Does this seem like a sensible solution? And what should that flag be called? O_DELETE_ON_CLOSE_WIN32? Does anyone have any other ideas? Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 31 20:59:03 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 20:59:03 +0100 Subject: [Box Backup-dev] COMMIT r861 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 20:59:02 +0100 (Thu, 31 Aug 2006) New Revision: 861 Modified: box/chris/merge/bin/bbstored/BackupCommands.cpp Log: * bin/bbstored/BackupCommands.cpp - Use the same code for file names and file closing on other platforms that's needed on Win32 Modified: box/chris/merge/bin/bbstored/BackupCommands.cpp =================================================================== --- box/chris/merge/bin/bbstored/BackupCommands.cpp 2006-08-31 08:51:44 UTC (rev 860) +++ box/chris/merge/bin/bbstored/BackupCommands.cpp 2006-08-31 19:59:02 UTC (rev 861) @@ -332,15 +332,11 @@ std::auto_ptr diff2(rContext.OpenObject(patchID)); // Choose a temporary filename for the result of the combination -#ifdef WIN32 std::ostringstream fs(rContext.GetStoreRoot()); fs << ".recombinetemp."; fs << p; std::string tempFn(fs.str()); tempFn = RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), tempFn, p + 16); -#else - std::string tempFn(RaidFileController::DiscSetPathToFileSystemPath(rContext.GetStoreDiscSet(), rContext.GetStoreRoot() + ".recombinetemp", p + 16 /* rotate which disc it's on */)); -#endif // Open the temporary file std::auto_ptr combined; @@ -380,9 +376,7 @@ combined->Seek(0, IOStream::SeekType_Absolute); // Then shuffle round for the next go -#ifdef WIN32 if (from.get()) from->Close(); -#endif from = combined; } From boxbackup-dev at fluffy.co.uk Thu Aug 31 20:59:39 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 19:59:39 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.dc86bb260a2ad90b8a4291690464dae6@fluffy.co.uk> --===============2132895398== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg Wzg2MV0NCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFj L3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3Vw Lz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBz eXN0ZW0gZm9yIFVOSVgu --===============2132895398==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 21:08:11 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 21:08:11 +0100 Subject: [Box Backup-dev] COMMIT r862 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 21:08:11 +0100 (Thu, 31 Aug 2006) New Revision: 862 Modified: box/chris/merge/bin/bbstored/BackupContext.cpp Log: * bin/bbstored/BackupContext.cpp - Delete the temporary file on Win32 just like on other platforms (note that this reduces the guarantees that the file will be deleted, especially if an exception is thrown, refs #819) Modified: box/chris/merge/bin/bbstored/BackupContext.cpp =================================================================== --- box/chris/merge/bin/bbstored/BackupContext.cpp 2006-08-31 19:59:02 UTC (rev 861) +++ box/chris/merge/bin/bbstored/BackupContext.cpp 2006-08-31 20:08:11 UTC (rev 862) @@ -125,7 +125,6 @@ // -------------------------------------------------------------------------- bool BackupContext::AttemptToGetWriteLock() { -#ifndef WIN32 // Make the filename of the write lock file std::string writeLockFile; StoreStructure::MakeWriteLockFilename(mStoreRoot, mStoreDiscSet, writeLockFile); @@ -159,10 +158,6 @@ } return gotLock; -#else // WIN32 - // no housekeeping process, we do have the lock - return true; -#endif // !WIN32 } @@ -466,12 +461,6 @@ #else FileStream diff(tempFn.c_str(), O_RDWR | O_CREAT | O_EXCL); FileStream diff2(tempFn.c_str(), O_RDONLY); - - // Unlink it immediately, so it definitely goes away - if(::unlink(tempFn.c_str()) != 0) - { - THROW_EXCEPTION(CommonException, OSFileError); - } #endif // Stream the incoming diff to this temporary file @@ -514,6 +503,14 @@ spaceAdjustFromDiff = from->GetDiscUsageInBlocks() - oldVersionNewBlocksUsed; // Everything cleans up here... + diff.Close(); + diff2.Close(); + + // Unlink the temporary file + if(::unlink(tempFn.c_str()) != 0) + { + THROW_EXCEPTION(CommonException, OSFileError); + } } catch(...) { From boxbackup-dev at fluffy.co.uk Thu Aug 31 21:11:19 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 21:11:19 +0100 Subject: [Box Backup-dev] COMMIT r863 - box/chris/merge/bin/bbstored Message-ID: Author: chris Date: 2006-08-31 21:11:19 +0100 (Thu, 31 Aug 2006) New Revision: 863 Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.h Log: * bin/bbstored/BackupStoreDaemon.h - Reinstate SendMessageToHousekeepingProcess() on Win32, but make it do nothing (refs #3) Modified: box/chris/merge/bin/bbstored/BackupStoreDaemon.h =================================================================== --- box/chris/merge/bin/bbstored/BackupStoreDaemon.h 2006-08-31 20:08:11 UTC (rev 862) +++ box/chris/merge/bin/bbstored/BackupStoreDaemon.h 2006-08-31 20:11:19 UTC (rev 863) @@ -38,13 +38,13 @@ BackupStoreDaemon(const BackupStoreDaemon &rToCopy); public: -#ifndef WIN32 // For BackupContext to communicate with housekeeping process void SendMessageToHousekeepingProcess(const void *Msg, int MsgLen) { +#ifndef WIN32 mInterProcessCommsSocket.Write(Msg, MsgLen); +#endif } -#endif protected: From boxbackup-dev at fluffy.co.uk Thu Aug 31 21:11:21 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 20:11:21 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.a6781360aa6208f1512861d10261a594@fluffy.co.uk> --===============1948317865== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODYzXSkgKiBi aW4vYmJzdG9yZWQvQmFja3VwU3RvcmVEYWVtb24uaA0KIC0gUmVpbnN0YXRlIFNlbmRNZXNzYWdl VG9Ib3VzZWtlZXBpbmdQcm9jZXNzKCkgb24gV2luMzIsIGJ1dCBtYWtlIGl0IGRvDQogICBub3Ro aW5nIChyZWZzICMzKQ0KDQotLSANClRpY2tldCBVUkw6IDxodHRwOi8vYmJkZXYuZmx1ZmZ5LmNv LnVrL3RyYWMvdGlja2V0LzM+DQpCb3ggQmFja3VwIDxodHRwOi8vd3d3LmZsdWZmeS5jby51ay9i b3hiYWNrdXAvPg0KQW4gb3BlbiBzb3VyY2UsIGNvbXBsZXRlbHkgYXV0b21hdGljIG9uLWxpbmUg YmFja3VwIHN5c3RlbSBmb3IgVU5JWC4= --===============1948317865==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 21:13:40 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Thu, 31 Aug 2006 21:13:40 +0100 Subject: [Box Backup-dev] COMMIT r862 - box/chris/merge/bin/bbstored In-Reply-To: References: Message-ID: <20060831201339.GF81028@netinertia.co.uk> On Thu, Aug 31, 2006 at 09:08:11PM +0100, subversion at fluffy.co.uk wrote: > Author: chris > Date: 2006-08-31 21:08:11 +0100 (Thu, 31 Aug 2006) > New Revision: 862 > > Modified: > box/chris/merge/bin/bbstored/BackupContext.cpp > Log: > * bin/bbstored/BackupContext.cpp > - Delete the temporary file on Win32 just like on other platforms (note > that this reduces the guarantees that the file will be deleted, > especially if an exception is thrown, refs #819) You may well have confused Trac, here :-) By saying "refs #819" Trac will attempt to locate ticket 819 and update that ticket. (In this case no such ticket exists, but if it did your commit message would have been added to that ticket.) James From boxbackup-dev at fluffy.co.uk Thu Aug 31 21:15:09 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Thu, 31 Aug 2006 21:15:09 +0100 Subject: [Box Backup-dev] COMMIT r863 - box/chris/merge/bin/bbstored In-Reply-To: References: Message-ID: <20060831201508.GG81028@netinertia.co.uk> On Thu, Aug 31, 2006 at 09:11:19PM +0100, subversion at fluffy.co.uk wrote: > Author: chris > Date: 2006-08-31 21:11:19 +0100 (Thu, 31 Aug 2006) > New Revision: 863 > > Modified: > box/chris/merge/bin/bbstored/BackupStoreDaemon.h > Log: > * bin/bbstored/BackupStoreDaemon.h > - Reinstate SendMessageToHousekeepingProcess() on Win32, but make it do > nothing (refs #3) And this was the real test :-) Ticket #3 has now updated with that commit message. I wasn't 100% sure it was going to work, but I'm glad it did. James From boxbackup-dev at fluffy.co.uk Thu Aug 31 21:15:41 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 31 Aug 2006 21:15:41 +0100 (BST) Subject: [Box Backup-dev] COMMIT r863 - box/chris/merge/bin/bbstored In-Reply-To: <20060831201508.GG81028@netinertia.co.uk> References: <20060831201508.GG81028@netinertia.co.uk> Message-ID: Hi James and Martin, On Thu, 31 Aug 2006, James O'Gorman wrote: >> Modified: >> box/chris/merge/bin/bbstored/BackupStoreDaemon.h >> Log: >> * bin/bbstored/BackupStoreDaemon.h >> - Reinstate SendMessageToHousekeepingProcess() on Win32, but make it do >> nothing (refs #3) > > And this was the real test :-) > Ticket #3 has now updated with that commit message. I wasn't 100% sure > it was going to work, but I'm glad it did. It did work, but the formatting is not ideal. I wonder if I should format my commit messages differently, like this: * bin/bbstored/BackupStoreDaemon.h fixed foo fixed bar which should look better in trac. Is that a good idea? Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software | From boxbackup-dev at fluffy.co.uk Thu Aug 31 21:25:10 2006 From: boxbackup-dev at fluffy.co.uk (James O'Gorman) Date: Thu, 31 Aug 2006 21:25:10 +0100 Subject: [Box Backup-dev] COMMIT r863 - box/chris/merge/bin/bbstored In-Reply-To: References: <20060831201508.GG81028@netinertia.co.uk> Message-ID: <20060831202510.GH81028@netinertia.co.uk> On Thu, Aug 31, 2006 at 09:15:41PM +0100, Chris Wilson wrote: > It did work, but the formatting is not ideal. I wonder if I should format > my commit messages differently, like this: > > * bin/bbstored/BackupStoreDaemon.h > > fixed foo > > fixed bar > > which should look better in trac. Is that a good idea? You can either use Trac's WikiFormatting (i.e. use [BR] to force a hard line break) or, as you say just double-line space it. At the end of the day, I would guess it's probably more important to make it readable in the svn commit message rather than in Trac's automatic ticket feeding. But then I'm not the one committing, so maybe Ben and Martin might have some views on this. James From boxbackup-dev at fluffy.co.uk Thu Aug 31 22:45:56 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 21:45:56 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.9b5f804a13693fcf65bc44b63ae1e712@fluffy.co.uk> --===============0309173398== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg Wzg2Ml0gYW5kIFs4NjNdDQoNCi0tIA0KVGlja2V0IFVSTDogPGh0dHA6Ly9iYmRldi5mbHVmZnku Y28udWsvdHJhYy90aWNrZXQvMz4NCkJveCBCYWNrdXAgPGh0dHA6Ly93d3cuZmx1ZmZ5LmNvLnVr L2JveGJhY2t1cC8+DQpBbiBvcGVuIHNvdXJjZSwgY29tcGxldGVseSBhdXRvbWF0aWMgb24tbGlu ZSBiYWNrdXAgc3lzdGVtIGZvciBVTklYLg== --===============0309173398==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 22:48:24 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:48:24 +0100 Subject: [Box Backup-dev] COMMIT r864 - box/chris/merge Message-ID: Author: chris Date: 2006-08-31 22:48:24 +0100 (Thu, 31 Aug 2006) New Revision: 864 Modified: box/chris/merge/configure.ac Log: * configure.ac Revert to trunk (refs #3) Modified: box/chris/merge/configure.ac =================================================================== --- box/chris/merge/configure.ac 2006-08-31 20:11:19 UTC (rev 863) +++ box/chris/merge/configure.ac 2006-08-31 21:48:24 UTC (rev 864) @@ -44,7 +44,7 @@ VL_LIB_READLINE([have_libreadline=yes], [have_libreadline=no]) ## Check for Berkely DB. Restrict to certain versions -AX_PATH_BDB([1.x or 4.1], [ +AX_PATH_BDB(, [ LIBS="$BDB_LIBS $LIBS" LDFLAGS="$BDB_LDFLAGS $LDFLAGS" CPPFLAGS="$CPPFLAGS $BDB_CPPFLAGS" @@ -89,7 +89,7 @@ AC_CHECK_HEADERS([syslog.h time.h]) AC_CHECK_HEADERS([netinet/in.h]) AC_CHECK_HEADERS([sys/param.h sys/socket.h sys/time.h sys/types.h sys/wait.h]) -AC_CHECK_HEADERS([sys/uio.h sys/xattr.h]) +AC_CHECK_HEADERS([sys/xattr.h]) if test "$ac_cv_header_regex_h" = "yes"; then AC_SEARCH_LIBS([regcomp], [pcreposix]) @@ -116,7 +116,6 @@ ]]) AC_CHECK_DECLS([INFTIM],,, [[#include ]]) AC_CHECK_DECLS([SO_PEERCRED],,, [[#include ]]) -AC_CHECK_DECLS([O_BINARY],,,) AC_HEADER_TIME AC_STRUCT_TM AX_CHECK_DIRENT_D_TYPE @@ -125,14 +124,14 @@ if test "x$ac_cv_c_bigendian" != "xyes"; then AX_BSWAP64 fi - if test "$target_os" != "mingw32"; then AX_RANDOM_DEVICE - AX_CHECK_MOUNT_POINT(,[ +fi +AX_CHECK_MOUNT_POINT(,[ + if test "$target_os" != "mingw32" -a "$target_os" != "winnt"; then AC_MSG_ERROR([[cannot work out how to discover mount points on your platform]]) + fi ]) -fi - AX_CHECK_MALLOC_WORKAROUND @@ -239,7 +238,6 @@ without these features, but will work better where they are present. Refer to the documentation for more information on each feature. -Regular expressions: $ac_cv_header_regex_h Large files: $have_large_file_support Berkeley DB: $ax_path_bdb_ok Readline: $have_libreadline From boxbackup-dev at fluffy.co.uk Thu Aug 31 22:48:28 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 21:48:28 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.59efd7f57dd4aeaa5f8a8af5bf500911@fluffy.co.uk> --===============0904389530== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODY0XSkgKiBj b25maWd1cmUuYWMNCg0KICAgICAgICAgUmV2ZXJ0IHRvIHRydW5rIChyZWZzICMzKQ0KDQotLSAN ClRpY2tldCBVUkw6IDxodHRwOi8vYmJkZXYuZmx1ZmZ5LmNvLnVrL3RyYWMvdGlja2V0LzM+DQpC b3ggQmFja3VwIDxodHRwOi8vd3d3LmZsdWZmeS5jby51ay9ib3hiYWNrdXAvPg0KQW4gb3BlbiBz b3VyY2UsIGNvbXBsZXRlbHkgYXV0b21hdGljIG9uLWxpbmUgYmFja3VwIHN5c3RlbSBmb3IgVU5J WC4= --===============0904389530==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 22:51:04 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:51:04 +0100 Subject: [Box Backup-dev] COMMIT r865 - box/chris/merge Message-ID: Author: chris Date: 2006-08-31 22:51:03 +0100 (Thu, 31 Aug 2006) New Revision: 865 Modified: box/chris/merge/configure.ac Log: * configure.ac Show the required versions of Berkeley DB when configure fails to find them Check for sys/uio.h Check for O_BINARY Clean up code for AX_CHECK_MOUNT_POINT Display whether regular expressions are enabled at the end Modified: box/chris/merge/configure.ac =================================================================== --- box/chris/merge/configure.ac 2006-08-31 21:48:24 UTC (rev 864) +++ box/chris/merge/configure.ac 2006-08-31 21:51:03 UTC (rev 865) @@ -44,7 +44,7 @@ VL_LIB_READLINE([have_libreadline=yes], [have_libreadline=no]) ## Check for Berkely DB. Restrict to certain versions -AX_PATH_BDB(, [ +AX_PATH_BDB([1.x or 4.1], [ LIBS="$BDB_LIBS $LIBS" LDFLAGS="$BDB_LDFLAGS $LDFLAGS" CPPFLAGS="$CPPFLAGS $BDB_CPPFLAGS" @@ -89,7 +89,7 @@ AC_CHECK_HEADERS([syslog.h time.h]) AC_CHECK_HEADERS([netinet/in.h]) AC_CHECK_HEADERS([sys/param.h sys/socket.h sys/time.h sys/types.h sys/wait.h]) -AC_CHECK_HEADERS([sys/xattr.h]) +AC_CHECK_HEADERS([sys/uio.h sys/xattr.h]) if test "$ac_cv_header_regex_h" = "yes"; then AC_SEARCH_LIBS([regcomp], [pcreposix]) @@ -116,6 +116,7 @@ ]]) AC_CHECK_DECLS([INFTIM],,, [[#include ]]) AC_CHECK_DECLS([SO_PEERCRED],,, [[#include ]]) +AC_CHECK_DECLS([O_BINARY],,,) AC_HEADER_TIME AC_STRUCT_TM AX_CHECK_DIRENT_D_TYPE @@ -124,14 +125,14 @@ if test "x$ac_cv_c_bigendian" != "xyes"; then AX_BSWAP64 fi + if test "$target_os" != "mingw32"; then AX_RANDOM_DEVICE -fi -AX_CHECK_MOUNT_POINT(,[ - if test "$target_os" != "mingw32" -a "$target_os" != "winnt"; then + AX_CHECK_MOUNT_POINT(,[ AC_MSG_ERROR([[cannot work out how to discover mount points on your platform]]) - fi ]) +fi + AX_CHECK_MALLOC_WORKAROUND @@ -238,6 +239,7 @@ without these features, but will work better where they are present. Refer to the documentation for more information on each feature. +Regular expressions: $ac_cv_header_regex_h Large files: $have_large_file_support Berkeley DB: $ax_path_bdb_ok Readline: $have_libreadline From boxbackup-dev at fluffy.co.uk Thu Aug 31 22:52:27 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:52:27 +0100 Subject: [Box Backup-dev] COMMIT r866 - box/chris/merge/docs/backup Message-ID: Author: chris Date: 2006-08-31 22:52:27 +0100 (Thu, 31 Aug 2006) New Revision: 866 Modified: box/chris/merge/docs/backup/win32_build_on_linux_using_mingw.txt Log: * docs/backup/win32_build_on_linux_using_mingw.txt - Revert to trunk - Modified: box/chris/merge/docs/backup/win32_build_on_linux_using_mingw.txt =================================================================== --- box/chris/merge/docs/backup/win32_build_on_linux_using_mingw.txt 2006-08-31 21:51:03 UTC (rev 865) +++ box/chris/merge/docs/backup/win32_build_on_linux_using_mingw.txt 2006-08-31 21:52:27 UTC (rev 866) @@ -7,11 +7,6 @@ - Fedora and SuSE users can download RPM packages from [http://mirzam.it.vu.nl/mingw/] -You will need to know the prefix used by the cross-compiler executables. -It will usually be something like "ix86-mingw32*-". All the binaries in the -cross-compiler package will start with this prefix. The documentation below -assumes that it is "i386-mingw32-". Adjust to taste. - Download Zlib from [http://www.zlib.net/], unpack and enter source directory: export CC=i386-mingw32-gcc @@ -21,19 +16,8 @@ make make install prefix=/usr/local/i386-mingw32 -Download OpenSSL 0.9.8b from -[http://www.openssl.org/source/openssl-0.9.8b.tar.gz] +Download OpenSSL 0.9.7 from -Unpack and configure: - - tar xzvf openssl-0.9.8b.tar.gz - cd openssl-0.9.8b - ./Configure mingw - make makefile.one - wget http://bbdev.fluffy.co.uk/svn/box/chris/win32/support/openssl-0.9.8b-mingw-cross.patch - patch -p1 < openssl-0.9.8b-mingw-cross.patch - make -f makefile.one - Configure Box with: export CXX="i386-mingw32-g++" @@ -43,6 +27,5 @@ export CXXFLAGS="-mthreads" export LDFLAGS="-mthreads" export LIBS="-lcrypto -lws2_32 -lgdi32" - (if you don't have a "configure" file, run "./bootstrap") ./configure --target=i386-mingw32 - make CXX="$CXX" AR="$AR" RANLIB="$RANLIB" WINDRES="i386-mingw32-windres" + make CXX="$CXX" AR="$AR" RANLIB="$RANLIB" From boxbackup-dev at fluffy.co.uk Thu Aug 31 22:53:19 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:53:19 +0100 Subject: [Box Backup-dev] COMMIT r867 - box/chris/merge/docs/backup Message-ID: Author: chris Date: 2006-08-31 22:53:19 +0100 (Thu, 31 Aug 2006) New Revision: 867 Modified: box/chris/merge/docs/backup/win32_build_on_linux_using_mingw.txt Log: * docs/backup/win32_build_on_linux_using_mingw.txt (refs #3) Updated documentation for building Win32 native builds on Linux Modified: box/chris/merge/docs/backup/win32_build_on_linux_using_mingw.txt =================================================================== --- box/chris/merge/docs/backup/win32_build_on_linux_using_mingw.txt 2006-08-31 21:52:27 UTC (rev 866) +++ box/chris/merge/docs/backup/win32_build_on_linux_using_mingw.txt 2006-08-31 21:53:19 UTC (rev 867) @@ -7,6 +7,11 @@ - Fedora and SuSE users can download RPM packages from [http://mirzam.it.vu.nl/mingw/] +You will need to know the prefix used by the cross-compiler executables. +It will usually be something like "ix86-mingw32*-". All the binaries in the +cross-compiler package will start with this prefix. The documentation below +assumes that it is "i386-mingw32-". Adjust to taste. + Download Zlib from [http://www.zlib.net/], unpack and enter source directory: export CC=i386-mingw32-gcc @@ -16,8 +21,19 @@ make make install prefix=/usr/local/i386-mingw32 -Download OpenSSL 0.9.7 from +Download OpenSSL 0.9.8b from +[http://www.openssl.org/source/openssl-0.9.8b.tar.gz] +Unpack and configure: + + tar xzvf openssl-0.9.8b.tar.gz + cd openssl-0.9.8b + ./Configure mingw + make makefile.one + wget http://bbdev.fluffy.co.uk/svn/box/chris/win32/support/openssl-0.9.8b-mingw-cross.patch + patch -p1 < openssl-0.9.8b-mingw-cross.patch + make -f makefile.one + Configure Box with: export CXX="i386-mingw32-g++" @@ -27,5 +43,6 @@ export CXXFLAGS="-mthreads" export LDFLAGS="-mthreads" export LIBS="-lcrypto -lws2_32 -lgdi32" + (if you don't have a "configure" file, run "./bootstrap") ./configure --target=i386-mingw32 - make CXX="$CXX" AR="$AR" RANLIB="$RANLIB" + make CXX="$CXX" AR="$AR" RANLIB="$RANLIB" WINDRES="i386-mingw32-windres" From boxbackup-dev at fluffy.co.uk Thu Aug 31 22:53:21 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 21:53:21 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.af1de3ecd5aee13d5fc46026866c64bc@fluffy.co.uk> --===============0434871906== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODY3XSkgKiBk b2NzL2JhY2t1cC93aW4zMl9idWlsZF9vbl9saW51eF91c2luZ19taW5ndy50eHQgKHJlZnMgIzMp DQoNCiAgICAgICAgIFVwZGF0ZWQgZG9jdW1lbnRhdGlvbiBmb3IgYnVpbGRpbmcgV2luMzIgbmF0 aXZlIGJ1aWxkcyBvbiBMaW51eA0KDQotLSANClRpY2tldCBVUkw6IDxodHRwOi8vYmJkZXYuZmx1 ZmZ5LmNvLnVrL3RyYWMvdGlja2V0LzM+DQpCb3ggQmFja3VwIDxodHRwOi8vd3d3LmZsdWZmeS5j by51ay9ib3hiYWNrdXAvPg0KQW4gb3BlbiBzb3VyY2UsIGNvbXBsZXRlbHkgYXV0b21hdGljIG9u LWxpbmUgYmFja3VwIHN5c3RlbSBmb3IgVU5JWC4= --===============0434871906==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 22:55:11 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:55:11 +0100 Subject: [Box Backup-dev] COMMIT r868 - box/chris/merge/infrastructure Message-ID: Author: chris Date: 2006-08-31 22:55:11 +0100 (Thu, 31 Aug 2006) New Revision: 868 Modified: box/chris/merge/infrastructure/BoxPlatform.pm.in Log: * infrastructure/BoxPlatform.pm.in - Revert to trunk Modified: box/chris/merge/infrastructure/BoxPlatform.pm.in =================================================================== --- box/chris/merge/infrastructure/BoxPlatform.pm.in 2006-08-31 21:53:19 UTC (rev 867) +++ box/chris/merge/infrastructure/BoxPlatform.pm.in 2006-08-31 21:55:11 UTC (rev 868) @@ -1,27 +1,15 @@ package BoxPlatform; use Exporter; @ISA = qw/Exporter/; - at EXPORT = qw/$build_os $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 $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/; BEGIN { # which OS are we building under? - $target_os = '@target_os@'; - $target_windows = 0; - $target_windows = 1 if $target_os =~ m'^mingw32' - or $target_os eq "winnt"; + $build_os = `uname`; + chomp $build_os; - if ($^O eq "MSWin32" and not -x "/usr/bin/uname") - { - $build_os = "winnt"; - } - else - { - $build_os = `uname`; - chomp $build_os; - } - # Cygwin Builds usually something like CYGWIN_NT-5.0, CYGWIN_NT-5.1 # Box Backup tried on Win2000,XP only :) $build_os = 'CYGWIN' if $build_os =~ m/CYGWIN/; @@ -34,18 +22,11 @@ $platform_compile_line_extra =~ s/ -O2//; $platform_link_line_extra = '@LDFLAGS@'; $platform_lib_files = '@LIBS@'; + $target_os = '@target_os@'; $platform_exe_ext = '@EXEEXT@'; # get version - if (! -r "VERSION.txt" and -r "../../VERSION.txt") - { - open VERSION,"../../VERSION.txt" or die "../../VERSION.txt: $!"; - } - else - { - open VERSION,"VERSION.txt" or die "VERSION.txt: $!"; - } - + open VERSION,"VERSION.txt" or die "VERSION.txt: $!"; $product_version = ; chomp $product_version; $product_name = ; From boxbackup-dev at fluffy.co.uk Thu Aug 31 22:57:48 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:57:48 +0100 Subject: [Box Backup-dev] COMMIT r869 - box/chris/merge/infrastructure Message-ID: Author: chris Date: 2006-08-31 22:57:48 +0100 (Thu, 31 Aug 2006) New Revision: 869 Modified: box/chris/merge/infrastructure/BoxPlatform.pm.in Log: * infrastructure/BoxPlatform.pm.in Determine whether we are building for Windows or not, and export that information Search for VERSION.txt in a few more places, for example when running Perl scripts like getversion.pl (refs #3) Modified: box/chris/merge/infrastructure/BoxPlatform.pm.in =================================================================== --- box/chris/merge/infrastructure/BoxPlatform.pm.in 2006-08-31 21:55:11 UTC (rev 868) +++ box/chris/merge/infrastructure/BoxPlatform.pm.in 2006-08-31 21:57:48 UTC (rev 869) @@ -1,15 +1,27 @@ package BoxPlatform; use Exporter; @ISA = qw/Exporter/; - at EXPORT = qw/$build_os $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/; + at EXPORT = qw/$build_os $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? - $build_os = `uname`; - chomp $build_os; + $target_os = '@target_os@'; + $target_windows = 0; + $target_windows = 1 if $target_os =~ m'^mingw32' + or $target_os eq "winnt"; + if ($^O eq "MSWin32" and not -x "/usr/bin/uname") + { + $build_os = "winnt"; + } + else + { + $build_os = `uname`; + chomp $build_os; + } + # Cygwin Builds usually something like CYGWIN_NT-5.0, CYGWIN_NT-5.1 # Box Backup tried on Win2000,XP only :) $build_os = 'CYGWIN' if $build_os =~ m/CYGWIN/; @@ -22,11 +34,18 @@ $platform_compile_line_extra =~ s/ -O2//; $platform_link_line_extra = '@LDFLAGS@'; $platform_lib_files = '@LIBS@'; - $target_os = '@target_os@'; $platform_exe_ext = '@EXEEXT@'; # get version - open VERSION,"VERSION.txt" or die "VERSION.txt: $!"; + if (! -r "VERSION.txt" and -r "../../VERSION.txt") + { + open VERSION,"../../VERSION.txt" or die "../../VERSION.txt: $!"; + } + else + { + open VERSION,"VERSION.txt" or die "VERSION.txt: $!"; + } + $product_version = ; chomp $product_version; $product_name = ; From boxbackup-dev at fluffy.co.uk Thu Aug 31 22:57:49 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 21:57:49 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.42c09553a453d10e58a8b0e93f76e10e@fluffy.co.uk> --===============0825040483== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODY5XSkgKiBp bmZyYXN0cnVjdHVyZS9Cb3hQbGF0Zm9ybS5wbS5pbg0KDQogICAgICAgICBEZXRlcm1pbmUgd2hl dGhlciB3ZSBhcmUgYnVpbGRpbmcgZm9yIFdpbmRvd3Mgb3Igbm90LCBhbmQgZXhwb3J0DQogICAg ICAgICB0aGF0IGluZm9ybWF0aW9uDQoNCiAgICAgICAgIFNlYXJjaCBmb3IgVkVSU0lPTi50eHQg aW4gYSBmZXcgbW9yZSBwbGFjZXMsIGZvciBleGFtcGxlIHdoZW4NCiAgICAgICAgIHJ1bm5pbmcg UGVybCBzY3JpcHRzIGxpa2UgZ2V0dmVyc2lvbi5wbA0KDQogICAgICAgICAocmVmcyAjMykNCg0K LS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL3RpY2tldC8z Pg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3VwLz4NCkFuIG9w ZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBzeXN0ZW0gZm9y IFVOSVgu --===============0825040483==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 22:58:47 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:58:47 +0100 Subject: [Box Backup-dev] COMMIT r870 - box/chris/merge/infrastructure Message-ID: Author: chris Date: 2006-08-31 22:58:47 +0100 (Thu, 31 Aug 2006) New Revision: 870 Modified: box/chris/merge/infrastructure/buildenv-testmain-template.cpp Log: * buildenv-testmain-template.cpp - Revert to trunk Modified: box/chris/merge/infrastructure/buildenv-testmain-template.cpp =================================================================== --- box/chris/merge/infrastructure/buildenv-testmain-template.cpp 2006-08-31 21:57:48 UTC (rev 869) +++ box/chris/merge/infrastructure/buildenv-testmain-template.cpp 2006-08-31 21:58:47 UTC (rev 870) @@ -41,8 +41,6 @@ #endif int failures = 0; -int first_fail_line; -std::string first_fail_file; int filedes_open_at_beginning = -1; @@ -130,10 +128,7 @@ } if(failures > 0) { - printf("FAILED: %d tests failed (first at " - "%s:%d)\n", failures, - first_fail_file.c_str(), - first_fail_line); + printf("FAILED: %d tests failed\n", failures); } else { From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:00:04 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:00:04 +0100 Subject: [Box Backup-dev] COMMIT r871 - box/chris/merge/infrastructure Message-ID: Author: chris Date: 2006-08-31 23:00:04 +0100 (Thu, 31 Aug 2006) New Revision: 871 Modified: box/chris/merge/infrastructure/buildenv-testmain-template.cpp Log: * infrastructure/buildenv-testmain-template.cpp Record the file and line of first test failure, and print them at the end of the test, useful for debugging when the first failure has scrolled off screen (refs #3) Modified: box/chris/merge/infrastructure/buildenv-testmain-template.cpp =================================================================== --- box/chris/merge/infrastructure/buildenv-testmain-template.cpp 2006-08-31 21:58:47 UTC (rev 870) +++ box/chris/merge/infrastructure/buildenv-testmain-template.cpp 2006-08-31 22:00:04 UTC (rev 871) @@ -41,6 +41,8 @@ #endif int failures = 0; +int first_fail_line; +std::string first_fail_file; int filedes_open_at_beginning = -1; @@ -128,7 +130,10 @@ } if(failures > 0) { - printf("FAILED: %d tests failed\n", failures); + printf("FAILED: %d tests failed (first at " + "%s:%d)\n", failures, + first_fail_file.c_str(), + first_fail_line); } else { From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:00:07 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:00:07 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.91a9dac3106b79f0a7ed7232b4015ba1@fluffy.co.uk> --===============0248759929== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODcxXSkgKiBp bmZyYXN0cnVjdHVyZS9idWlsZGVudi10ZXN0bWFpbi10ZW1wbGF0ZS5jcHANCg0KICAgICAgICAg UmVjb3JkIHRoZSBmaWxlIGFuZCBsaW5lIG9mIGZpcnN0IHRlc3QgZmFpbHVyZSwgYW5kIHByaW50 IHRoZW0NCiAgICAgICAgIGF0IHRoZSBlbmQgb2YgdGhlIHRlc3QsIHVzZWZ1bCBmb3IgZGVidWdn aW5nIHdoZW4gdGhlIGZpcnN0DQogICAgICAgICBmYWlsdXJlIGhhcyBzY3JvbGxlZCBvZmYgc2Ny ZWVuIChyZWZzICMzKQ0KDQotLSANClRpY2tldCBVUkw6IDxodHRwOi8vYmJkZXYuZmx1ZmZ5LmNv LnVrL3RyYWMvdGlja2V0LzM+DQpCb3ggQmFja3VwIDxodHRwOi8vd3d3LmZsdWZmeS5jby51ay9i b3hiYWNrdXAvPg0KQW4gb3BlbiBzb3VyY2UsIGNvbXBsZXRlbHkgYXV0b21hdGljIG9uLWxpbmUg YmFja3VwIHN5c3RlbSBmb3IgVU5JWC4= --===============0248759929==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:01:53 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:01:53 +0100 Subject: [Box Backup-dev] COMMIT r872 - box/chris/merge/infrastructure Message-ID: Author: chris Date: 2006-08-31 23:01:53 +0100 (Thu, 31 Aug 2006) New Revision: 872 Modified: box/chris/merge/infrastructure/makebuildenv.pl.in Log: * infrastructure/makebuildenv.pl.in - Revert to trunk Modified: box/chris/merge/infrastructure/makebuildenv.pl.in =================================================================== --- box/chris/merge/infrastructure/makebuildenv.pl.in 2006-08-31 22:00:04 UTC (rev 871) +++ box/chris/merge/infrastructure/makebuildenv.pl.in 2006-08-31 22:01:53 UTC (rev 872) @@ -14,8 +14,9 @@ print "Box build environment setup.\n\n"; -my @implicit_deps = ('lib/common'); +my $implicit_dep = 'lib/common'; + # work out platform variables use lib 'infrastructure'; use BoxPlatform; @@ -37,16 +38,12 @@ # flags about the environment my %env_flags; -my $windows_include_path = ""; -if ($target_windows) +my $windows_include_path = "-I../../lib/win32 "; +if ($target_os ne "mingw32" && $target_os ne "winnt") { - $module_dependency{"lib/common"} = ["lib/win32"]; - push @implicit_deps, "lib/win32"; + $windows_include_path = ""; + $env_flags{'IGNORE_lib/win32'} = 1; } -else -{ - # $env_flags{'IGNORE_lib/win32'} = 1; -} # print "Flag: $_\n" for(keys %env_flags); @@ -114,7 +111,7 @@ print "done\n\n"; -# open test main program template file +# open test mail program template file my $test_template_file = 'infrastructure/buildenv-testmain-template.cpp'; open FL,$test_template_file or die "Can't open test template file\n"; my $test_template; @@ -274,7 +271,7 @@ push @md,$_ unless ignore_module($_) } } - $module_dependency{$mod} = [@implicit_deps, at md]; + $module_dependency{$mod} = [$implicit_dep, at md]; $module_library_link_opts{$mod} = [@lo]; # make directories, but not if we're using an external library and this a library module @@ -289,21 +286,17 @@ } # make dirs for implicit dep -foreach my $dep (@implicit_deps) -{ - mkdir "release/$dep",0755; - mkdir "debug/$dep",0755; -} +mkdir "release/$implicit_dep",0755; +mkdir "debug/$implicit_dep",0755; # write a list of all the modules we've configured to use -open CONFIGURED_MODS,'>local/modules.h.new' or die - "Can't write configured modules list"; +open CONFIGURED_MODS,'>local/modules.h' or die "Can't write configured modules list"; print CONFIGURED_MODS <<__E; // automatically generated file, do not edit #ifndef _CONFIGURED_MODULES__H #define _CONFIGURED_MODULES__H __E -for(@implicit_deps, at modules) +for($implicit_dep, at modules) { my $m = $_; $m =~ s~/~_~; @@ -313,11 +306,11 @@ #endif // _CONFIGURED_MODULES__H __E close CONFIGURED_MODS; -update_if_changed("local/modules.h"); + # now make a list of all the .h files we can find, recording which module they're in my %hfiles; -for my $mod (@modules, @implicit_deps) +for my $mod (@modules, $implicit_dep) { opendir DIR,$mod; my @items = readdir DIR; @@ -354,7 +347,7 @@ } } -for my $mod (@modules, @implicit_deps) +for my $mod (@modules, $implicit_dep) { opendir DIR,$mod; for my $h (grep /\.h\Z/i, readdir DIR) @@ -380,10 +373,9 @@ print "done\n\nGenerating Makefiles...\n"; -my %module_resources_win32; # Then write a makefile for each module -for my $mod (@implicit_deps, @modules) +for my $mod (@modules, $implicit_dep) { print $mod,"\n"; @@ -394,19 +386,15 @@ { my $testmain = $test_template; $testmain =~ s/TEST_NAME/$name/g; - open TESTMAIN,">$mod/_main.cpp.new" or die - "Can't open test main file for $mod for writing\n"; + open TESTMAIN,">$mod/_main.cpp" or die "Can't open test main file for $mod for writing\n"; print TESTMAIN $testmain; close TESTMAIN; - update_if_changed("$mod/_main.cpp"); # test file... sub writetestfile { my ($filename,$runcmd,$module) = @_; - open TESTFILE,">$filename.new" or die - "Can't open test script file for $module " . - "for writing\n"; + open TESTFILE,">$filename" or die "Can't open test script file for $module for writing\n"; print TESTFILE "#!/bin/sh\necho TEST: $module\n"; if(-d "$module/testfiles") { @@ -425,13 +413,12 @@ } print TESTFILE "$runcmd\n"; close TESTFILE; - update_if_changed($filename); } writetestfile("$mod/_t", - './test' . $platform_exe_ext . ' $1 $2 $3 $4 $5', $mod); + './test' . $platform_exe_ext . '$1 $2 $3 $4 $5', $mod); writetestfile("$mod/_t-gdb", - 'gdb ./test' . $platform_exe_ext, $mod); + 'gdb ./test ' . $platform_exe_ext, $mod); } @@ -454,14 +441,14 @@ add_mod_deps(\@deps_raw, $mod); # and then dedup and reorder them my %d_done; - foreach my $dep (reverse @deps_raw) + for(my $a = $#deps_raw; $a >= 0; $a--) { - if(!exists $d_done{$dep}) + if(!exists $d_done{$deps_raw[$a]}) { # insert - push @all_deps_for_module, $dep; + push @all_deps_for_module, $deps_raw[$a]; # mark as done - $d_done{$dep} = 1; + $d_done{$deps_raw[$a]} = 1; } } } @@ -493,12 +480,11 @@ # start the makefile my $mk_name_extra = ($bsd_make)?'':'X'; - open MAKE,">$mod/Makefile".$mk_name_extra.".new" or die - "Can't open Makefile for $mod\n"; + open MAKE,">$mod/Makefile".$mk_name_extra or die "Can't open Makefile for $mod\n"; my $debug_link_extra = ($target_is_library)?'':'../../debug/lib/debug/debug.a'; my $release_flags = "-O2"; - if ($target_windows) + if ($target_os eq "mingw32") { $release_flags = "-O0 -g"; } @@ -513,7 +499,6 @@ AR = ar RANLIB = ranlib PERL = "@PERL@" -WINDRES = windres .ifdef RELEASE CXXFLAGS = -DNDEBUG $release_flags -Wall $include_paths $extra_platform_defines -DBOX_VERSION="\\"$product_version\\"" OUTBASE = ../../release @@ -561,7 +546,7 @@ @items = (@items, @autogen_items); } - # first, obtain a list of dependencies within the .h files + # first, obtain a list of depenencies within the .h files my %headers; for my $h (grep /\.h\Z/i, @items) { @@ -581,30 +566,19 @@ # then... do the cpp files... my @obj_base; - for my $file (@items) + for my $cpp (@items) { - my $is_cpp = $file =~ m/\A(.+)\.cpp\Z/i; - my $is_rc = $file =~ m/\A(.+)\.rc\Z/i; - my $base = $1; + next unless $cpp =~ m/\A(.+)\.cpp\Z/i; + next if $cpp =~ /\A\._/; # Temp Mac OS Resource hack - if ($target_windows) - { - next if not $is_cpp and not $is_rc; - } - else - { - next if not $is_cpp; - } - - next if $file =~ /\A\._/; # Temp Mac OS Resource hack - # store for later + my $base = $1; push @obj_base,$base; # get the file... - open FL,"$mod/$file"; + open FL,"$mod/$cpp"; my $f; - read FL,$f,-s "$mod/$file"; + read FL,$f,-s "$mod/$cpp"; close FL; my %dep; @@ -618,29 +592,10 @@ my $out_name = '$(OUTDIR)/'.$base.'.o'; # write the line for this cpp file - my @dep_paths = map - { - ($hfiles{$_} eq $mod) - ? $_ - : '../../'.$hfiles{$_}."/$_" - } - keys %dep; + $make .= $out_name.': '.join(' ',$cpp,map + { ($hfiles{$_} eq $mod)?$_:'../../'.$hfiles{$_}."/$_" } keys %dep)."\n"; + $make .= "\t\$(CXX) \$(CXXFLAGS) $compile_line_extra -c $cpp -o $out_name\n\n"; - $make .= $out_name.': '.join(' ',$file, at dep_paths)."\n"; - - if ($is_cpp) - { - $make .= "\t\$(CXX) \$(CXXFLAGS) $compile_line_extra ". - "-c $file -o $out_name\n\n"; - } - elsif ($is_rc) - { - $make .= "\t\$(WINDRES) $file $out_name\n\n"; - my $res_list = $module_resources_win32{$mod}; - $res_list ||= []; - push @$res_list, $base.'.o'; - $module_resources_win32{$mod} = $res_list; - } } my $has_deps = ($#{$module_dependency{$mod}} >= 0); @@ -692,28 +647,11 @@ additional_objects_from_make_fragment("$mod/Makefile.extra.$build_os", \@objs, \@makefile_includes); my $o_file_list = join(' ',map {'$(OUTDIR)/'.$_.'.o'} @objs); - - if ($has_deps and not $bsd_make) - { - print MAKE ".PHONY: all\n" . - "all: dep_modules $end_target\n\n"; - } - print MAKE $end_target,': ',$o_file_list; + print MAKE ' dep_modules' if $has_deps and not $bsd_make; print MAKE " ",$lib_files unless $target_is_library; print MAKE "\n"; - if ($target_windows) - { - foreach my $dep (@all_deps_for_module) - { - my $res_list = $module_resources_win32{$dep}; - next unless $res_list; - $o_file_list .= ' '.join(' ', - map {'$(OUTBASE)/'.$dep."/$_"} @$res_list); - } - } - # stuff to make the final target... if($target_is_library) { @@ -792,8 +730,8 @@ if(!$bsd_make) { # need to post process this into a GNU makefile - open MAKE,">$mod/Makefile.new" or die $!; - open MAKEB,"$mod/MakefileX.new" or die $!; + open MAKE,">$mod/Makefile"; + open MAKEB,"$mod/MakefileX"; while() { @@ -805,10 +743,8 @@ close MAKEB; close MAKE; - unlink "$mod/MakefileX.new"; + unlink "$mod/MakefileX"; } - - update_if_changed("$mod/Makefile"); } print "\nType 'cd ; $make_command' to build a module\n\n"; From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:09:48 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:09:48 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.9f16b825f45b2a5ee99e37a88e1fc94e@fluffy.co.uk> --===============2084145081== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODczXSkgKiBp bmZyYXN0cnVjdHVyZS9tYWtlYnVpbGRlbnYucGwuaW4NCg0KICAgICAgICAgU3VwcG9ydCBtdWx0 aXBsZSBpbXBsaWNpdCBkZXBlbmRlbmNpZXMNCg0KICAgICAgICAgQWRkIGxpYi93aW4zMiBhcyBh biBpbXBsaWNpdCBkZXBlbmRlbmN5IG9uIFdpbjMyDQoNCiAgICAgICAgIE1ha2UgbGliL2NvbW1v biBkZXBlbmQgb24gbGliL3dpbjMyIG9uIFdpbjMyDQoNCiAgICAgICAgIEZpeCBzcGFjZSBiZXR3 ZWVuIHRlc3QgZmlsZSBuYW1lIHBsYXRmb3JtIGV4ZWN1dGFibGUgZXh0ZW5zaW9uLA0KICAgICAg ICAgYW5kIGJldHdlZW4gZXhlY3V0YWJsZSBuYW1lIGFuZCBhcmd1bWVudHMsIGluIHRlc3Qgc2hl bGwgc2NyaXB0cw0KDQogICAgICAgICBBZGQgc3VwcG9ydCBmb3IgY29tcGlsaW5nIHJlc291cmNl IGZpbGVzICgucmMpIG9uIFdpbjMyDQoNCiAgICAgICAgIEZpeCBkZXBlbmRlbmNpZXMgdG8gYXZv aWQgdW5uZWNlc3NhcnkgcmVidWlsZHMgd2hlbiBub3QgdXNpbmcNCiAgICAgICAgIEJTRCBtYWtl DQoNCiAgICAgICAgIENvZGUgY2xlYW51cHMNCg0KICAgICAgICAgRml4IHR5cG9zDQoNCiAgICAg ICAgIChyZWZzICMzKQ0KDQotLSANClRpY2tldCBVUkw6IDxodHRwOi8vYmJkZXYuZmx1ZmZ5LmNv LnVrL3RyYWMvdGlja2V0LzM+DQpCb3ggQmFja3VwIDxodHRwOi8vd3d3LmZsdWZmeS5jby51ay9i b3hiYWNrdXAvPg0KQW4gb3BlbiBzb3VyY2UsIGNvbXBsZXRlbHkgYXV0b21hdGljIG9uLWxpbmUg YmFja3VwIHN5c3RlbSBmb3IgVU5JWC4= --===============2084145081==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:09:46 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:09:46 +0100 Subject: [Box Backup-dev] COMMIT r873 - box/chris/merge/infrastructure Message-ID: Author: chris Date: 2006-08-31 23:09:46 +0100 (Thu, 31 Aug 2006) New Revision: 873 Modified: box/chris/merge/infrastructure/makebuildenv.pl.in Log: * infrastructure/makebuildenv.pl.in Support multiple implicit dependencies Add lib/win32 as an implicit dependency on Win32 Make lib/common depend on lib/win32 on Win32 Fix space between test file name platform executable extension, and between executable name and arguments, in test shell scripts Add support for compiling resource files (.rc) on Win32 Fix dependencies to avoid unnecessary rebuilds when not using BSD make Code cleanups Fix typos (refs #3) Modified: box/chris/merge/infrastructure/makebuildenv.pl.in =================================================================== --- box/chris/merge/infrastructure/makebuildenv.pl.in 2006-08-31 22:01:53 UTC (rev 872) +++ box/chris/merge/infrastructure/makebuildenv.pl.in 2006-08-31 22:09:46 UTC (rev 873) @@ -14,9 +14,8 @@ print "Box build environment setup.\n\n"; +my @implicit_deps = ('lib/common'); -my $implicit_dep = 'lib/common'; - # work out platform variables use lib 'infrastructure'; use BoxPlatform; @@ -38,12 +37,16 @@ # flags about the environment my %env_flags; -my $windows_include_path = "-I../../lib/win32 "; -if ($target_os ne "mingw32" && $target_os ne "winnt") +my $windows_include_path = ""; +if ($target_windows) { - $windows_include_path = ""; - $env_flags{'IGNORE_lib/win32'} = 1; + $module_dependency{"lib/common"} = ["lib/win32"]; + push @implicit_deps, "lib/win32"; } +else +{ + # $env_flags{'IGNORE_lib/win32'} = 1; +} # print "Flag: $_\n" for(keys %env_flags); @@ -271,7 +274,7 @@ push @md,$_ unless ignore_module($_) } } - $module_dependency{$mod} = [$implicit_dep, at md]; + $module_dependency{$mod} = [@implicit_deps, at md]; $module_library_link_opts{$mod} = [@lo]; # make directories, but not if we're using an external library and this a library module @@ -286,8 +289,11 @@ } # make dirs for implicit dep -mkdir "release/$implicit_dep",0755; -mkdir "debug/$implicit_dep",0755; +foreach my $dep (@implicit_deps) +{ + mkdir "release/$dep",0755; + mkdir "debug/$dep",0755; +} # write a list of all the modules we've configured to use open CONFIGURED_MODS,'>local/modules.h' or die "Can't write configured modules list"; @@ -296,7 +302,7 @@ #ifndef _CONFIGURED_MODULES__H #define _CONFIGURED_MODULES__H __E -for($implicit_dep, at modules) +for(@implicit_deps, at modules) { my $m = $_; $m =~ s~/~_~; @@ -310,7 +316,7 @@ # now make a list of all the .h files we can find, recording which module they're in my %hfiles; -for my $mod (@modules, $implicit_dep) +for my $mod (@modules, @implicit_deps) { opendir DIR,$mod; my @items = readdir DIR; @@ -347,7 +353,7 @@ } } -for my $mod (@modules, $implicit_dep) +for my $mod (@modules, @implicit_deps) { opendir DIR,$mod; for my $h (grep /\.h\Z/i, readdir DIR) @@ -373,9 +379,10 @@ print "done\n\nGenerating Makefiles...\n"; +my %module_resources_win32; # Then write a makefile for each module -for my $mod (@modules, $implicit_dep) +for my $mod (@implicit_deps, @modules) { print $mod,"\n"; @@ -416,9 +423,9 @@ } writetestfile("$mod/_t", - './test' . $platform_exe_ext . '$1 $2 $3 $4 $5', $mod); + './test' . $platform_exe_ext . ' $1 $2 $3 $4 $5', $mod); writetestfile("$mod/_t-gdb", - 'gdb ./test ' . $platform_exe_ext, $mod); + 'gdb ./test' . $platform_exe_ext, $mod); } @@ -441,14 +448,14 @@ add_mod_deps(\@deps_raw, $mod); # and then dedup and reorder them my %d_done; - for(my $a = $#deps_raw; $a >= 0; $a--) + foreach my $dep (reverse @deps_raw) { - if(!exists $d_done{$deps_raw[$a]}) + if(!exists $d_done{$dep}) { # insert - push @all_deps_for_module, $deps_raw[$a]; + push @all_deps_for_module, $dep; # mark as done - $d_done{$deps_raw[$a]} = 1; + $d_done{$dep} = 1; } } } @@ -484,7 +491,7 @@ my $debug_link_extra = ($target_is_library)?'':'../../debug/lib/debug/debug.a'; my $release_flags = "-O2"; - if ($target_os eq "mingw32") + if ($target_windows) { $release_flags = "-O0 -g"; } @@ -499,6 +506,7 @@ AR = ar RANLIB = ranlib PERL = "@PERL@" +WINDRES = windres .ifdef RELEASE CXXFLAGS = -DNDEBUG $release_flags -Wall $include_paths $extra_platform_defines -DBOX_VERSION="\\"$product_version\\"" OUTBASE = ../../release @@ -546,7 +554,7 @@ @items = (@items, @autogen_items); } - # first, obtain a list of depenencies within the .h files + # first, obtain a list of dependencies within the .h files my %headers; for my $h (grep /\.h\Z/i, @items) { @@ -566,19 +574,30 @@ # then... do the cpp files... my @obj_base; - for my $cpp (@items) + for my $file (@items) { - next unless $cpp =~ m/\A(.+)\.cpp\Z/i; - next if $cpp =~ /\A\._/; # Temp Mac OS Resource hack + my $is_cpp = $file =~ m/\A(.+)\.cpp\Z/i; + my $is_rc = $file =~ m/\A(.+)\.rc\Z/i; + my $base = $1; + if ($target_windows) + { + next if not $is_cpp and not $is_rc; + } + else + { + next if not $is_cpp; + } + + next if $file =~ /\A\._/; # Temp Mac OS Resource hack + # store for later - my $base = $1; push @obj_base,$base; # get the file... - open FL,"$mod/$cpp"; + open FL,"$mod/$file"; my $f; - read FL,$f,-s "$mod/$cpp"; + read FL,$f,-s "$mod/$file"; close FL; my %dep; @@ -592,10 +611,29 @@ my $out_name = '$(OUTDIR)/'.$base.'.o'; # write the line for this cpp file - $make .= $out_name.': '.join(' ',$cpp,map - { ($hfiles{$_} eq $mod)?$_:'../../'.$hfiles{$_}."/$_" } keys %dep)."\n"; - $make .= "\t\$(CXX) \$(CXXFLAGS) $compile_line_extra -c $cpp -o $out_name\n\n"; + my @dep_paths = map + { + ($hfiles{$_} eq $mod) + ? $_ + : '../../'.$hfiles{$_}."/$_" + } + keys %dep; + $make .= $out_name.': '.join(' ',$file, at dep_paths)."\n"; + + if ($is_cpp) + { + $make .= "\t\$(CXX) \$(CXXFLAGS) $compile_line_extra ". + "-c $file -o $out_name\n\n"; + } + elsif ($is_rc) + { + $make .= "\t\$(WINDRES) $file $out_name\n\n"; + my $res_list = $module_resources_win32{$mod}; + $res_list ||= []; + push @$res_list, $base.'.o'; + $module_resources_win32{$mod} = $res_list; + } } my $has_deps = ($#{$module_dependency{$mod}} >= 0); @@ -647,11 +685,28 @@ additional_objects_from_make_fragment("$mod/Makefile.extra.$build_os", \@objs, \@makefile_includes); my $o_file_list = join(' ',map {'$(OUTDIR)/'.$_.'.o'} @objs); + + if ($has_deps and not $bsd_make) + { + print MAKE ".PHONY: all\n" . + "all: dep_modules $end_target\n\n"; + } + print MAKE $end_target,': ',$o_file_list; - print MAKE ' dep_modules' if $has_deps and not $bsd_make; print MAKE " ",$lib_files unless $target_is_library; print MAKE "\n"; + if ($target_windows) + { + foreach my $dep (@all_deps_for_module) + { + my $res_list = $module_resources_win32{$dep}; + next unless $res_list; + $o_file_list .= ' '.join(' ', + map {'$(OUTBASE)/'.$dep."/$_"} @$res_list); + } + } + # stuff to make the final target... if($target_is_library) { From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:11:50 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:11:50 +0100 Subject: [Box Backup-dev] COMMIT r874 - box/chris/merge/lib/backupclient Message-ID: Author: chris Date: 2006-08-31 23:11:50 +0100 (Thu, 31 Aug 2006) New Revision: 874 Modified: box/chris/merge/lib/backupclient/BackupClientFileAttributes.cpp Log: * lib/backupclient/BackupClientFileAttributes.cpp - Revert to trunk Modified: box/chris/merge/lib/backupclient/BackupClientFileAttributes.cpp =================================================================== --- box/chris/merge/lib/backupclient/BackupClientFileAttributes.cpp 2006-08-31 22:09:46 UTC (rev 873) +++ box/chris/merge/lib/backupclient/BackupClientFileAttributes.cpp 2006-08-31 22:11:50 UTC (rev 874) @@ -642,7 +642,6 @@ } // If working as root, set user IDs - #ifndef WIN32 if(::geteuid() == 0) { #ifndef HAVE_LCHOWN @@ -662,7 +661,6 @@ } #endif } - #endif if(static_cast(xattrOffset+sizeof(u_int32_t))<=mpClearAttributes->GetSize()) { From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:14:22 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:14:22 +0100 Subject: [Box Backup-dev] COMMIT r875 - box/chris/merge/lib/backupclient Message-ID: Author: chris Date: 2006-08-31 23:14:22 +0100 (Thu, 31 Aug 2006) New Revision: 875 Modified: box/chris/merge/lib/backupclient/BackupClientFileAttributes.cpp Log: * lib/backupclient/BackupClientFileAttributes.cpp Don't call geteuid() on Win32, since it's emulated, always returns 0, and I want to remove it entirely (refs #3) Modified: box/chris/merge/lib/backupclient/BackupClientFileAttributes.cpp =================================================================== --- box/chris/merge/lib/backupclient/BackupClientFileAttributes.cpp 2006-08-31 22:11:50 UTC (rev 874) +++ box/chris/merge/lib/backupclient/BackupClientFileAttributes.cpp 2006-08-31 22:14:22 UTC (rev 875) @@ -642,7 +642,11 @@ } // If working as root, set user IDs + #ifdef WIN32 + if(0) + #else if(::geteuid() == 0) + #endif { #ifndef HAVE_LCHOWN // only if not a link, can't set their owner on this platform From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:14:24 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:14:24 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.6d1675db6f0566b76696019b54ea197b@fluffy.co.uk> --===============0669976000== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODc1XSkgKiBs aWIvYmFja3VwY2xpZW50L0JhY2t1cENsaWVudEZpbGVBdHRyaWJ1dGVzLmNwcA0KDQogICAgICAg ICBEb24ndCBjYWxsIGdldGV1aWQoKSBvbiBXaW4zMiwgc2luY2UgaXQncyBlbXVsYXRlZCwgYWx3 YXlzIHJldHVybnMNCiAgICAgICAgIDAsIGFuZCBJIHdhbnQgdG8gcmVtb3ZlIGl0IGVudGlyZWx5 IChyZWZzICMzKQ0KDQotLSANClRpY2tldCBVUkw6IDxodHRwOi8vYmJkZXYuZmx1ZmZ5LmNvLnVr L3RyYWMvdGlja2V0LzM+DQpCb3ggQmFja3VwIDxodHRwOi8vd3d3LmZsdWZmeS5jby51ay9ib3hi YWNrdXAvPg0KQW4gb3BlbiBzb3VyY2UsIGNvbXBsZXRlbHkgYXV0b21hdGljIG9uLWxpbmUgYmFj a3VwIHN5c3RlbSBmb3IgVU5JWC4= --===============0669976000==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:15:09 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:15:09 +0100 Subject: [Box Backup-dev] COMMIT r876 - box/chris/merge/lib/backupclient Message-ID: Author: chris Date: 2006-08-31 23:15:09 +0100 (Thu, 31 Aug 2006) New Revision: 876 Modified: box/chris/merge/lib/backupclient/BackupStoreFile.cpp Log: * lib/backupclient/BackupStoreFile.cpp - Revert to trunk Modified: box/chris/merge/lib/backupclient/BackupStoreFile.cpp =================================================================== --- box/chris/merge/lib/backupclient/BackupStoreFile.cpp 2006-08-31 22:14:22 UTC (rev 875) +++ box/chris/merge/lib/backupclient/BackupStoreFile.cpp 2006-08-31 22:15:09 UTC (rev 876) @@ -289,8 +289,6 @@ // Copy it out to the file stream->CopyStreamTo(out); } - - out.Close(); // Write the attributes stream->GetAttributes().WriteAttributes(DecodedFilename); From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:16:17 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:16:17 +0100 Subject: [Box Backup-dev] COMMIT r877 - box/chris/merge/lib/backupclient Message-ID: Author: chris Date: 2006-08-31 23:16:17 +0100 (Thu, 31 Aug 2006) New Revision: 877 Modified: box/chris/merge/lib/backupclient/BackupStoreFile.cpp Log: * lib/backupclient/BackupStoreFile.cpp Close file before trying to apply attributes to it. Otherwise, when we close it the timestamp will be updated on Win32 (refs #3) Modified: box/chris/merge/lib/backupclient/BackupStoreFile.cpp =================================================================== --- box/chris/merge/lib/backupclient/BackupStoreFile.cpp 2006-08-31 22:15:09 UTC (rev 876) +++ box/chris/merge/lib/backupclient/BackupStoreFile.cpp 2006-08-31 22:16:17 UTC (rev 877) @@ -289,6 +289,8 @@ // Copy it out to the file stream->CopyStreamTo(out); } + + out.Close(); // Write the attributes stream->GetAttributes().WriteAttributes(DecodedFilename); From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:16:21 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:16:21 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.64c404019e7f7f39951ad99e96307971@fluffy.co.uk> --===============0306288479== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODc3XSkgKiBs aWIvYmFja3VwY2xpZW50L0JhY2t1cFN0b3JlRmlsZS5jcHANCg0KICAgICAgICAgQ2xvc2UgZmls ZSBiZWZvcmUgdHJ5aW5nIHRvIGFwcGx5IGF0dHJpYnV0ZXMgdG8gaXQuIE90aGVyd2lzZSwNCiAg ICAgICAgIHdoZW4gd2UgY2xvc2UgaXQgdGhlIHRpbWVzdGFtcCB3aWxsIGJlIHVwZGF0ZWQgb24g V2luMzIgKHJlZnMgIzMpDQoNCi0tIA0KVGlja2V0IFVSTDogPGh0dHA6Ly9iYmRldi5mbHVmZnku Y28udWsvdHJhYy90aWNrZXQvMz4NCkJveCBCYWNrdXAgPGh0dHA6Ly93d3cuZmx1ZmZ5LmNvLnVr L2JveGJhY2t1cC8+DQpBbiBvcGVuIHNvdXJjZSwgY29tcGxldGVseSBhdXRvbWF0aWMgb24tbGlu ZSBiYWNrdXAgc3lzdGVtIGZvciBVTklYLg== --===============0306288479==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:17:12 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:17:12 +0100 Subject: [Box Backup-dev] COMMIT r878 - box/chris/merge/lib/backupclient Message-ID: Author: chris Date: 2006-08-31 23:17:12 +0100 (Thu, 31 Aug 2006) New Revision: 878 Modified: box/chris/merge/lib/backupclient/BackupStoreObjectDump.cpp Log: * lib/backupclient/BackupStoreObjectDump.cpp - Revert to trunk Modified: box/chris/merge/lib/backupclient/BackupStoreObjectDump.cpp =================================================================== --- box/chris/merge/lib/backupclient/BackupStoreObjectDump.cpp 2006-08-31 22:16:17 UTC (rev 877) +++ box/chris/merge/lib/backupclient/BackupStoreObjectDump.cpp 2006-08-31 22:17:12 UTC (rev 878) @@ -113,13 +113,7 @@ // Output item int16_t f = (*i)->GetFlags(); -#ifdef WIN32 - OutputLine(file, ToTrace, - "%06I64x %4I64d %016I64x %4d %3d %4d%s%s%s%s%s%s\n", -#else - OutputLine(file, ToTrace, - "%06llx %4lld %016llx %4d %3d %4d%s%s%s%s%s%s\n", -#endif + OutputLine(file, ToTrace, "%06llx %4lld %016llx %4d %3d %4d%s%s%s%s%s%s\n", (*i)->GetObjectID(), (*i)->GetSizeInBlocks(), (*i)->GetAttributesHash(), From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:13:58 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 31 Aug 2006 23:13:58 +0100 Subject: [Box Backup-dev] COMMIT r863 - box/chris/merge/bin/bbstored In-Reply-To: <20060831202510.GH81028@netinertia.co.uk> References: <20060831201508.GG81028@netinertia.co.uk> <20060831202510.GH81028@netinertia.co.uk> Message-ID: <1157062438.26754.5.camel@avenin.ebourne.me.uk> On Thu, 2006-08-31 at 21:25 +0100, James O'Gorman wrote: > On Thu, Aug 31, 2006 at 09:15:41PM +0100, Chris Wilson wrote: > > It did work, but the formatting is not ideal. I wonder if I should format > > my commit messages differently, like this: > > > > * bin/bbstored/BackupStoreDaemon.h > > > > fixed foo > > > > fixed bar > > > > which should look better in trac. Is that a good idea? > > You can either use Trac's WikiFormatting (i.e. use [BR] to force a hard > line break) or, as you say just double-line space it. > > At the end of the day, I would guess it's probably more important to > make it readable in the svn commit message rather than in Trac's > automatic ticket feeding. But then I'm not the one committing, so maybe > Ben and Martin might have some views on this. I'm not really fussed. I don't mind wiki formatting in svn as long as it's still readable in svn log, and I don't mind if it doesn't look perfect in trac as long as it is still readable. One thing I've been thinking for a while is that including the list of files changed in the commit message is completely unnecessary and really just adds clutter. If you want to know which files were changed then it's just 'svn log -v' which is easy enough. Each entry in trac automatically hyperlinks through to the commit log and diff so it's not needed there either. And if you find yourself listing the files in the message so you can say what you did to each of them it should be in separate commits instead. :) Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:18:02 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:18:02 +0100 Subject: [Box Backup-dev] COMMIT r879 - box/chris/merge/lib/backupclient Message-ID: Author: chris Date: 2006-08-31 23:18:02 +0100 (Thu, 31 Aug 2006) New Revision: 879 Modified: box/chris/merge/lib/backupclient/BackupStoreObjectDump.cpp Log: * lib/backupclient/BackupStoreObjectDump.cpp Fix format strings on Win32 (refs #3) Modified: box/chris/merge/lib/backupclient/BackupStoreObjectDump.cpp =================================================================== --- box/chris/merge/lib/backupclient/BackupStoreObjectDump.cpp 2006-08-31 22:17:12 UTC (rev 878) +++ box/chris/merge/lib/backupclient/BackupStoreObjectDump.cpp 2006-08-31 22:18:02 UTC (rev 879) @@ -113,7 +113,13 @@ // Output item int16_t f = (*i)->GetFlags(); - OutputLine(file, ToTrace, "%06llx %4lld %016llx %4d %3d %4d%s%s%s%s%s%s\n", +#ifdef WIN32 + OutputLine(file, ToTrace, + "%06I64x %4I64d %016I64x %4d %3d %4d%s%s%s%s%s%s\n", +#else + OutputLine(file, ToTrace, + "%06llx %4lld %016llx %4d %3d %4d%s%s%s%s%s%s\n", +#endif (*i)->GetObjectID(), (*i)->GetSizeInBlocks(), (*i)->GetAttributesHash(), From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:18:05 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:18:05 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.0d1a205610cef81a8591e886dacf5e07@fluffy.co.uk> --===============0773465395== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODc5XSkgKiBs aWIvYmFja3VwY2xpZW50L0JhY2t1cFN0b3JlT2JqZWN0RHVtcC5jcHANCg0KICAgICAgICAgRml4 IGZvcm1hdCBzdHJpbmdzIG9uIFdpbjMyIChyZWZzICMzKQ0KDQotLSANClRpY2tldCBVUkw6IDxo dHRwOi8vYmJkZXYuZmx1ZmZ5LmNvLnVrL3RyYWMvdGlja2V0LzM+DQpCb3ggQmFja3VwIDxodHRw Oi8vd3d3LmZsdWZmeS5jby51ay9ib3hiYWNrdXAvPg0KQW4gb3BlbiBzb3VyY2UsIGNvbXBsZXRl bHkgYXV0b21hdGljIG9uLWxpbmUgYmFja3VwIHN5c3RlbSBmb3IgVU5JWC4= --===============0773465395==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:19:09 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:19:09 +0100 Subject: [Box Backup-dev] COMMIT r880 - box/chris/merge/lib/backupstore Message-ID: Author: chris Date: 2006-08-31 23:19:09 +0100 (Thu, 31 Aug 2006) New Revision: 880 Modified: box/chris/merge/lib/backupstore/BackupStoreAccounts.cpp Log: * lib/backupstore/BackupStoreAccounts.cpp - Revert to trunk Modified: box/chris/merge/lib/backupstore/BackupStoreAccounts.cpp =================================================================== --- box/chris/merge/lib/backupstore/BackupStoreAccounts.cpp 2006-08-31 22:18:02 UTC (rev 879) +++ box/chris/merge/lib/backupstore/BackupStoreAccounts.cpp 2006-08-31 22:19:09 UTC (rev 880) @@ -141,9 +141,8 @@ std::string BackupStoreAccounts::MakeAccountRootDir(int32_t ID, int DiscSet) const { char accid[64]; // big enough! - ::sprintf(accid, "%08x" DIRECTORY_SEPARATOR, ID); - return std::string(std::string(BOX_RAIDFILE_ROOT_BBSTORED - DIRECTORY_SEPARATOR) + accid); + ::sprintf(accid, "%08x/", ID); + return std::string(std::string(BOX_RAIDFILE_ROOT_BBSTORED DIRECTORY_SEPARATOR) + accid); } From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:20:45 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:20:45 +0100 Subject: [Box Backup-dev] COMMIT r881 - box/chris/merge/lib/backupstore Message-ID: Author: chris Date: 2006-08-31 23:20:45 +0100 (Thu, 31 Aug 2006) New Revision: 881 Modified: box/chris/merge/lib/backupstore/BackupStoreAccounts.cpp Log: Use DIRECTORY_SEPARATOR instead of assuming that it's a forward slash Modified: box/chris/merge/lib/backupstore/BackupStoreAccounts.cpp =================================================================== --- box/chris/merge/lib/backupstore/BackupStoreAccounts.cpp 2006-08-31 22:19:09 UTC (rev 880) +++ box/chris/merge/lib/backupstore/BackupStoreAccounts.cpp 2006-08-31 22:20:45 UTC (rev 881) @@ -141,8 +141,9 @@ std::string BackupStoreAccounts::MakeAccountRootDir(int32_t ID, int DiscSet) const { char accid[64]; // big enough! - ::sprintf(accid, "%08x/", ID); - return std::string(std::string(BOX_RAIDFILE_ROOT_BBSTORED DIRECTORY_SEPARATOR) + accid); + ::sprintf(accid, "%08x" DIRECTORY_SEPARATOR, ID); + return std::string(std::string(BOX_RAIDFILE_ROOT_BBSTORED + DIRECTORY_SEPARATOR) + accid); } From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:21:28 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:21:28 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.dc992884f53825fd53ae11695675514b@fluffy.co.uk> --===============0009673464== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIFBsZWFzZSByZXZpZXcg Wzg4MV0NCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFj L3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3Vw Lz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBz eXN0ZW0gZm9yIFVOSVgu --===============0009673464==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:22:35 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:22:35 +0100 Subject: [Box Backup-dev] COMMIT r882 - box/chris/merge/lib/backupstore Message-ID: Author: chris Date: 2006-08-31 23:22:35 +0100 (Thu, 31 Aug 2006) New Revision: 882 Modified: box/chris/merge/lib/backupstore/BackupStoreCheck.cpp Log: Revert to trunk Modified: box/chris/merge/lib/backupstore/BackupStoreCheck.cpp =================================================================== --- box/chris/merge/lib/backupstore/BackupStoreCheck.cpp 2006-08-31 22:20:45 UTC (rev 881) +++ box/chris/merge/lib/backupstore/BackupStoreCheck.cpp 2006-08-31 22:22:35 UTC (rev 882) @@ -328,8 +328,7 @@ std::string dirName; StoreStructure::MakeObjectFilename(StartID, mStoreRoot, mDiscSetNumber, dirName, false /* don't make sure the dir exists */); // Check expectations - ASSERT(dirName.size() > 4 && - dirName[dirName.size() - 4] == DIRECTORY_SEPARATOR_ASCHAR); + ASSERT(dirName.size() > 4 && dirName[dirName.size() - 4] == '/'); // Remove the filename from it dirName.resize(dirName.size() - 4); // four chars for "/o00" @@ -378,9 +377,7 @@ if(!fileOK) { // Unexpected or bad file, delete it - ::printf("Spurious file %s" DIRECTORY_SEPARATOR "%s " - "found%s\n", dirName.c_str(), (*i).c_str(), - mFixErrors?", deleting":""); + ::printf("Spurious file %s/%s found%s\n", dirName.c_str(), (*i).c_str(), mFixErrors?", deleting":""); ++mNumberErrorsFound; if(mFixErrors) { @@ -469,11 +466,10 @@ } // Add to usage counts - int64_t s = file->GetDiscUsageInBlocks(); - mBlocksUsed += s; + mBlocksUsed += size; if(!isFile) { - mBlocksInDirectories += s; + mBlocksInDirectories += size; } } catch(...) From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:24:00 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:24:00 +0100 Subject: [Box Backup-dev] COMMIT r883 - box/chris/merge/lib/backupstore Message-ID: Author: chris Date: 2006-08-31 23:24:00 +0100 (Thu, 31 Aug 2006) New Revision: 883 Modified: box/chris/merge/lib/backupstore/BackupStoreCheck.cpp Log: Use DIRECTORY_SEPARATOR instead of assuming that it's a forward slash (refs #3) Modified: box/chris/merge/lib/backupstore/BackupStoreCheck.cpp =================================================================== --- box/chris/merge/lib/backupstore/BackupStoreCheck.cpp 2006-08-31 22:22:35 UTC (rev 882) +++ box/chris/merge/lib/backupstore/BackupStoreCheck.cpp 2006-08-31 22:24:00 UTC (rev 883) @@ -328,7 +328,8 @@ std::string dirName; StoreStructure::MakeObjectFilename(StartID, mStoreRoot, mDiscSetNumber, dirName, false /* don't make sure the dir exists */); // Check expectations - ASSERT(dirName.size() > 4 && dirName[dirName.size() - 4] == '/'); + ASSERT(dirName.size() > 4 && + dirName[dirName.size() - 4] == DIRECTORY_SEPARATOR_ASCHAR); // Remove the filename from it dirName.resize(dirName.size() - 4); // four chars for "/o00" @@ -377,7 +378,9 @@ if(!fileOK) { // Unexpected or bad file, delete it - ::printf("Spurious file %s/%s found%s\n", dirName.c_str(), (*i).c_str(), mFixErrors?", deleting":""); + ::printf("Spurious file %s" DIRECTORY_SEPARATOR "%s " + "found%s\n", dirName.c_str(), (*i).c_str(), + mFixErrors?", deleting":""); ++mNumberErrorsFound; if(mFixErrors) { From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:24:02 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:24:02 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.f1b81c91eb4bce4482e4795b6b1d5717@fluffy.co.uk> --===============1562481538== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODgzXSkgVXNl IERJUkVDVE9SWV9TRVBBUkFUT1IgaW5zdGVhZCBvZiBhc3N1bWluZyB0aGF0IGl0J3MgYSBmb3J3 YXJkDQogc2xhc2gNCiAocmVmcyAjMykNCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2 LmZsdWZmeS5jby51ay90cmFjL3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVm ZnkuY28udWsvYm94YmFja3VwLz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRp YyBvbi1saW5lIGJhY2t1cCBzeXN0ZW0gZm9yIFVOSVgu --===============1562481538==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:25:28 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:25:28 +0100 Subject: [Box Backup-dev] COMMIT r884 - box/chris/merge/lib/common Message-ID: Author: chris Date: 2006-08-31 23:25:27 +0100 (Thu, 31 Aug 2006) New Revision: 884 Modified: box/chris/merge/lib/common/BoxPlatform.h Log: Revert to trunk Modified: box/chris/merge/lib/common/BoxPlatform.h =================================================================== --- box/chris/merge/lib/common/BoxPlatform.h 2006-08-31 22:24:00 UTC (rev 883) +++ box/chris/merge/lib/common/BoxPlatform.h 2006-08-31 22:25:27 UTC (rev 884) @@ -40,8 +40,8 @@ #endif #endif -// Slight hack; disable interception in raidfile test on Darwin and Windows -#if defined __APPLE__ || defined WIN32 +// Slight hack; disable interception on Darwin within raidfile test +#ifdef __APPLE__ // TODO: Replace with autoconf test #define PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE #endif @@ -138,11 +138,6 @@ #define INFTIM -1 #endif -// for Unix compatibility with Windows :-) -#if !HAVE_DECL_O_BINARY - #define O_BINARY 0 -#endif - #ifdef WIN32 typedef u_int64_t InodeRefType; #else From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:26:54 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:26:54 +0100 Subject: [Box Backup-dev] COMMIT r885 - box/chris/merge/lib/common Message-ID: Author: chris Date: 2006-08-31 23:26:54 +0100 (Thu, 31 Aug 2006) New Revision: 885 Modified: box/chris/merge/lib/common/BoxPlatform.h Log: Disable intercept tests on Win32 as well Define O_BINARY to 0 (zero) if our platform doesn't have it (all except Win32?) which enables us to reduce #ifdefs (refs #3) Modified: box/chris/merge/lib/common/BoxPlatform.h =================================================================== --- box/chris/merge/lib/common/BoxPlatform.h 2006-08-31 22:25:27 UTC (rev 884) +++ box/chris/merge/lib/common/BoxPlatform.h 2006-08-31 22:26:54 UTC (rev 885) @@ -40,8 +40,8 @@ #endif #endif -// Slight hack; disable interception on Darwin within raidfile test -#ifdef __APPLE__ +// Slight hack; disable interception in raidfile test on Darwin and Windows +#if defined __APPLE__ || defined WIN32 // TODO: Replace with autoconf test #define PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE #endif @@ -138,6 +138,11 @@ #define INFTIM -1 #endif +// for Unix compatibility with Windows :-) +#if !HAVE_DECL_O_BINARY + #define O_BINARY 0 +#endif + #ifdef WIN32 typedef u_int64_t InodeRefType; #else From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:26:55 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:26:55 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.5af6ecba097ce30dd4a30541f4cac77c@fluffy.co.uk> --===============0920667239== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODg1XSkgRGlz YWJsZSBpbnRlcmNlcHQgdGVzdHMgb24gV2luMzIgYXMgd2VsbA0KDQogRGVmaW5lIE9fQklOQVJZ IHRvIDAgKHplcm8pIGlmIG91ciBwbGF0Zm9ybSBkb2Vzbid0IGhhdmUgaXQgKGFsbCBleGNlcHQN CiBXaW4zMj8pIHdoaWNoIGVuYWJsZXMgdXMgdG8gcmVkdWNlICNpZmRlZnMNCg0KIChyZWZzICMz KQ0KDQotLSANClRpY2tldCBVUkw6IDxodHRwOi8vYmJkZXYuZmx1ZmZ5LmNvLnVrL3RyYWMvdGlj a2V0LzM+DQpCb3ggQmFja3VwIDxodHRwOi8vd3d3LmZsdWZmeS5jby51ay9ib3hiYWNrdXAvPg0K QW4gb3BlbiBzb3VyY2UsIGNvbXBsZXRlbHkgYXV0b21hdGljIG9uLWxpbmUgYmFja3VwIHN5c3Rl bSBmb3IgVU5JWC4= --===============0920667239==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:27:43 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:27:43 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.04d4c982571ba4f6e8bd6e63dc04cfbd@fluffy.co.uk> --===============0603850601== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNoYW5nZXMgKGJ5IGNocmlzKToNCg0KICAqIGNjOiAgY2hyaXMr Ym94YmFja3VwQHF3aXJ4LmNvbSA9Pg0KDQotLSANClRpY2tldCBVUkw6IDxodHRwOi8vYmJkZXYu Zmx1ZmZ5LmNvLnVrL3RyYWMvdGlja2V0LzM+DQpCb3ggQmFja3VwIDxodHRwOi8vd3d3LmZsdWZm eS5jby51ay9ib3hiYWNrdXAvPg0KQW4gb3BlbiBzb3VyY2UsIGNvbXBsZXRlbHkgYXV0b21hdGlj IG9uLWxpbmUgYmFja3VwIHN5c3RlbSBmb3IgVU5JWC4= --===============0603850601==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:28:35 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:28:35 +0100 Subject: [Box Backup-dev] COMMIT r886 - box/chris/merge/lib/common Message-ID: Author: chris Date: 2006-08-31 23:28:35 +0100 (Thu, 31 Aug 2006) New Revision: 886 Modified: box/chris/merge/lib/common/FdGetLine.h Log: Revert to trunk Modified: box/chris/merge/lib/common/FdGetLine.h =================================================================== --- box/chris/merge/lib/common/FdGetLine.h 2006-08-31 22:26:54 UTC (rev 885) +++ box/chris/merge/lib/common/FdGetLine.h 2006-08-31 22:28:35 UTC (rev 886) @@ -14,10 +14,6 @@ #ifdef NDEBUG #define FDGETLINE_BUFFER_SIZE 1024 -#elif defined WIN32 - // need enough space for at least one unicode character - // in UTF-8 when calling console_read() from bbackupquery - #define FDGETLINE_BUFFER_SIZE 5 #else #define FDGETLINE_BUFFER_SIZE 4 #endif From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:29:31 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:29:31 +0100 Subject: [Box Backup-dev] COMMIT r887 - box/chris/merge/lib/common Message-ID: Author: chris Date: 2006-08-31 23:29:31 +0100 (Thu, 31 Aug 2006) New Revision: 887 Modified: box/chris/merge/lib/common/FdGetLine.h Log: Make FDGETLINE_BUFFER_SIZE big enough for one unicode character on Win32, otherwise reading from console can fail due to insufficient buffer size. (refs #3) Modified: box/chris/merge/lib/common/FdGetLine.h =================================================================== --- box/chris/merge/lib/common/FdGetLine.h 2006-08-31 22:28:35 UTC (rev 886) +++ box/chris/merge/lib/common/FdGetLine.h 2006-08-31 22:29:31 UTC (rev 887) @@ -14,6 +14,10 @@ #ifdef NDEBUG #define FDGETLINE_BUFFER_SIZE 1024 +#elif defined WIN32 + // need enough space for at least one unicode character + // in UTF-8 when calling console_read() from bbackupquery + #define FDGETLINE_BUFFER_SIZE 5 #else #define FDGETLINE_BUFFER_SIZE 4 #endif From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:29:31 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:29:31 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.cf406f5deb0cc1e4ef7621b4c081fde1@fluffy.co.uk> --===============0621712786== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODg3XSkgTWFr ZSBGREdFVExJTkVfQlVGRkVSX1NJWkUgYmlnIGVub3VnaCBmb3Igb25lIHVuaWNvZGUgY2hhcmFj dGVyDQogb24gV2luMzIsDQogb3RoZXJ3aXNlIHJlYWRpbmcgZnJvbSBjb25zb2xlIGNhbiBmYWls IGR1ZSB0byBpbnN1ZmZpY2llbnQgYnVmZmVyIHNpemUuDQogKHJlZnMgIzMpDQoNCi0tIA0KVGlj a2V0IFVSTDogPGh0dHA6Ly9iYmRldi5mbHVmZnkuY28udWsvdHJhYy90aWNrZXQvMz4NCkJveCBC YWNrdXAgPGh0dHA6Ly93d3cuZmx1ZmZ5LmNvLnVrL2JveGJhY2t1cC8+DQpBbiBvcGVuIHNvdXJj ZSwgY29tcGxldGVseSBhdXRvbWF0aWMgb24tbGluZSBiYWNrdXAgc3lzdGVtIGZvciBVTklYLg== --===============0621712786==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:30:27 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:30:27 +0100 Subject: [Box Backup-dev] COMMIT r888 - box/chris/merge/lib/common Message-ID: Author: chris Date: 2006-08-31 23:30:27 +0100 (Thu, 31 Aug 2006) New Revision: 888 Modified: box/chris/merge/lib/common/Guards.h Log: Revert to trunk Modified: box/chris/merge/lib/common/Guards.h =================================================================== --- box/chris/merge/lib/common/Guards.h 2006-08-31 22:29:31 UTC (rev 887) +++ box/chris/merge/lib/common/Guards.h 2006-08-31 22:30:27 UTC (rev 888) @@ -24,7 +24,7 @@ #include "MemLeakFindOn.h" -template +template class FileHandleGuard { public: From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:31:10 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:31:10 +0100 Subject: [Box Backup-dev] COMMIT r889 - box/chris/merge/lib/common Message-ID: Author: chris Date: 2006-08-31 23:31:10 +0100 (Thu, 31 Aug 2006) New Revision: 889 Modified: box/chris/merge/lib/common/Guards.h Log: Add O_BINARY to default flags, since most files opened this way should be opened in binary mode on Win32 (refs #3) Modified: box/chris/merge/lib/common/Guards.h =================================================================== --- box/chris/merge/lib/common/Guards.h 2006-08-31 22:30:27 UTC (rev 888) +++ box/chris/merge/lib/common/Guards.h 2006-08-31 22:31:10 UTC (rev 889) @@ -24,7 +24,7 @@ #include "MemLeakFindOn.h" -template +template class FileHandleGuard { public: From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:31:11 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:31:11 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.3921e054ac213e19040f7e5354f45b27@fluffy.co.uk> --===============0039225787== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODg5XSkgQWRk IE9fQklOQVJZIHRvIGRlZmF1bHQgZmxhZ3MsIHNpbmNlIG1vc3QgZmlsZXMgb3BlbmVkIHRoaXMg d2F5DQogc2hvdWxkDQogYmUgb3BlbmVkIGluIGJpbmFyeSBtb2RlIG9uIFdpbjMyIChyZWZzICMz KQ0KDQotLSANClRpY2tldCBVUkw6IDxodHRwOi8vYmJkZXYuZmx1ZmZ5LmNvLnVrL3RyYWMvdGlj a2V0LzM+DQpCb3ggQmFja3VwIDxodHRwOi8vd3d3LmZsdWZmeS5jby51ay9ib3hiYWNrdXAvPg0K QW4gb3BlbiBzb3VyY2UsIGNvbXBsZXRlbHkgYXV0b21hdGljIG9uLWxpbmUgYmFja3VwIHN5c3Rl bSBmb3IgVU5JWC4= --===============0039225787==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:32:17 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:32:17 +0100 Subject: [Box Backup-dev] COMMIT r890 - box/chris/merge/lib/common Message-ID: Author: chris Date: 2006-08-31 23:32:17 +0100 (Thu, 31 Aug 2006) New Revision: 890 Modified: box/chris/merge/lib/common/makeexception.pl.in Log: Revert to trunk Modified: box/chris/merge/lib/common/makeexception.pl.in =================================================================== --- box/chris/merge/lib/common/makeexception.pl.in 2006-08-31 22:31:10 UTC (rev 889) +++ box/chris/merge/lib/common/makeexception.pl.in 2006-08-31 22:32:17 UTC (rev 890) @@ -1,11 +1,9 @@ #!@PERL@ -use lib "../../infrastructure"; -use BoxPlatform; - # global exception list file my $global_list = '../../ExceptionCodes.txt'; + my @exception; my @exception_desc; my $class; @@ -48,8 +46,8 @@ # write the code print "Generating $class exception...\n"; -open CPP,">autogen_${class}Exception.cpp.new" or die "Can't open cpp file for writing"; -open H,">autogen_${class}Exception.h.new" or die "Can't open h file for writing"; +open CPP,">autogen_${class}Exception.cpp" or die "Can't open cpp file for writing"; +open H,">autogen_${class}Exception.h" or die "Can't open h file for writing"; # write header file my $guardname = uc 'AUTOGEN_'.$class.'EXCEPTION_H'; @@ -202,9 +200,6 @@ close H; close CPP; -update_if_changed("autogen_${class}Exception.cpp"); -update_if_changed("autogen_${class}Exception.h"); - # update the global exception list my $list_before; my $list_after; From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:33:05 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:33:05 +0100 Subject: [Box Backup-dev] COMMIT r891 - box/chris/merge/lib/common Message-ID: Author: chris Date: 2006-08-31 23:33:05 +0100 (Thu, 31 Aug 2006) New Revision: 891 Modified: box/chris/merge/lib/common/UnixUser.cpp Log: Revert to trunk Modified: box/chris/merge/lib/common/UnixUser.cpp =================================================================== --- box/chris/merge/lib/common/UnixUser.cpp 2006-08-31 22:32:17 UTC (rev 890) +++ box/chris/merge/lib/common/UnixUser.cpp 2006-08-31 22:33:05 UTC (rev 891) @@ -75,7 +75,6 @@ // -------------------------------------------------------------------------- UnixUser::~UnixUser() { -#ifndef WIN32 if(mRevertOnDestruction) { // Revert to "real" user and group id of the process @@ -85,7 +84,6 @@ THROW_EXCEPTION(CommonException, CouldNotRestoreProcessUser) } } -#endif } @@ -100,7 +98,6 @@ // -------------------------------------------------------------------------- void UnixUser::ChangeProcessUser(bool Temporary) { -#ifndef WIN32 if(Temporary) { // Change temporarily (change effective only) @@ -122,7 +119,6 @@ THROW_EXCEPTION(CommonException, CouldNotChangeProcessUser) } } -#endif } From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:35:51 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:35:51 +0100 Subject: [Box Backup-dev] COMMIT r892 - box/chris/merge/lib/common Message-ID: Author: chris Date: 2006-08-31 23:35:51 +0100 (Thu, 31 Aug 2006) New Revision: 892 Modified: box/chris/merge/lib/common/UnixUser.cpp Log: Disable all calls to set*id() on Win32 (doesn't work) (refs #3) Modified: box/chris/merge/lib/common/UnixUser.cpp =================================================================== --- box/chris/merge/lib/common/UnixUser.cpp 2006-08-31 22:33:05 UTC (rev 891) +++ box/chris/merge/lib/common/UnixUser.cpp 2006-08-31 22:35:51 UTC (rev 892) @@ -78,8 +78,12 @@ if(mRevertOnDestruction) { // Revert to "real" user and group id of the process + #ifdef WIN32 + if(0) + #else if(::setegid(::getgid()) != 0 || ::seteuid(::getuid()) != 0) + #endif { THROW_EXCEPTION(CommonException, CouldNotRestoreProcessUser) } @@ -101,8 +105,12 @@ if(Temporary) { // Change temporarily (change effective only) + #ifdef WIN32 + if(0) + #else if(::setegid(mGID) != 0 || ::seteuid(mUID) != 0) + #endif { THROW_EXCEPTION(CommonException, CouldNotChangeProcessUser) } @@ -112,9 +120,13 @@ } else { - // Change perminantely (change all UIDs and GIDs) + // Change permanently (change all UIDs and GIDs) + #ifdef WIN32 + if(0) + #else if(::setgid(mGID) != 0 || ::setuid(mUID) != 0) + #endif { THROW_EXCEPTION(CommonException, CouldNotChangeProcessUser) } From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:35:52 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:35:52 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.5fe124815260270d68c9a8267867b32a@fluffy.co.uk> --===============0178928946== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODkyXSkgRGlz YWJsZSBhbGwgY2FsbHMgdG8gc2V0KmlkKCkgb24gV2luMzIgKGRvZXNuJ3Qgd29yaykgKHJlZnMg IzMpDQoNCi0tIA0KVGlja2V0IFVSTDogPGh0dHA6Ly9iYmRldi5mbHVmZnkuY28udWsvdHJhYy90 aWNrZXQvMz4NCkJveCBCYWNrdXAgPGh0dHA6Ly93d3cuZmx1ZmZ5LmNvLnVrL2JveGJhY2t1cC8+ DQpBbiBvcGVuIHNvdXJjZSwgY29tcGxldGVseSBhdXRvbWF0aWMgb24tbGluZSBiYWNrdXAgc3lz dGVtIGZvciBVTklYLg== --===============0178928946==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:37:03 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:37:03 +0100 Subject: [Box Backup-dev] COMMIT r893 - box/chris/merge/lib/raidfile Message-ID: Author: chris Date: 2006-08-31 23:37:03 +0100 (Thu, 31 Aug 2006) New Revision: 893 Modified: box/chris/merge/lib/raidfile/RaidFileRead.cpp Log: Revert to trunk Modified: box/chris/merge/lib/raidfile/RaidFileRead.cpp =================================================================== --- box/chris/merge/lib/raidfile/RaidFileRead.cpp 2006-08-31 22:35:51 UTC (rev 892) +++ box/chris/merge/lib/raidfile/RaidFileRead.cpp 2006-08-31 22:37:03 UTC (rev 893) @@ -14,20 +14,10 @@ #include #include #include - -#ifdef HAVE_SYS_UIO_H #include -#endif - -#ifdef HAVE_SYSLOG_H #include -#endif - #include - -#ifdef HAVE_DIRENT_H #include -#endif #include #include @@ -593,8 +583,7 @@ // Open the parity file std::string parityFilename(RaidFileUtil::MakeRaidComponentName(rdiscSet, mFilename, (2 + startDisc) % READ_NUMBER_DISCS_REQUIRED)); - mParityHandle = ::open(parityFilename.c_str(), - O_RDONLY | O_BINARY, 0555); + mParityHandle = ::open(parityFilename.c_str(), O_RDONLY, 0555); if(mParityHandle == -1) { THROW_EXCEPTION(RaidFileException, OSError) @@ -1028,8 +1017,7 @@ std::string writeFilename(RaidFileUtil::MakeWriteFileName(rdiscSet, Filename)); // Attempt to open - int osFileHandle = ::open(writeFilename.c_str(), - O_RDONLY | O_BINARY, 0); + int osFileHandle = ::open(writeFilename.c_str(), O_RDONLY, 0); if(osFileHandle == -1) { THROW_EXCEPTION(RaidFileException, ErrorOpeningFileForRead) @@ -1067,15 +1055,13 @@ try { // Open stripe1 - stripe1 = ::open(stripe1Filename.c_str(), - O_RDONLY | O_BINARY, 0555); + stripe1 = ::open(stripe1Filename.c_str(), O_RDONLY, 0555); if(stripe1 == -1) { stripe1errno = errno; } // Open stripe2 - stripe2 = ::open(stripe2Filename.c_str(), - O_RDONLY | O_BINARY, 0555); + stripe2 = ::open(stripe2Filename.c_str(), O_RDONLY, 0555); if(stripe2 == -1) { stripe2errno = errno; @@ -1183,8 +1169,7 @@ // Open stripe1? if(existingFiles & RaidFileUtil::Stripe1Exists) { - stripe1 = ::open(stripe1Filename.c_str(), - O_RDONLY | O_BINARY, 0555); + stripe1 = ::open(stripe1Filename.c_str(), O_RDONLY, 0555); if(stripe1 == -1) { THROW_EXCEPTION(RaidFileException, OSError) @@ -1193,16 +1178,14 @@ // Open stripe2? if(existingFiles & RaidFileUtil::Stripe2Exists) { - stripe2 = ::open(stripe2Filename.c_str(), - O_RDONLY | O_BINARY, 0555); + stripe2 = ::open(stripe2Filename.c_str(), O_RDONLY, 0555); if(stripe2 == -1) { THROW_EXCEPTION(RaidFileException, OSError) } } // Open parity - parity = ::open(parityFilename.c_str(), - O_RDONLY | O_BINARY, 0555); + parity = ::open(parityFilename.c_str(), O_RDONLY, 0555); if(parity == -1) { THROW_EXCEPTION(RaidFileException, OSError) From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:39:45 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:39:45 +0100 Subject: [Box Backup-dev] COMMIT r894 - box/chris/merge/lib/raidfile Message-ID: Author: chris Date: 2006-08-31 23:39:45 +0100 (Thu, 31 Aug 2006) New Revision: 894 Modified: box/chris/merge/lib/raidfile/RaidFileRead.cpp Log: (refs #3) Don't include headers that we don't have Open RAID files in binary mode Modified: box/chris/merge/lib/raidfile/RaidFileRead.cpp =================================================================== --- box/chris/merge/lib/raidfile/RaidFileRead.cpp 2006-08-31 22:37:03 UTC (rev 893) +++ box/chris/merge/lib/raidfile/RaidFileRead.cpp 2006-08-31 22:39:45 UTC (rev 894) @@ -14,11 +14,20 @@ #include #include #include -#include -#include #include -#include +#ifdef HAVE_SYS_UIO_H + #include +#endif + +#ifdef HAVE_SYSLOG_H + #include +#endif + +#ifdef HAVE_DIRENT_H + #include +#endif + #include #include #include @@ -583,7 +592,8 @@ // Open the parity file std::string parityFilename(RaidFileUtil::MakeRaidComponentName(rdiscSet, mFilename, (2 + startDisc) % READ_NUMBER_DISCS_REQUIRED)); - mParityHandle = ::open(parityFilename.c_str(), O_RDONLY, 0555); + mParityHandle = ::open(parityFilename.c_str(), + O_RDONLY | O_BINARY, 0555); if(mParityHandle == -1) { THROW_EXCEPTION(RaidFileException, OSError) @@ -1017,7 +1027,8 @@ std::string writeFilename(RaidFileUtil::MakeWriteFileName(rdiscSet, Filename)); // Attempt to open - int osFileHandle = ::open(writeFilename.c_str(), O_RDONLY, 0); + int osFileHandle = ::open(writeFilename.c_str(), + O_RDONLY | O_BINARY, 0); if(osFileHandle == -1) { THROW_EXCEPTION(RaidFileException, ErrorOpeningFileForRead) @@ -1055,13 +1066,15 @@ try { // Open stripe1 - stripe1 = ::open(stripe1Filename.c_str(), O_RDONLY, 0555); + stripe1 = ::open(stripe1Filename.c_str(), + O_RDONLY | O_BINARY, 0555); if(stripe1 == -1) { stripe1errno = errno; } // Open stripe2 - stripe2 = ::open(stripe2Filename.c_str(), O_RDONLY, 0555); + stripe2 = ::open(stripe2Filename.c_str(), + O_RDONLY | O_BINARY, 0555); if(stripe2 == -1) { stripe2errno = errno; @@ -1169,7 +1182,8 @@ // Open stripe1? if(existingFiles & RaidFileUtil::Stripe1Exists) { - stripe1 = ::open(stripe1Filename.c_str(), O_RDONLY, 0555); + stripe1 = ::open(stripe1Filename.c_str(), + O_RDONLY | O_BINARY, 0555); if(stripe1 == -1) { THROW_EXCEPTION(RaidFileException, OSError) @@ -1178,14 +1192,16 @@ // Open stripe2? if(existingFiles & RaidFileUtil::Stripe2Exists) { - stripe2 = ::open(stripe2Filename.c_str(), O_RDONLY, 0555); + stripe2 = ::open(stripe2Filename.c_str(), + O_RDONLY | O_BINARY, 0555); if(stripe2 == -1) { THROW_EXCEPTION(RaidFileException, OSError) } } // Open parity - parity = ::open(parityFilename.c_str(), O_RDONLY, 0555); + parity = ::open(parityFilename.c_str(), + O_RDONLY | O_BINARY, 0555); if(parity == -1) { THROW_EXCEPTION(RaidFileException, OSError) From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:39:46 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:39:46 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.0d349335394e68714b615f879b480360@fluffy.co.uk> --===============1579663513== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODk0XSkgKHJl ZnMgIzMpDQoNCiBEb24ndCBpbmNsdWRlIGhlYWRlcnMgdGhhdCB3ZSBkb24ndCBoYXZlDQoNCiBP cGVuIFJBSUQgZmlsZXMgaW4gYmluYXJ5IG1vZGUNCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDov L2JiZGV2LmZsdWZmeS5jby51ay90cmFjL3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3 dy5mbHVmZnkuY28udWsvYm94YmFja3VwLz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1 dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBzeXN0ZW0gZm9yIFVOSVgu --===============1579663513==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:37:28 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 31 Aug 2006 23:37:28 +0100 Subject: [Box Backup-dev] [861] Message-ID: <1157063848.26754.8.camel@avenin.ebourne.me.uk> --- bin/bbstored/BackupCommands.cpp (revision 860) +++ bin/bbstored/BackupCommands.cpp (revision 861) @@ -380,9 +376,7 @@ combined->Seek(0, IOStream::SeekType_Absolute); // Then shuffle round for the next go -#ifdef WIN32 if (from.get()) from->Close(); -#endif from = combined; } I don't see here why the from->Close() is needed at all. As far as I can see the destructor will call Close() on the next line anyway. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:44:18 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:44:18 +0100 Subject: [Box Backup-dev] COMMIT r895 - box/chris/merge/lib/raidfile Message-ID: Author: chris Date: 2006-08-31 23:44:18 +0100 (Thu, 31 Aug 2006) New Revision: 895 Modified: box/chris/merge/lib/raidfile/RaidFileWrite.cpp Log: Revert to trunk Modified: box/chris/merge/lib/raidfile/RaidFileWrite.cpp =================================================================== --- box/chris/merge/lib/raidfile/RaidFileWrite.cpp 2006-08-31 22:39:45 UTC (rev 894) +++ box/chris/merge/lib/raidfile/RaidFileWrite.cpp 2006-08-31 22:44:18 UTC (rev 895) @@ -104,8 +104,7 @@ writeFilename += 'X'; // Attempt to open - mOSFileHandle = ::open(writeFilename.c_str(), - O_WRONLY | O_CREAT | O_BINARY, + mOSFileHandle = ::open(writeFilename.c_str(), O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); if(mOSFileHandle == -1) { @@ -116,7 +115,7 @@ #ifdef HAVE_FLOCK int errnoBlock = EWOULDBLOCK; if(::flock(mOSFileHandle, LOCK_EX | LOCK_NB) != 0) -#elif HAVE_DECL_F_SETLK +#else int errnoBlock = EAGAIN; struct flock desc; desc.l_type = F_WRLCK; @@ -124,9 +123,6 @@ desc.l_start = 0; desc.l_len = 0; if(::fcntl(mOSFileHandle, F_SETLK, &desc) != 0) -#else - int errnoBlock = ENOSYS; - if (0) #endif { // Lock was not obtained. @@ -246,46 +242,23 @@ } // Rename it into place -- BEFORE it's closed so lock remains - -#ifdef WIN32 - // Except on Win32 which doesn't allow renaming open files - // Close file... - if(::close(mOSFileHandle) != 0) - { - THROW_EXCEPTION(RaidFileException, OSError) - } - mOSFileHandle = -1; -#endif // WIN32 - RaidFileController &rcontroller(RaidFileController::GetController()); RaidFileDiscSet rdiscSet(rcontroller.GetDiscSet(mSetNumber)); // Get the filename for the write file std::string renameTo(RaidFileUtil::MakeWriteFileName(rdiscSet, mFilename)); // And the current name std::string renameFrom(renameTo + 'X'); - -#ifdef WIN32 - // need to delete the target first - if(::unlink(renameTo.c_str()) != 0 && - GetLastError() != ERROR_FILE_NOT_FOUND) - { - THROW_EXCEPTION(RaidFileException, OSError) - } -#endif - if(::rename(renameFrom.c_str(), renameTo.c_str()) != 0) { THROW_EXCEPTION(RaidFileException, OSError) } -#ifndef WIN32 // Close file... if(::close(mOSFileHandle) != 0) { THROW_EXCEPTION(RaidFileException, OSError) } mOSFileHandle = -1; -#endif // !WIN32 // Raid it? if(ConvertToRaidNow) @@ -319,15 +292,8 @@ writeFilename += 'X'; // Unlink and close it - -#ifdef WIN32 - // On Win32 we must close it first - if (::close(mOSFileHandle) != 0 || - ::unlink(writeFilename.c_str()) != 0) -#else // !WIN32 - if (::unlink(writeFilename.c_str()) != 0 || - ::close(mOSFileHandle) != 0) -#endif // !WIN32 + if((::unlink(writeFilename.c_str()) != 0) + || (::close(mOSFileHandle) != 0)) { THROW_EXCEPTION(RaidFileException, OSError) } @@ -422,13 +388,13 @@ try { #if HAVE_DECL_O_EXLOCK - FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK | O_BINARY)> stripe1(stripe1FilenameW.c_str()); - FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK | O_BINARY)> stripe2(stripe2FilenameW.c_str()); - FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK | O_BINARY)> parity(parityFilenameW.c_str()); + FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK)> stripe1(stripe1FilenameW.c_str()); + FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK)> stripe2(stripe2FilenameW.c_str()); + FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK)> parity(parityFilenameW.c_str()); #else - FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_BINARY)> stripe1(stripe1FilenameW.c_str()); - FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_BINARY)> stripe2(stripe2FilenameW.c_str()); - FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_BINARY)> parity(parityFilenameW.c_str()); + FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL)> stripe1(stripe1FilenameW.c_str()); + FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL)> stripe2(stripe2FilenameW.c_str()); + FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL)> parity(parityFilenameW.c_str()); #endif // Then... read in data... @@ -564,21 +530,6 @@ parity.Close(); stripe2.Close(); stripe1.Close(); - -#ifdef WIN32 - // Must delete before renaming - #define CHECK_UNLINK(file) \ - { \ - if (::unlink(file) != 0 && errno != ENOENT) \ - { \ - THROW_EXCEPTION(RaidFileException, OSError); \ - } \ - } - CHECK_UNLINK(stripe1Filename.c_str()); - CHECK_UNLINK(stripe2Filename.c_str()); - CHECK_UNLINK(parityFilename.c_str()); - #undef CHECK_UNLINK -#endif // Rename them into place if(::rename(stripe1FilenameW.c_str(), stripe1Filename.c_str()) != 0 From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:50:03 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:50:03 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.2d55353034cd961fca159b8d75f304e7@fluffy.co.uk> --===============1970517850== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODk2XSkgKHJl ZnMgIzMpDQoNCiBPcGVuIGZpbGVzIGluIGJpbmFyeSBtb2RlIChXaW4zMikNCg0KIERpc2FibGUg dGhlIGxvY2sgZmFpbHVyZSBibG9jayB3aGVuIHdlIGRvbid0IGhhdmUgYW55IGxvY2tpbmcgbWVj aGFuaXNtDQoNCiBDbG9zZSBhbmQgZGVsZXRlIGZpbGVzIGJlZm9yZSByZW5hbWluZyBvdmVyIHRo ZW0gb24gV2luMzIuIFRoaXMgYnJlYWtzDQogQmVuJ3MgZGVzaXJlZCByZWNvdmVyeSBzZW1hbnRp Y3MsIHNvIGl0J3Mgbm90IGRvbmUgb24gb3RoZXIgcGxhdGZvcm1zLA0KIGJ1dCBXaW4zMiByZXF1 aXJlcyBpdC4NCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90 cmFjL3RpY2tldC8zPg0KQm94IEJhY2t1cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFj a3VwLz4NCkFuIG9wZW4gc291cmNlLCBjb21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1 cCBzeXN0ZW0gZm9yIFVOSVgu --===============1970517850==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:50:02 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:50:02 +0100 Subject: [Box Backup-dev] COMMIT r896 - box/chris/merge/lib/raidfile Message-ID: Author: chris Date: 2006-08-31 23:50:02 +0100 (Thu, 31 Aug 2006) New Revision: 896 Modified: box/chris/merge/lib/raidfile/RaidFileWrite.cpp Log: (refs #3) Open files in binary mode (Win32) Disable the lock failure block when we don't have any locking mechanism Close and delete files before renaming over them on Win32. This breaks Ben's desired recovery semantics, so it's not done on other platforms, but Win32 requires it. Modified: box/chris/merge/lib/raidfile/RaidFileWrite.cpp =================================================================== --- box/chris/merge/lib/raidfile/RaidFileWrite.cpp 2006-08-31 22:44:18 UTC (rev 895) +++ box/chris/merge/lib/raidfile/RaidFileWrite.cpp 2006-08-31 22:50:02 UTC (rev 896) @@ -104,7 +104,8 @@ writeFilename += 'X'; // Attempt to open - mOSFileHandle = ::open(writeFilename.c_str(), O_WRONLY | O_CREAT, + mOSFileHandle = ::open(writeFilename.c_str(), + O_WRONLY | O_CREAT | O_BINARY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); if(mOSFileHandle == -1) { @@ -115,7 +116,7 @@ #ifdef HAVE_FLOCK int errnoBlock = EWOULDBLOCK; if(::flock(mOSFileHandle, LOCK_EX | LOCK_NB) != 0) -#else +#elif HAVE_DECL_F_SETLK int errnoBlock = EAGAIN; struct flock desc; desc.l_type = F_WRLCK; @@ -123,6 +124,9 @@ desc.l_start = 0; desc.l_len = 0; if(::fcntl(mOSFileHandle, F_SETLK, &desc) != 0) +#else + int errnoBlock = ENOSYS; + if (0) #endif { // Lock was not obtained. @@ -242,23 +246,46 @@ } // Rename it into place -- BEFORE it's closed so lock remains + +#ifdef WIN32 + // Except on Win32 which doesn't allow renaming open files + // Close file... + if(::close(mOSFileHandle) != 0) + { + THROW_EXCEPTION(RaidFileException, OSError) + } + mOSFileHandle = -1; +#endif // WIN32 + RaidFileController &rcontroller(RaidFileController::GetController()); RaidFileDiscSet rdiscSet(rcontroller.GetDiscSet(mSetNumber)); // Get the filename for the write file std::string renameTo(RaidFileUtil::MakeWriteFileName(rdiscSet, mFilename)); // And the current name std::string renameFrom(renameTo + 'X'); + +#ifdef WIN32 + // need to delete the target first + if(::unlink(renameTo.c_str()) != 0 && + GetLastError() != ERROR_FILE_NOT_FOUND) + { + THROW_EXCEPTION(RaidFileException, OSError) + } +#endif + if(::rename(renameFrom.c_str(), renameTo.c_str()) != 0) { THROW_EXCEPTION(RaidFileException, OSError) } +#ifndef WIN32 // Close file... if(::close(mOSFileHandle) != 0) { THROW_EXCEPTION(RaidFileException, OSError) } mOSFileHandle = -1; +#endif // !WIN32 // Raid it? if(ConvertToRaidNow) @@ -292,8 +319,15 @@ writeFilename += 'X'; // Unlink and close it - if((::unlink(writeFilename.c_str()) != 0) - || (::close(mOSFileHandle) != 0)) + +#ifdef WIN32 + // On Win32 we must close it first + if (::close(mOSFileHandle) != 0 || + ::unlink(writeFilename.c_str()) != 0) +#else // !WIN32 + if (::unlink(writeFilename.c_str()) != 0 || + ::close(mOSFileHandle) != 0) +#endif // !WIN32 { THROW_EXCEPTION(RaidFileException, OSError) } @@ -388,13 +422,13 @@ try { #if HAVE_DECL_O_EXLOCK - FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK)> stripe1(stripe1FilenameW.c_str()); - FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK)> stripe2(stripe2FilenameW.c_str()); - FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK)> parity(parityFilenameW.c_str()); + FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK | O_BINARY)> stripe1(stripe1FilenameW.c_str()); + FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK | O_BINARY)> stripe2(stripe2FilenameW.c_str()); + FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK | O_BINARY)> parity(parityFilenameW.c_str()); #else - FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL)> stripe1(stripe1FilenameW.c_str()); - FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL)> stripe2(stripe2FilenameW.c_str()); - FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL)> parity(parityFilenameW.c_str()); + FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_BINARY)> stripe1(stripe1FilenameW.c_str()); + FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_BINARY)> stripe2(stripe2FilenameW.c_str()); + FileHandleGuard<(O_WRONLY | O_CREAT | O_EXCL | O_BINARY)> parity(parityFilenameW.c_str()); #endif // Then... read in data... @@ -530,6 +564,22 @@ parity.Close(); stripe2.Close(); stripe1.Close(); + +#ifdef WIN32 + // Must delete before renaming + if (::unlink(stripe1Filename.c_str()) != 0 && errno != ENOENT) + { + THROW_EXCEPTION(RaidFileException, OSError); + } + if (::unlink(stripe2Filename.c_str()) != 0 && errno != ENOENT) + { + THROW_EXCEPTION(RaidFileException, OSError); + } + if (::unlink(parityFilename.c_str()) != 0 && errno != ENOENT) + { + THROW_EXCEPTION(RaidFileException, OSError); + } +#endif // Rename them into place if(::rename(stripe1FilenameW.c_str(), stripe1Filename.c_str()) != 0 From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:51:29 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:51:29 +0100 Subject: [Box Backup-dev] COMMIT r897 - box/chris/merge/lib/server Message-ID: Author: chris Date: 2006-08-31 23:51:29 +0100 (Thu, 31 Aug 2006) New Revision: 897 Modified: box/chris/merge/lib/server/Daemon.cpp Log: Revert to trunk Modified: box/chris/merge/lib/server/Daemon.cpp =================================================================== --- box/chris/merge/lib/server/Daemon.cpp 2006-08-31 22:50:02 UTC (rev 896) +++ box/chris/merge/lib/server/Daemon.cpp 2006-08-31 22:51:29 UTC (rev 897) @@ -23,10 +23,6 @@ #include #endif -#ifdef WIN32 - #include -#endif - #include "Daemon.h" #include "Configuration.h" #include "ServerException.h" @@ -146,7 +142,7 @@ { fprintf(stderr, "%s: failed to start: " "failed to open configuration file: " - "%s\n", DaemonName(), + "%s", DaemonName(), mConfigFileName.c_str()); #ifdef WIN32 ::syslog(LOG_ERR, "%s: failed to start: " @@ -193,7 +189,6 @@ { THROW_EXCEPTION(ServerException, DaemoniseFailed) } -#endif // !WIN32 // Server configuration const Configuration &serverConfig( @@ -202,8 +197,7 @@ // Open PID file for writing pidFileName = serverConfig.GetKeyValue("PidFile"); FileHandleGuard<(O_WRONLY | O_CREAT | O_TRUNC), (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)> pidFile(pidFileName.c_str()); - -#ifndef WIN32 + // Handle changing to a different user if(serverConfig.KeyExists("User")) { @@ -273,25 +267,20 @@ // open the log ::openlog(DaemonName(), LOG_PID, LOG_LOCAL6); - // Log the start message ::syslog(LOG_INFO, "Starting daemon (config: %s) (version " BOX_VERSION ")", mConfigFileName.c_str()); +#ifndef WIN32 // Write PID to file char pid[32]; - -#ifdef WIN32 - int pidsize = sprintf(pid, "%d", (int)GetCurrentProcessId()); -#else int pidsize = sprintf(pid, "%d", (int)getpid()); -#endif - if(::write(pidFile, pid, pidsize) != pidsize) { ::syslog(LOG_ERR, "can't write pid file"); THROW_EXCEPTION(ServerException, DaemoniseFailed) } +#endif // Set up memory leak reporting #ifdef BOX_MEMORY_LEAK_TESTING @@ -363,22 +352,6 @@ #endif return 1; } - -#ifdef WIN32 - // Under win32 we must initialise the Winsock library - // before using sockets - - WSADATA info; - - if (WSAStartup(0x0101, &info) == SOCKET_ERROR) - { - // will not run without sockets - ::syslog(LOG_ERR, "Failed to initialise Windows Sockets"); - THROW_EXCEPTION(CommonException, Internal) - } -#endif - - int retcode = 0; // Main Daemon running try @@ -408,8 +381,7 @@ mConfigFileName.c_str(), errors.c_str()); // And give up - retcode = 1; - break; + return 1; } // delete old configuration @@ -437,26 +409,22 @@ ::syslog(LOG_ERR, "%s: terminating due to exception %s " "(%d/%d)", DaemonName(), e.what(), e.GetType(), e.GetSubType()); - retcode = 1; + return 1; } catch(std::exception &e) { ::syslog(LOG_ERR, "%s: terminating due to exception %s", DaemonName(), e.what()); - retcode = 1; + return 1; } catch(...) { ::syslog(LOG_ERR, "%s: terminating due to unknown exception", DaemonName()); - retcode = 1; + return 1; } - -#ifdef WIN32 - WSACleanup(); -#endif - return retcode; + return 0; } // -------------------------------------------------------------------------- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:51:32 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:51:32 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.ad2aba2b816f16f0ea978fc6aa85c550@fluffy.co.uk> --===============2038480078== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IG1hcnRpbik6DQoNCiBPayB0byBtZXJnZTog Wzg2MF0gWzg2M10gWzg4MV0NCg0KIFs4NjFdIGlzIG9rIGV4Y2VwdCBmb3IgdGhlIHVubmVjZXNz YXJ5IGNhbGwgdG8gQ2xvc2UgYXMgbWFpbGVkLg0KDQogWzg2Ml0gaXMgb2sgYnV0IG5vdyB0aGUg ZmlsZSBpcyBiZWluZyBkZWxldGVkIHR3aWNlIChvbmNlIGluc2lkZSB0aGUNCiB0cnkvY2F0Y2gg YmxvY2sgYW5kIG9uY2UgYWZ0ZXIpLiBTaG91bGQgcmVtb3ZlIHRoZSBvbmUgb3V0c2lkZSB0aGUN CiB0cnkvY2F0Y2guDQoNCiBTdGlsbCBvdXRzdGFuZGluZzogWzg0MF0NCg0KLS0gDQpUaWNrZXQg VVJMOiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL3RpY2tldC8zPg0KQm94IEJhY2t1 cCA8aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3VwLz4NCkFuIG9wZW4gc291cmNlLCBj b21wbGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBzeXN0ZW0gZm9yIFVOSVgu --===============2038480078==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:55:35 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:55:35 +0100 Subject: [Box Backup-dev] COMMIT r898 - box/chris/merge/lib/server Message-ID: Author: chris Date: 2006-08-31 23:55:35 +0100 (Thu, 31 Aug 2006) New Revision: 898 Modified: box/chris/merge/lib/server/Daemon.cpp Log: (refs #3) Initialise Windows sockets automatically for all daemons on Win32 Write PID files on Win32 Modified: box/chris/merge/lib/server/Daemon.cpp =================================================================== --- box/chris/merge/lib/server/Daemon.cpp 2006-08-31 22:51:29 UTC (rev 897) +++ box/chris/merge/lib/server/Daemon.cpp 2006-08-31 22:55:35 UTC (rev 898) @@ -23,6 +23,10 @@ #include #endif +#ifdef WIN32 + #include +#endif + #include "Daemon.h" #include "Configuration.h" #include "ServerException.h" @@ -142,7 +146,7 @@ { fprintf(stderr, "%s: failed to start: " "failed to open configuration file: " - "%s", DaemonName(), + "%s\n", DaemonName(), mConfigFileName.c_str()); #ifdef WIN32 ::syslog(LOG_ERR, "%s: failed to start: " @@ -189,6 +193,7 @@ { THROW_EXCEPTION(ServerException, DaemoniseFailed) } +#endif // !WIN32 // Server configuration const Configuration &serverConfig( @@ -197,7 +202,8 @@ // Open PID file for writing pidFileName = serverConfig.GetKeyValue("PidFile"); FileHandleGuard<(O_WRONLY | O_CREAT | O_TRUNC), (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)> pidFile(pidFileName.c_str()); - + +#ifndef WIN32 // Handle changing to a different user if(serverConfig.KeyExists("User")) { @@ -267,20 +273,25 @@ // open the log ::openlog(DaemonName(), LOG_PID, LOG_LOCAL6); + // Log the start message ::syslog(LOG_INFO, "Starting daemon (config: %s) (version " BOX_VERSION ")", mConfigFileName.c_str()); -#ifndef WIN32 // Write PID to file char pid[32]; + +#ifdef WIN32 + int pidsize = sprintf(pid, "%d", (int)GetCurrentProcessId()); +#else int pidsize = sprintf(pid, "%d", (int)getpid()); +#endif + if(::write(pidFile, pid, pidsize) != pidsize) { ::syslog(LOG_ERR, "can't write pid file"); THROW_EXCEPTION(ServerException, DaemoniseFailed) } -#endif // Set up memory leak reporting #ifdef BOX_MEMORY_LEAK_TESTING @@ -352,6 +363,22 @@ #endif return 1; } + +#ifdef WIN32 + // Under win32 we must initialise the Winsock library + // before using sockets + + WSADATA info; + + if (WSAStartup(0x0101, &info) == SOCKET_ERROR) + { + // will not run without sockets + ::syslog(LOG_ERR, "Failed to initialise Windows Sockets"); + THROW_EXCEPTION(CommonException, Internal) + } +#endif + + int retcode = 0; // Main Daemon running try @@ -381,7 +408,8 @@ mConfigFileName.c_str(), errors.c_str()); // And give up - return 1; + retcode = 1; + break; } // delete old configuration @@ -409,22 +437,26 @@ ::syslog(LOG_ERR, "%s: terminating due to exception %s " "(%d/%d)", DaemonName(), e.what(), e.GetType(), e.GetSubType()); - return 1; + retcode = 1; } catch(std::exception &e) { ::syslog(LOG_ERR, "%s: terminating due to exception %s", DaemonName(), e.what()); - return 1; + retcode = 1; } catch(...) { ::syslog(LOG_ERR, "%s: terminating due to unknown exception", DaemonName()); - return 1; + retcode = 1; } + +#ifdef WIN32 + WSACleanup(); +#endif - return 0; + return retcode; } // -------------------------------------------------------------------------- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:56:11 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:56:11 +0100 Subject: [Box Backup-dev] COMMIT r899 - box/chris/merge/lib/server Message-ID: Author: chris Date: 2006-08-31 23:56:11 +0100 (Thu, 31 Aug 2006) New Revision: 899 Modified: box/chris/merge/lib/server/makeprotocol.pl.in Log: Revert to trunk Modified: box/chris/merge/lib/server/makeprotocol.pl.in =================================================================== --- box/chris/merge/lib/server/makeprotocol.pl.in 2006-08-31 22:55:35 UTC (rev 898) +++ box/chris/merge/lib/server/makeprotocol.pl.in 2006-08-31 22:56:11 UTC (rev 899) @@ -1,9 +1,6 @@ #!@PERL@ use strict; -use lib "../../infrastructure"; -use BoxPlatform; - # Make protocol C++ classes from a protocol description file # built in type info (values are is basic type, C++ typename) @@ -170,8 +167,8 @@ # open files my $h_filename = 'autogen_'.$protocol_name.'Protocol'.$type.'.h'; -open CPP,'>autogen_'.$protocol_name.'Protocol'.$type.'.cpp.new'; -open H,">$h_filename.new"; +open CPP,'>autogen_'.$protocol_name.'Protocol'.$type.'.cpp'; +open H,">$h_filename"; print CPP <<__E; @@ -915,8 +912,6 @@ close H; close CPP; -update_if_changed('autogen_'.$protocol_name.'Protocol'.$type.'.cpp'); -update_if_changed($h_filename); sub obj_is_type { @@ -986,15 +981,8 @@ { # need to translate it my ($format,$arg) = @{$log_display_types{$ty}}; - $arg =~ s/VAR/m$nm/g; - - if ($format eq "0x%llx" and $target_windows) - { - $format = "0x%I64x"; - $arg = "(uint64_t)$arg"; - } - push @str,$format; + $arg =~ s/VAR/m$nm/g; push @arg,$arg; } else From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:55:36 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:55:36 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.0ec871bf060be979ca5101d344939c35@fluffy.co.uk> --===============1189557404== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbODk4XSkgKHJl ZnMgIzMpDQoNCiBJbml0aWFsaXNlIFdpbmRvd3Mgc29ja2V0cyBhdXRvbWF0aWNhbGx5IGZvciBh bGwgZGFlbW9ucyBvbiBXaW4zMg0KDQogV3JpdGUgUElEIGZpbGVzIG9uIFdpbjMyDQoNCi0tIA0K VGlja2V0IFVSTDogPGh0dHA6Ly9iYmRldi5mbHVmZnkuY28udWsvdHJhYy90aWNrZXQvMz4NCkJv eCBCYWNrdXAgPGh0dHA6Ly93d3cuZmx1ZmZ5LmNvLnVrL2JveGJhY2t1cC8+DQpBbiBvcGVuIHNv dXJjZSwgY29tcGxldGVseSBhdXRvbWF0aWMgb24tbGluZSBiYWNrdXAgc3lzdGVtIGZvciBVTklY Lg== --===============1189557404==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:52:58 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 31 Aug 2006 23:52:58 +0100 Subject: [Box Backup-dev] commit list anyone? Message-ID: <1157064778.26754.12.camel@avenin.ebourne.me.uk> Given the amount of autogenerated traffic now hitting the -dev list I wonder if it's time for a -commit list for all trac/svn traffic? That way interested people could monitor the -dev list without being spammed. Presumably the main developers would keep both though. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:57:36 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:57:36 +0100 Subject: [Box Backup-dev] COMMIT r900 - box/chris/merge/lib/server Message-ID: Author: chris Date: 2006-08-31 23:57:36 +0100 (Thu, 31 Aug 2006) New Revision: 900 Modified: box/chris/merge/lib/server/makeprotocol.pl.in Log: (refs #3) 64-bit format fixes (Win32) Modified: box/chris/merge/lib/server/makeprotocol.pl.in =================================================================== --- box/chris/merge/lib/server/makeprotocol.pl.in 2006-08-31 22:56:11 UTC (rev 899) +++ box/chris/merge/lib/server/makeprotocol.pl.in 2006-08-31 22:57:36 UTC (rev 900) @@ -912,7 +912,6 @@ close H; close CPP; - sub obj_is_type { my ($c,$ty) = @_; @@ -981,8 +980,15 @@ { # need to translate it my ($format,$arg) = @{$log_display_types{$ty}}; + $arg =~ s/VAR/m$nm/g; + + if ($format eq "0x%llx" and $target_windows) + { + $format = "0x%I64x"; + $arg = "(uint64_t)$arg"; + } + push @str,$format; - $arg =~ s/VAR/m$nm/g; push @arg,$arg; } else From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:58:30 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 23:58:30 +0100 Subject: [Box Backup-dev] COMMIT r901 - box/chris/merge/lib/server Message-ID: Author: chris Date: 2006-08-31 23:58:30 +0100 (Thu, 31 Aug 2006) New Revision: 901 Modified: box/chris/merge/lib/server/ServerStream.h Log: Revert to trunk Modified: box/chris/merge/lib/server/ServerStream.h =================================================================== --- box/chris/merge/lib/server/ServerStream.h 2006-08-31 22:57:36 UTC (rev 900) +++ box/chris/merge/lib/server/ServerStream.h 2006-08-31 22:58:30 UTC (rev 901) @@ -56,10 +56,6 @@ return "generic-stream-server"; } - #ifdef WIN32 - virtual void OnIdle() { } - #endif - virtual void Run() { // Set process title as appropraite @@ -219,7 +215,6 @@ if(connection.get()) { // Since this is a template parameter, the if() will be optimised out by the compiler - #ifndef WIN32 // no fork on Win32 if(ForkToHandleRequests) { pid_t pid = ::fork(); @@ -260,20 +255,14 @@ } else { - #endif // !WIN32 // Just handle in this connection SetProcessTitle("handling"); HandleConnection(*connection); SetProcessTitle("idle"); - #ifndef WIN32 } - #endif // !WIN32 } } - - #ifdef WIN32 - OnIdle(); - #else // !WIN32 + // Clean up child processes (if forking daemon) if(ForkToHandleRequests) { @@ -288,7 +277,6 @@ } } while(p > 0); } - #endif // !WIN32 } } catch(...) @@ -313,11 +301,7 @@ // depends on the forking model in case someone changes it later. bool WillForkToHandleRequests() { - #ifdef WIN32 - return false; - #else return ForkToHandleRequests; - #endif // WIN32 } private: From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:57:37 2006 From: boxbackup-dev at fluffy.co.uk (boxbackup-dev at fluffy.co.uk) Date: Thu, 31 Aug 2006 22:57:37 -0000 Subject: [Box Backup-dev] =?utf-8?q?Re=3A_=233=3A_Merge_Win32_branch?= In-Reply-To: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> References: <072.67cfd2e8543d09f0771fff956d24d898@fluffy.co.uk> Message-ID: <081.bfb43d10c569c573a56bb64700edcdc8@fluffy.co.uk> --===============0581697160== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 IzM6IE1lcmdlIFdpbjMyIGJyYW5jaA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBSZXBvcnRlcjog IGNocmlzICAgICB8ICAgICAgIE93bmVyOiAgY2hyaXMgICAgICAgICAgICAgDQogICAgICBUeXBl OiAgdGFzayAgICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICAgICAgICAgICAgICANCiAgUHJpb3Jp dHk6ICBub3JtYWwgICAgfCAgIE1pbGVzdG9uZTogIDAuMTEgICAgICAgICAgICAgIA0KIENvbXBv bmVudDogIGJiYWNrdXBkICB8ICAgICBWZXJzaW9uOiAgdHJ1bmsgICAgICAgICAgICAgDQpSZXNv bHV0aW9uOiAgICAgICAgICAgIHwgICAgS2V5d29yZHM6ICB3aW4zMiBtZXJnZSBicmFuY2gNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IGNocmlzKToNCg0KIChJbiBbOTAwXSkgKHJl ZnMgIzMpDQoNCiA2NC1iaXQgZm9ybWF0IGZpeGVzIChXaW4zMikNCg0KLS0gDQpUaWNrZXQgVVJM OiA8aHR0cDovL2JiZGV2LmZsdWZmeS5jby51ay90cmFjL3RpY2tldC8zPg0KQm94IEJhY2t1cCA8 aHR0cDovL3d3dy5mbHVmZnkuY28udWsvYm94YmFja3VwLz4NCkFuIG9wZW4gc291cmNlLCBjb21w bGV0ZWx5IGF1dG9tYXRpYyBvbi1saW5lIGJhY2t1cCBzeXN0ZW0gZm9yIFVOSVgu --===============0581697160==-- From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:59:27 2006 From: boxbackup-dev at fluffy.co.uk (Martin Ebourne) Date: Thu, 31 Aug 2006 23:59:27 +0100 Subject: [Box Backup-dev] changeset [819] In-Reply-To: References: <1156975704.2413.1.camel@avenin.ebourne.me.uk> <20060831102459.fvnuefdw0848gscc@ebourne.me.uk> <1D3961A7-0885-41CC-9F73-273CE2BB3AFA@fluffy.co.uk> <20060831134917.d3rpxireaskksgwc@ebourne.me.uk> Message-ID: <1157065167.26754.16.camel@avenin.ebourne.me.uk> On Thu, 2006-08-31 at 20:51 +0100, Chris Wilson wrote: > There is a possible clean solution, which is to use the Windows flag > FILE_FLAG_DELETE_ON_CLOSE when opening the file. To avoid the #ifdef, I > think I would have to invent a new flag to pass to the FileStream > constructor, which does nothing (define to zero) on other platforms, but > activates this Windows flag in openfile() on Win32. > > Does this seem like a sensible solution? And what should that flag be > called? O_DELETE_ON_CLOSE_WIN32? How about FileStream handling this platform specific stuff. All you need to do is tell FileStream when you construct it (use an overloaded constructor or give an extra bool parameter to the constructor) that you want the file automatically deleted. On windows it would then pass FILE_FLAG_DELETE_ON_CLOSE and on unix it would unlink it after opening it. Does that cover all possibilities? If so it would certainly tidy up a lot of code around the place that is closing and deleting files. Cheers, Martin. From boxbackup-dev at fluffy.co.uk Thu Aug 31 23:59:56 2006 From: boxbackup-dev at fluffy.co.uk (Chris Wilson) Date: Thu, 31 Aug 2006 23:59:56 +0100 (BST) Subject: [Box Backup-dev] commit list anyone? In-Reply-To: <1157064778.26754.12.camel@avenin.ebourne.me.uk> References: <1157064778.26754.12.camel@avenin.ebourne.me.uk> Message-ID: Hi Martin, On Thu, 31 Aug 2006, Martin Ebourne wrote: > Given the amount of autogenerated traffic now hitting the -dev list I > wonder if it's time for a -commit list for all trac/svn traffic? That > way interested people could monitor the -dev list without being spammed. > Presumably the main developers would keep both though. Fine by me, sorry for spamming everyone, and yes I would like to be on that list. Cheers, Chris. -- _ ___ __ _ / __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK | / (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer | \ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |