From subversion at boxbackup.org Fri Jan 2 19:18:03 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 2 Jan 2015 19:18:03 GMT Subject: [Box Backup-commit] COMMIT r3508 - box/trunk/lib/common Message-ID: <201501021918.t02JI3SK015414@wm.boxbackup.org> Author: chris Date: 2015-01-02 19:18:03 +0000 (Fri, 02 Jan 2015) New Revision: 3508 Modified: box/trunk/lib/common/DebugMemLeakFinder.cpp Log: Write memory leak report files to current working directory saved at startup. Fixes tests broken by changing current directory, for example in bbackupquery, which meant that the report file was written in the wrong place and couldn't be found by the test, causing a failure. Modified: box/trunk/lib/common/DebugMemLeakFinder.cpp =================================================================== --- box/trunk/lib/common/DebugMemLeakFinder.cpp 2015-01-02 19:17:58 UTC (rev 3507) +++ box/trunk/lib/common/DebugMemLeakFinder.cpp 2015-01-02 19:18:03 UTC (rev 3508) @@ -589,7 +589,11 @@ void memleakfinder_setup_exit_report(const std::string& filename, const char *markertext) { - ::strncpy(atexit_filename, filename.c_str(), sizeof(atexit_filename)-1); + char buffer[PATH_MAX]; + std::string abs_filename = std::string(getcwd(buffer, sizeof(buffer))) + + DIRECTORY_SEPARATOR + filename; + ::strncpy(atexit_filename, abs_filename.c_str(), + sizeof(atexit_filename)-1); ::strncpy(atexit_markertext, markertext, sizeof(atexit_markertext)-1); atexit_filename[sizeof(atexit_filename)-1] = 0; atexit_markertext[sizeof(atexit_markertext)-1] = 0; From subversion at boxbackup.org Fri Jan 2 19:18:06 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 2 Jan 2015 19:18:06 GMT Subject: [Box Backup-commit] COMMIT r3509 - box/trunk/lib/common Message-ID: <201501021918.t02JI6Xu015430@wm.boxbackup.org> Author: chris Date: 2015-01-02 19:18:06 +0000 (Fri, 02 Jan 2015) New Revision: 3509 Modified: box/trunk/lib/common/FileStream.cpp Log: Fix error logging when file open fails on Windows. We need to use the saved Windows error code from GetLastError(), rather than calling it again, because another system call has run in the mean time and GetLastError() will now return 0. Modified: box/trunk/lib/common/FileStream.cpp =================================================================== --- box/trunk/lib/common/FileStream.cpp 2015-01-02 19:18:03 UTC (rev 3508) +++ box/trunk/lib/common/FileStream.cpp 2015-01-02 19:18:06 UTC (rev 3509) @@ -70,13 +70,13 @@ #ifdef WIN32 if(errno == EACCES) { - THROW_WIN_FILE_ERROR("Failed to open file", mFileName, - CommonException, AccessDenied); + THROW_WIN_FILE_ERRNO("Failed to open file", mFileName, + winerrno, CommonException, AccessDenied); } else { - THROW_WIN_FILE_ERROR("Failed to open file", mFileName, - CommonException, OSFileOpenError); + THROW_WIN_FILE_ERRNO("Failed to open file", mFileName, + winerrno, CommonException, OSFileOpenError); } #else if(errno == EACCES) From subversion at boxbackup.org Fri Jan 2 19:17:59 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 2 Jan 2015 19:17:59 GMT Subject: [Box Backup-commit] COMMIT r3507 - box/trunk/bin/bbackupd Message-ID: <201501021917.t02JHxn1015397@wm.boxbackup.org> Author: chris Date: 2015-01-02 19:17:58 +0000 (Fri, 02 Jan 2015) New Revision: 3507 Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp Log: Improve internal debug logging Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.cpp 2014-12-28 22:03:37 UTC (rev 3506) +++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2015-01-02 19:17:58 UTC (rev 3507) @@ -3075,10 +3075,9 @@ if(Event < 0 || Event >= SysadminNotifier::MAX) { - BOX_ERROR("BackupDaemon::NotifySysadmin() called for " - "invalid event code " << Event); - THROW_EXCEPTION(BackupStoreException, - BadNotifySysadminEventCode); + THROW_EXCEPTION_MESSAGE(BackupStoreException, + BadNotifySysadminEventCode, "NotifySysadmin() called " + "for unknown event code " << Event); } BOX_TRACE("BackupDaemon::NotifySysadmin() called, event = " << From subversion at boxbackup.org Fri Jan 2 19:18:09 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 2 Jan 2015 19:18:09 GMT Subject: [Box Backup-commit] COMMIT r3510 - box/trunk/lib/win32 Message-ID: <201501021918.t02JI9tj015446@wm.boxbackup.org> Author: chris Date: 2015-01-02 19:18:09 +0000 (Fri, 02 Jan 2015) New Revision: 3510 Modified: box/trunk/lib/win32/emu.cpp Log: Remove unused variable Modified: box/trunk/lib/win32/emu.cpp =================================================================== --- box/trunk/lib/win32/emu.cpp 2015-01-02 19:18:06 UTC (rev 3509) +++ box/trunk/lib/win32/emu.cpp 2015-01-02 19:18:09 UTC (rev 3510) @@ -1078,7 +1078,6 @@ } pDir->fd = FindFirstFileW(pDir->name, &pDir->info); - DWORD tmp = GetLastError(); if (pDir->fd == INVALID_HANDLE_VALUE) { From subversion at boxbackup.org Fri Jan 2 19:18:12 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 2 Jan 2015 19:18:12 GMT Subject: [Box Backup-commit] COMMIT r3511 - box/trunk/lib/win32 Message-ID: <201501021918.t02JIC8H015462@wm.boxbackup.org> Author: chris Date: 2015-01-02 19:18:12 +0000 (Fri, 02 Jan 2015) New Revision: 3511 Modified: box/trunk/lib/win32/emu.cpp Log: Fix random timezone errors on restore. Work in UTC inside Box Backup, not local time. Modified: box/trunk/lib/win32/emu.cpp =================================================================== --- box/trunk/lib/win32/emu.cpp 2015-01-02 19:18:09 UTC (rev 3510) +++ box/trunk/lib/win32/emu.cpp 2015-01-02 19:18:12 UTC (rev 3511) @@ -1863,7 +1863,7 @@ return bytes; } -// need this for conversions +// Need this for conversions. Works in UTC. time_t ConvertFileTimeToTime_t(FILETIME *fileTime) { SYSTEMTIME stUTC; @@ -1882,18 +1882,17 @@ // timeinfo.tm_yday = ...; timeinfo.tm_year = stUTC.wYear - 1900; - time_t retVal = mktime(&timeinfo) - _timezone; + time_t retVal = _mkgmtime(&timeinfo); return retVal; } bool ConvertTime_tToFileTime(const time_t from, FILETIME *pTo) { - time_t adjusted = from + _timezone; - struct tm *time_breakdown = gmtime(&adjusted); + struct tm *time_breakdown = gmtime(&from); if (time_breakdown == NULL) { ::syslog(LOG_ERR, "Error: failed to convert time format: " - "%d is not a valid time\n", adjusted); + "%d is not a valid time\n", from); return false; } From subversion at boxbackup.org Fri Jan 2 19:18:16 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 2 Jan 2015 19:18:16 GMT Subject: [Box Backup-commit] COMMIT r3512 - box/trunk/test/bbackupd Message-ID: <201501021918.t02JIG1v015478@wm.boxbackup.org> Author: chris Date: 2015-01-02 19:18:16 +0000 (Fri, 02 Jan 2015) New Revision: 3512 Modified: box/trunk/test/bbackupd/testbbackupd.cpp Log: Fix test to handle console encoding already in UTF-8. Modified: box/trunk/test/bbackupd/testbbackupd.cpp =================================================================== --- box/trunk/test/bbackupd/testbbackupd.cpp 2015-01-02 19:18:12 UTC (rev 3511) +++ box/trunk/test/bbackupd/testbbackupd.cpp 2015-01-02 19:18:16 UTC (rev 3512) @@ -2477,7 +2477,10 @@ // We have no guarantee that a random Unicode string can be // represented in the user's character set, so we go the // other way, taking three random characters from the - // character set and converting them to Unicode. + // character set and converting them to Unicode. Unless the + // console codepage is CP_UTF8, in which case our random + // characters are not valid, so we use the UTF8 version + // of them instead. // // We hope that these characters are valid in most // character sets, but they probably are not in multibyte @@ -2497,7 +2500,8 @@ // accented characters, which are supported in code page // 850. Depending on your locale, YYMV (your yak may vomit). - std::string foreignCharsNative("\x91\x9b\x86"); + std::string foreignCharsNative = (GetConsoleCP() == CP_UTF8) + ? "\xc3\xa6\xc3\xb8\xc3\xa5" : "\x91\x9b\x86"; std::string foreignCharsUnicode; TEST_THAT(ConvertConsoleToUtf8(foreignCharsNative.c_str(), foreignCharsUnicode)); From subversion at boxbackup.org Fri Jan 2 19:18:19 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 2 Jan 2015 19:18:19 GMT Subject: [Box Backup-commit] COMMIT r3513 - box/trunk/test/bbackupd Message-ID: <201501021918.t02JIJP3015494@wm.boxbackup.org> Author: chris Date: 2015-01-02 19:18:19 +0000 (Fri, 02 Jan 2015) New Revision: 3513 Modified: box/trunk/test/bbackupd/testbbackupd.cpp Log: Fix more minor test breaks on Windows Modified: box/trunk/test/bbackupd/testbbackupd.cpp =================================================================== --- box/trunk/test/bbackupd/testbbackupd.cpp 2015-01-02 19:18:16 UTC (rev 3512) +++ box/trunk/test/bbackupd/testbbackupd.cpp 2015-01-02 19:18:19 UTC (rev 3513) @@ -2436,8 +2436,7 @@ // directory. TEST_THAT(::mkdir("testfiles/restore-test", 0700) == 0); TEST_THAT(bbackupquery("\"lcd testfiles/restore-test\" " - "\"restore Test1\"", - "testfiles/restore-test/bbackupquery.memleaks")); + "\"restore Test1\"")); TEST_COMPARE(Compare_Same, "", "-cEQ Test1 " "testfiles/restore-test/Test1"); @@ -2561,6 +2560,11 @@ TEST_EQUAL_LINE(12, fs.GetPosition(), "FileStream position"); fs.Close(); + + // Set modtime back in time to allow immediate backup + struct timeval times[2] = {}; + times[1].tv_sec = 1000000000; + TEST_THAT(emu_utimes(filepath.c_str(), times) == 0); } bbackupd.RunSyncNow(); @@ -2681,16 +2685,12 @@ "\"cd Test1/" + systemDirName + "\" " + "\"get " + systemFileName + "\"")); - // Compare to make sure it was restored properly. - // The Get command does not restore attributes, so - // we must compare without them (-A) to succeed. - TEST_COMPARE(Compare_Same, "", "-cAEQ Test1/" + systemDirName + + // Compare to make sure it was restored properly. The Get + // command does restore attributes, so we don't need to + // specify the -A option for this to succeed. + TEST_COMPARE(Compare_Same, "", "-cEQ Test1/" + systemDirName + " testfiles/restore-" + systemDirName); - // Compare without attributes. This should fail. - TEST_COMPARE(Compare_Different, "", "-cEQ Test1/" + systemDirName + - " testfiles/restore-" + systemDirName); - // Check that no read error has been reported yet TEST_THAT(!TestFileExists("testfiles/notifyran.read-error.1")); } @@ -3642,12 +3642,13 @@ // requires openfile(), GetFileTime() and attrib.exe #else bbackupd.RunSyncNow(); + TEST_COMPARE(Compare_Same); // TODO FIXME dedent { // make one of the files read-only, expect a compare failure int exit_status = ::system("attrib +r " - "testfiles\\restore-Test1\\f1.dat"); + "testfiles\\TestDir1\\f1.dat"); TEST_RETURN(exit_status, 0); TEST_COMPARE(Compare_Different); @@ -3654,13 +3655,13 @@ // set it back, expect no failures exit_status = ::system("attrib -r " - "testfiles\\restore-Test1\\f1.dat"); + "testfiles\\TestDir1\\f1.dat"); TEST_RETURN(exit_status, 0); TEST_COMPARE(Compare_Same); // change the timestamp on a file, expect a compare failure - const char* testfile = "testfiles\\restore-Test1\\f1.dat"; + const char* testfile = "testfiles\\TestDir1\\f1.dat"; HANDLE handle = openfile(testfile, O_RDWR, 0); TEST_THAT(handle != INVALID_HANDLE_VALUE); @@ -4072,7 +4073,7 @@ { // this sync should try to back up the file, // and fail, because it's locked - bbackupd.RunSyncNow(); + bbackupd.RunSyncNowWithExceptionHandling(); TEST_THAT(TestFileExists("testfiles/" "notifyran.read-error.1")); TEST_THAT(!TestFileExists("testfiles/" From subversion at boxbackup.org Fri Jan 2 20:13:33 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 2 Jan 2015 20:13:33 GMT Subject: [Box Backup-commit] COMMIT r3514 - box/trunk/test/bbackupd Message-ID: <201501022013.t02KDXjl015775@wm.boxbackup.org> Author: chris Date: 2015-01-02 20:13:33 +0000 (Fri, 02 Jan 2015) New Revision: 3514 Modified: box/trunk/test/bbackupd/testbbackupd.cpp Log: Fix test failing on OpenBSD because tar -m behaves differently. Modified: box/trunk/test/bbackupd/testbbackupd.cpp =================================================================== --- box/trunk/test/bbackupd/testbbackupd.cpp 2015-01-02 19:18:19 UTC (rev 3513) +++ box/trunk/test/bbackupd/testbbackupd.cpp 2015-01-02 20:13:33 UTC (rev 3514) @@ -3708,11 +3708,17 @@ // TODO FIXME dedent { - // Add some more files and modify others - // Use the m flag this time so they have a recent modification time + // Add some more files and modify others. Use the m flag this + // time so they have a recent modification time. TEST_THAT(unpack_files("test3", "testfiles", "m")); + + // OpenBSD's tar interprets the "-m" option quite differently: + // it sets the time to epoch zero (1 Jan 1970) instead of the + // current time, which doesn't help us. So reset the timestamp + // on a file with the touch command, so it won't be backed up. + TEST_RETURN(::system("touch testfiles/TestDir1/chsh"), 0); - // Wait and test + // At least one file is too new to be backed up on the first run. bbackupd.RunSyncNow(); TEST_COMPARE(Compare_Different); From subversion at boxbackup.org Fri Jan 2 20:31:42 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 2 Jan 2015 20:31:42 GMT Subject: [Box Backup-commit] COMMIT r3515 - box/trunk/lib/common Message-ID: <201501022031.t02KVgkB015866@wm.boxbackup.org> Author: chris Date: 2015-01-02 20:31:42 +0000 (Fri, 02 Jan 2015) New Revision: 3515 Modified: box/trunk/lib/common/DebugMemLeakFinder.cpp Log: Add missing include file for PATH_MAX. Modified: box/trunk/lib/common/DebugMemLeakFinder.cpp =================================================================== --- box/trunk/lib/common/DebugMemLeakFinder.cpp 2015-01-02 20:13:33 UTC (rev 3514) +++ box/trunk/lib/common/DebugMemLeakFinder.cpp 2015-01-02 20:31:42 UTC (rev 3515) @@ -19,6 +19,7 @@ #include #endif +#include #include #include #include From trac at boxbackup.org Fri Jan 2 22:21:55 2015 From: trac at boxbackup.org (Trac) Date: Fri, 02 Jan 2015 22:21:55 -0000 Subject: [Box Backup-commit] #63: Support hard links in directories In-Reply-To: <045.31b0f3554007cbe709ad8c5dbba7f357@boxbackup.org> References: <045.31b0f3554007cbe709ad8c5dbba7f357@boxbackup.org> Message-ID: <060.b2fa02f1a926d15e917716385d30bcea@boxbackup.org> #63: Support hard links in directories -------------------------+------------------------------------------------- Reporter: bbennett | Owner: chris Type: defect | Status: assigned Priority: normal | Milestone: Component: bbackupd | Version: 0.11rc2 Resolution: | Keywords: backup duplicate rename hardlink | corruption -------------------------+------------------------------------------------- Comment (by chris): Implementing this properly requires the long-awaited (and not yet finished) snapshot support to be completed first. In the mean time, we need a test that hardlinked files are backed up properly (but independently) without warnings and without causing rename tracking to do bad things. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From trac at boxbackup.org Fri Jan 2 22:18:08 2015 From: trac at boxbackup.org (Trac) Date: Fri, 02 Jan 2015 22:18:08 -0000 Subject: [Box Backup-commit] #59: Inconsistent treatment of NotifyScript between Box Backup and Boxi In-Reply-To: <042.5347e6a7b9901488a701fc1db410ce7d@boxbackup.org> References: <042.5347e6a7b9901488a701fc1db410ce7d@boxbackup.org> Message-ID: <057.de3980cc10480c2b4b70886ef576b28c@boxbackup.org> #59: Inconsistent treatment of NotifyScript between Box Backup and Boxi -----------------------+--------------------- Reporter: achim | Owner: ben Type: defect | Status: closed Priority: normal | Milestone: Component: bbackupd | Version: 0.11rc2 Resolution: invalid | Keywords: -----------------------+--------------------- Changes (by chris): * status: new => closed * resolution: => invalid -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From trac at boxbackup.org Fri Jan 2 22:16:27 2015 From: trac at boxbackup.org (Trac) Date: Fri, 02 Jan 2015 22:16:27 -0000 Subject: [Box Backup-commit] #60: Case sensitivity between bbstored-certs and Boxi In-Reply-To: <042.1cddccdb22a796b41171eb90141881b2@boxbackup.org> References: <042.1cddccdb22a796b41171eb90141881b2@boxbackup.org> Message-ID: <057.f5fcd18cea50101c4a6bdaeb2738e635@boxbackup.org> #60: Case sensitivity between bbstored-certs and Boxi -----------------------+--------------------- Reporter: achim | Owner: ben Type: defect | Status: closed Priority: normal | Milestone: Component: bbstored | Version: 0.11rc2 Resolution: wontfix | Keywords: -----------------------+--------------------- Changes (by chris): * status: new => closed * resolution: => wontfix Comment: The case sensitivity in the `bbstored-certs` tool is a minor issue that cannot cause data loss. Any issues with Boxi should be on the Boxi bug tracker. Sorry, but I have bigger fish to fry. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From trac at boxbackup.org Fri Jan 2 22:34:03 2015 From: trac at boxbackup.org (Trac) Date: Fri, 02 Jan 2015 22:34:03 -0000 Subject: [Box Backup-commit] #71: bbackupd.log gets randomly deleted In-Reply-To: <042.324ccd86f88eb8eb7b6358d78f9aa8e1@boxbackup.org> References: <042.324ccd86f88eb8eb7b6358d78f9aa8e1@boxbackup.org> Message-ID: <057.008cd9398d14819dd9df61cf9ef55fa1@boxbackup.org> #71: bbackupd.log gets randomly deleted -----------------------+--------------------- Reporter: achim | Owner: ben Type: defect | Status: new Priority: normal | Milestone: Component: bbackupd | Version: 0.11rc2 Resolution: | Keywords: -----------------------+--------------------- Comment (by chris): I think this was fixed by r2392. Please reopen if you can still see the issue. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From trac at boxbackup.org Fri Jan 2 22:34:15 2015 From: trac at boxbackup.org (Trac) Date: Fri, 02 Jan 2015 22:34:15 -0000 Subject: [Box Backup-commit] #71: bbackupd.log gets randomly deleted In-Reply-To: <042.324ccd86f88eb8eb7b6358d78f9aa8e1@boxbackup.org> References: <042.324ccd86f88eb8eb7b6358d78f9aa8e1@boxbackup.org> Message-ID: <057.28ec3274e35d4155887027cb57b5aff0@boxbackup.org> #71: bbackupd.log gets randomly deleted -----------------------+--------------------- Reporter: achim | Owner: ben Type: defect | Status: closed Priority: normal | Milestone: Component: bbackupd | Version: 0.11rc2 Resolution: fixed | Keywords: -----------------------+--------------------- Changes (by chris): * status: new => closed * resolution: => fixed -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From trac at boxbackup.org Fri Jan 2 22:38:54 2015 From: trac at boxbackup.org (Trac) Date: Fri, 02 Jan 2015 22:38:54 -0000 Subject: [Box Backup-commit] #72: Patch intercept.h and intercept.c for NetBSD 4 and 5 In-Reply-To: <046.be141a95636bc20292d3217ce6e90aae@boxbackup.org> References: <046.be141a95636bc20292d3217ce6e90aae@boxbackup.org> Message-ID: <061.5faae2882a1d2a881258ef1d4b9b23bf@boxbackup.org> #72: Patch intercept.h and intercept.c for NetBSD 4 and 5 -------------------------+------------------- Reporter: joseyluis | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: test suite | Version: trunk Resolution: | Keywords: -------------------------+------------------- Comment (by chris): Thanks Jose Luis! I found the same issue when testing on NetBSD 6, applied your patch and it worked. See r3453. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From trac at boxbackup.org Fri Jan 2 22:39:04 2015 From: trac at boxbackup.org (Trac) Date: Fri, 02 Jan 2015 22:39:04 -0000 Subject: [Box Backup-commit] #72: Patch intercept.h and intercept.c for NetBSD 4 and 5 In-Reply-To: <046.be141a95636bc20292d3217ce6e90aae@boxbackup.org> References: <046.be141a95636bc20292d3217ce6e90aae@boxbackup.org> Message-ID: <061.9acbfbee7467e344da9079cd606dca43@boxbackup.org> #72: Patch intercept.h and intercept.c for NetBSD 4 and 5 -------------------------+-------------------- Reporter: joseyluis | Owner: Type: defect | Status: closed Priority: normal | Milestone: Component: test suite | Version: trunk Resolution: fixed | Keywords: -------------------------+-------------------- Changes (by chris): * status: new => closed * resolution: => fixed -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From trac at boxbackup.org Fri Jan 2 22:40:12 2015 From: trac at boxbackup.org (Trac) Date: Fri, 02 Jan 2015 22:40:12 -0000 Subject: [Box Backup-commit] #75: Restore times wrong, times on store correct In-Reply-To: <042.5704aa61abe7b503a533346538413ddb@boxbackup.org> References: <042.5704aa61abe7b503a533346538413ddb@boxbackup.org> Message-ID: <057.65950f6943f0040d4dec4cf4a4abb259@boxbackup.org> #75: Restore times wrong, times on store correct -----------------------+--------------------------------- Reporter: achim | Owner: ben Type: defect | Status: closed Priority: normal | Milestone: Component: bbackupd | Version: trunk Resolution: fixed | Keywords: restore times wrong -----------------------+--------------------------------- Changes (by chris): * status: new => closed * resolution: => fixed Comment: I think I just fixed this in r3511. Only Windows should be affected. Please reopen if this is still an issue. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From subversion at boxbackup.org Fri Jan 2 23:05:14 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 2 Jan 2015 23:05:14 GMT Subject: [Box Backup-commit] COMMIT r3516 - box/trunk/bin/bbackupd Message-ID: <201501022305.t02N5E4k016695@wm.boxbackup.org> Author: chris Date: 2015-01-02 23:05:14 +0000 (Fri, 02 Jan 2015) New Revision: 3516 Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp Log: Add rudimentary support for Windows mutexes. Thanks to Achim for the patch! https://www.boxbackup.org/ticket/67 Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp =================================================================== --- box/trunk/bin/bbackupd/BackupDaemon.cpp 2015-01-02 20:31:42 UTC (rev 3515) +++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2015-01-02 23:05:14 UTC (rev 3516) @@ -164,6 +164,39 @@ } } # endif + + // Mutex support by Achim: see https://www.boxbackup.org/ticket/67 + + // Creates the two mutexes checked for by the installer/uninstaller to + // see if the program is still running. One of the mutexes is created + // in the global name space (which makes it possible to access the + // mutex across user sessions in Windows XP); the other is created in + // the session name space (because versions of Windows NT prior to + // 4.0 TSE don't have a global name space and don't support the + // 'Global\' prefix). + + void CreateMutexes(const std::string& rName) + { + SECURITY_DESCRIPTOR SecurityDesc; + SECURITY_ATTRIBUTES SecurityAttr; + + /* By default on Windows NT, created mutexes are accessible only by the user + running the process. We need our mutexes to be accessible to all users, so + that the mutex detection can work across user sessions in Windows XP. To + do this we use a security descriptor with a null DACL. + */ + + InitializeSecurityDescriptor(&SecurityDesc, SECURITY_DESCRIPTOR_REVISION); + SetSecurityDescriptorDacl(&SecurityDesc, TRUE, NULL, FALSE); + SecurityAttr.nLength = sizeof(SecurityAttr); + SecurityAttr.lpSecurityDescriptor = &SecurityDesc; + SecurityAttr.bInheritHandle = FALSE; + // We don't care if this succeeds or fails. It's only used to + // ensure that an installer can detect if Box Backup is running. + CreateMutexA(&SecurityAttr, FALSE, rName.c_str()); + std::string global_name = "Global\\" + rName; + CreateMutexA(&SecurityAttr, FALSE, global_name.c_str()); + } #endif #include "MemLeakFindOn.h" @@ -410,6 +443,8 @@ } #endif + CreateMutexes("__boxbackup_mutex__"); + int returnCode; if (mRunAsService) @@ -429,7 +464,7 @@ return returnCode; } -#endif +#endif // WIN32 // -------------------------------------------------------------------------- // From subversion at boxbackup.org Fri Jan 2 23:05:17 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 2 Jan 2015 23:05:17 GMT Subject: [Box Backup-commit] COMMIT r3517 - box/trunk/infrastructure/msvc/2010 Message-ID: <201501022305.t02N5HQi016711@wm.boxbackup.org> Author: chris Date: 2015-01-02 23:05:17 +0000 (Fri, 02 Jan 2015) New Revision: 3517 Modified: box/trunk/infrastructure/msvc/2010/common.vcxproj Log: Remove missing source file references from Visual Studio 2010 SLN file Modified: box/trunk/infrastructure/msvc/2010/common.vcxproj =================================================================== --- box/trunk/infrastructure/msvc/2010/common.vcxproj 2015-01-02 23:05:14 UTC (rev 3516) +++ box/trunk/infrastructure/msvc/2010/common.vcxproj 2015-01-02 23:05:17 UTC (rev 3517) @@ -111,7 +111,6 @@ - @@ -182,7 +181,6 @@ - From subversion at boxbackup.org Fri Jan 2 23:05:20 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 2 Jan 2015 23:05:20 GMT Subject: [Box Backup-commit] COMMIT r3518 - box/trunk/lib/win32 Message-ID: <201501022305.t02N5KXD016727@wm.boxbackup.org> Author: chris Date: 2015-01-02 23:05:20 +0000 (Fri, 02 Jan 2015) New Revision: 3518 Modified: box/trunk/lib/win32/emu.h Log: Compile fix for loading BoxConfig.h in MinGW Modified: box/trunk/lib/win32/emu.h =================================================================== --- box/trunk/lib/win32/emu.h 2015-01-02 23:05:17 UTC (rev 3517) +++ box/trunk/lib/win32/emu.h 2015-01-02 23:05:20 UTC (rev 3518) @@ -18,7 +18,12 @@ #define EMU_INCLUDE // Need feature detection macros below -#include "../common/BoxConfig.h" +#ifdef _MSC_VER +# include "../common/BoxConfig-MSVC.h" +# define NEED_BOX_VERSION_H +#else +# include "../common/BoxConfig.h" +#endif // Shut up stupid new warnings. Thanks MinGW! Ever heard of "compatibility"? #ifdef __MINGW32__ From subversion at boxbackup.org Fri Jan 2 23:05:23 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Fri, 2 Jan 2015 23:05:23 GMT Subject: [Box Backup-commit] COMMIT r3519 - box/trunk/lib/win32 Message-ID: <201501022305.t02N5Nmr016743@wm.boxbackup.org> Author: chris Date: 2015-01-02 23:05:23 +0000 (Fri, 02 Jan 2015) New Revision: 3519 Modified: box/trunk/lib/win32/emu.h Log: Compile fix for MSVC (Visual Studio) 2010. Modified: box/trunk/lib/win32/emu.h =================================================================== --- box/trunk/lib/win32/emu.h 2015-01-02 23:05:20 UTC (rev 3518) +++ box/trunk/lib/win32/emu.h 2015-01-02 23:05:23 UTC (rev 3519) @@ -214,6 +214,7 @@ #define vsnprintf _vsnprintf #ifndef __MINGW32__ +#define snprintf _snprintf inline int strcasecmp(const char *s1, const char *s2) { return _stricmp(s1,s2); From trac at boxbackup.org Fri Jan 2 23:06:26 2015 From: trac at boxbackup.org (Trac) Date: Fri, 02 Jan 2015 23:06:26 -0000 Subject: [Box Backup-commit] #67: Add mutexes for Win32 (client) to enable detection of running instance during install/uninstall In-Reply-To: <042.9f9065f51ac5d5eb4f39107b8362ce1e@boxbackup.org> References: <042.9f9065f51ac5d5eb4f39107b8362ce1e@boxbackup.org> Message-ID: <057.f41bbe2a2245d9b6b9d34186f4473cf4@boxbackup.org> #67: Add mutexes for Win32 (client) to enable detection of running instance during install/uninstall --------------------------+-------------------- Reporter: achim | Owner: chris Type: enhancement | Status: closed Priority: normal | Milestone: Component: bbackupd | Version: trunk Resolution: fixed | Keywords: --------------------------+-------------------- Changes (by chris): * status: assigned => closed * resolution: => fixed Comment: Thanks Achim, added in r3516, sorry for the long delay. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From trac at boxbackup.org Fri Jan 2 23:11:12 2015 From: trac at boxbackup.org (Trac) Date: Fri, 02 Jan 2015 23:11:12 -0000 Subject: [Box Backup-commit] #14: Fix large file issues on Windows In-Reply-To: <042.3eee109473edd48dcd0eac41e8f306bb@boxbackup.org> References: <042.3eee109473edd48dcd0eac41e8f306bb@boxbackup.org> Message-ID: <057.cb99102a8a4cde9ec9ee0b22c4843c09@boxbackup.org> #14: Fix large file issues on Windows -----------------------+------------------------------------------------ Reporter: chris | Owner: chris Type: defect | Status: closed Priority: normal | Milestone: 0.11 Component: bbackupd | Version: 0.10 Resolution: fixed | Keywords: windows large files 2gb corruption -----------------------+------------------------------------------------ Changes (by chris): * status: new => closed * resolution: => fixed Comment: With no reports of further problems in 4 years, I'm assuming that this is fixed now. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From trac at boxbackup.org Fri Jan 2 23:16:46 2015 From: trac at boxbackup.org (Trac) Date: Fri, 02 Jan 2015 23:16:46 -0000 Subject: [Box Backup-commit] #13: Fix file locking on Windows In-Reply-To: <042.8c077e82ac3175b7cfca135ffc16feef@boxbackup.org> References: <042.8c077e82ac3175b7cfca135ffc16feef@boxbackup.org> Message-ID: <057.8f7301de80cb5470ceeb41d23163f8ce@boxbackup.org> #13: Fix file locking on Windows -------------------------+------------------------------------------------- Reporter: chris | Owner: chris Type: defect | Status: new Priority: normal | Milestone: 0.12 Component: bbackupd | Version: 0.10 Resolution: | Keywords: windows file locking locked volume | shadow copy service vss -------------------------+------------------------------------------------- Comment (by chris): We have basic VSS support in Box Backup trunk, soon to be released as 0.13. We need official MSVC 64-bit builds to go along with it, and that requires merging Charles' fixes from his branch. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From subversion at boxbackup.org Sun Jan 4 19:41:46 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sun, 4 Jan 2015 19:41:46 GMT Subject: [Box Backup-commit] COMMIT r3520 - box/trunk/lib/common Message-ID: <201501041941.t04JfkCL031515@wm.boxbackup.org> Author: chris Date: 2015-01-04 19:41:46 +0000 (Sun, 04 Jan 2015) New Revision: 3520 Modified: box/trunk/lib/common/Logging.cpp Log: Don't redirect logging to stderr any more. We have more fine-grained control over logging now, including ability to log to a file in bbackupquery and all daemons, and users can't redirect stderr on Windows. https://www.boxbackup.org/ticket/50 Modified: box/trunk/lib/common/Logging.cpp =================================================================== --- box/trunk/lib/common/Logging.cpp 2015-01-02 23:05:23 UTC (rev 3519) +++ box/trunk/lib/common/Logging.cpp 2015-01-04 19:41:46 UTC (rev 3520) @@ -284,12 +284,6 @@ } FILE* target = stdout; - - if (level <= Log::WARNING) - { - target = stderr; - } - std::ostringstream buf; if (sShowTime) From subversion at boxbackup.org Sun Jan 4 19:41:50 2015 From: subversion at boxbackup.org (subversion at boxbackup.org) Date: Sun, 4 Jan 2015 19:41:50 GMT Subject: [Box Backup-commit] COMMIT r3521 - in box/trunk: lib/win32 test/bbackupd Message-ID: <201501041941.t04Jfor9031532@wm.boxbackup.org> Author: chris Date: 2015-01-04 19:41:50 +0000 (Sun, 04 Jan 2015) New Revision: 3521 Modified: box/trunk/lib/win32/emu.cpp box/trunk/lib/win32/emu.h box/trunk/test/bbackupd/testbbackupd.cpp Log: Add test for hardlink handling. Modified: box/trunk/lib/win32/emu.cpp =================================================================== --- box/trunk/lib/win32/emu.cpp 2015-01-04 19:41:46 UTC (rev 3520) +++ box/trunk/lib/win32/emu.cpp 2015-01-04 19:41:50 UTC (rev 3521) @@ -1667,6 +1667,73 @@ return 0; } +int emu_link(const char* pOldPath, const char* pNewPath) +{ + std::string AbsOldPathWithUnicode = + ConvertPathToAbsoluteUnicode(pOldPath); + + if (AbsOldPathWithUnicode.size() == 0) + { + // error already logged by ConvertPathToAbsoluteUnicode() + return -1; + } + + std::string AbsNewPathWithUnicode = + ConvertPathToAbsoluteUnicode(pNewPath); + + if (AbsNewPathWithUnicode.size() == 0) + { + // error already logged by ConvertPathToAbsoluteUnicode() + return -1; + } + + WCHAR* pOldBuffer = ConvertUtf8ToWideString(AbsOldPathWithUnicode.c_str()); + if (!pOldBuffer) + { + return -1; + } + + WCHAR* pNewBuffer = ConvertUtf8ToWideString(AbsNewPathWithUnicode.c_str()); + if (!pNewBuffer) + { + delete [] pOldBuffer; + return -1; + } + + BOOL result = CreateHardLinkW(pNewBuffer, pOldBuffer, NULL); + DWORD err = GetLastError(); + delete [] pOldBuffer; + delete [] pNewBuffer; + + if (!result) + { + if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) + { + errno = ENOENT; + } + else if (err == ERROR_SHARING_VIOLATION) + { + errno = EBUSY; + } + else if (err == ERROR_ACCESS_DENIED) + { + errno = EACCES; + } + else + { + ::syslog(LOG_WARNING, "Failed to hardlink file " + "'%s' to '%s': %s", pOldPath, pNewPath, + GetErrorMessage(err).c_str()); + errno = ENOSYS; + } + + return -1; + } + + return 0; + +} + int emu_unlink(const char* pFileName) { std::string AbsPathWithUnicode = @@ -1709,6 +1776,7 @@ GetErrorMessage(err).c_str()); errno = ENOSYS; } + return -1; } Modified: box/trunk/lib/win32/emu.h =================================================================== --- box/trunk/lib/win32/emu.h 2015-01-04 19:41:46 UTC (rev 3520) +++ box/trunk/lib/win32/emu.h 2015-01-04 19:41:50 UTC (rev 3521) @@ -353,6 +353,7 @@ int emu_chdir (const char* pDirName); int emu_mkdir (const char* pPathName); +int emu_link (const char* pOldPath, const char* pNewPath); int emu_unlink (const char* pFileName); int emu_fstat (HANDLE file, struct emu_stat* st); int emu_stat (const char* pName, struct emu_stat* st); @@ -363,6 +364,7 @@ #define chdir(directory) emu_chdir (directory) #define mkdir(path, mode) emu_mkdir (path) +#define link(oldpath, newpath) emu_link (oldpath, newpath) #define unlink(file) emu_unlink (file) #define utimes(buffer, times) emu_utimes (buffer, times) #define chmod(file, mode) emu_chmod (file, mode) Modified: box/trunk/test/bbackupd/testbbackupd.cpp =================================================================== --- box/trunk/test/bbackupd/testbbackupd.cpp 2015-01-04 19:41:46 UTC (rev 3520) +++ box/trunk/test/bbackupd/testbbackupd.cpp 2015-01-04 19:41:50 UTC (rev 3521) @@ -1742,6 +1742,39 @@ TEARDOWN(); } +bool test_backup_hardlinked_files() +{ + SETUP_WITH_BBSTORED(); + + bbackupd.RunSyncNow(); + TEST_COMPARE(Compare_Same); + + // Create some hard links. First in the same directory: + TEST_THAT(link("testfiles/TestDir1/x1/dsfdsfs98.fd", + "testfiles/TestDir1/x1/hardlink1") == 0); + bbackupd.RunSyncNow(); + TEST_COMPARE(Compare_Same); + + // Now in a different directory + TEST_THAT(mkdir("testfiles/TestDir1/x2", 0755) == 0); + TEST_THAT(link("testfiles/TestDir1/x1/dsfdsfs98.fd", + "testfiles/TestDir1/x2/hardlink2") == 0); + bbackupd.RunSyncNow(); + TEST_COMPARE(Compare_Same); + + // Now delete one of them + TEST_THAT(unlink("testfiles/TestDir1/x1/dsfdsfs98.fd") == 0); + bbackupd.RunSyncNow(); + TEST_COMPARE(Compare_Same); + + // And another. + TEST_THAT(unlink("testfiles/TestDir1/x1/hardlink1") == 0); + bbackupd.RunSyncNow(); + TEST_COMPARE(Compare_Same); + + TEARDOWN(); +} + bool test_backup_pauses_when_store_is_full() { SETUP_WITHOUT_FILES(); @@ -4202,6 +4235,7 @@ // TEST_THAT(test_replace_zero_byte_file_with_nonzero_byte_file()); TEST_THAT(test_backup_disappearing_directory()); TEST_THAT(test_ssl_keepalives()); + TEST_THAT(test_backup_hardlinked_files()); TEST_THAT(test_backup_pauses_when_store_is_full()); TEST_THAT(test_bbackupd_exclusions()); TEST_THAT(test_bbackupd_uploads_files()); From trac at boxbackup.org Sun Jan 4 19:42:31 2015 From: trac at boxbackup.org (Trac) Date: Sun, 04 Jan 2015 19:42:31 -0000 Subject: [Box Backup-commit] #50: No way to capture stderr under Windows In-Reply-To: <042.be677009d42b205bdaca051d6918e9c2@boxbackup.org> References: <042.be677009d42b205bdaca051d6918e9c2@boxbackup.org> Message-ID: <057.9f608136c321eed049641aa2c4ba410c@boxbackup.org> #50: No way to capture stderr under Windows -------------------------+------------------------------------------------- Reporter: chris | Owner: chris Type: defect | Status: closed Priority: major | Milestone: 0.11 Component: | Version: 0.11rc1 bbackupquery | Keywords: win32 error logging bbackupquery Resolution: fixed | compare logging stderr errors -------------------------+------------------------------------------------- Changes (by chris): * status: new => closed * resolution: => fixed Comment: Should be fixed in r3520. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX. From trac at boxbackup.org Sun Jan 4 22:04:36 2015 From: trac at boxbackup.org (Trac) Date: Sun, 04 Jan 2015 22:04:36 -0000 Subject: [Box Backup-commit] #49: ID map (rename tracking) broken since [288] In-Reply-To: <042.11cf44ddc3b5bb942976c0e8d0ec1c48@boxbackup.org> References: <042.11cf44ddc3b5bb942976c0e8d0ec1c48@boxbackup.org> Message-ID: <057.c207f50458d8a14a4aec18312b3f5b0f@boxbackup.org> #49: ID map (rename tracking) broken since [288] -----------------------+--------------------- Reporter: chris | Owner: chris Type: defect | Status: closed Priority: normal | Milestone: 0.12 Component: bbackupd | Version: 0.11rc1 Resolution: fixed | Keywords: -----------------------+--------------------- Changes (by chris): * status: new => closed * resolution: => fixed Comment: I think this was fixed by r2631. -- Ticket URL: Box Backup An open source, completely automatic on-line backup system for UNIX.