Merge lp:~mterry/duplicity/resume-inc into lp:duplicity/0.6

Proposed by Michael Terry
Status: Merged
Merged at revision: 820
Proposed branch: lp:~mterry/duplicity/resume-inc
Merge into: lp:duplicity/0.6
Diff against target: 51 lines (+26/-5)
2 files modified
bin/duplicity (+6/-5)
testing/tests/restarttest.py (+20/-0)
To merge this branch: bzr merge lp:~mterry/duplicity/resume-inc
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+84655@code.launchpad.net

Description of the change

I found a bug while running the deja-dup test suite. If you are resuming an interrupted incremental backup, duplicity will first set the curtime and prevtime to be the same as the existing incremental. But then it will reset the time to be current. Which results in an error message later [1]. This branch fixes that and adds a test for it.

[1] A safety check I added to actually check for mismatches in encryption settings, but it caught this too, thankfully. "Restarting backup, but current encryption settings do not match original settings"

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/duplicity'
2--- bin/duplicity 2011-11-25 17:47:57 +0000
3+++ bin/duplicity 2011-12-06 19:14:26 +0000
4@@ -551,11 +551,12 @@
5 @rtype: void
6 @return: void
7 """
8- dup_time.setprevtime(sig_chain.end_time)
9- if dup_time.curtime == dup_time.prevtime:
10- time.sleep(2)
11- dup_time.setcurtime()
12- assert dup_time.curtime != dup_time.prevtime, "time not moving forward at appropriate pace - system clock issues?"
13+ if not globals.restart:
14+ dup_time.setprevtime(sig_chain.end_time)
15+ if dup_time.curtime == dup_time.prevtime:
16+ time.sleep(2)
17+ dup_time.setcurtime()
18+ assert dup_time.curtime != dup_time.prevtime, "time not moving forward at appropriate pace - system clock issues?"
19 if globals.dry_run:
20 tarblock_iter = diffdir.DirDelta(globals.select,
21 sig_chain.get_fileobjs())
22
23=== modified file 'testing/tests/restarttest.py'
24--- testing/tests/restarttest.py 2011-11-07 15:08:24 +0000
25+++ testing/tests/restarttest.py 2011-12-06 19:14:26 +0000
26@@ -270,5 +270,25 @@
27 # there should be 2 differences found, one missing file, one mtime change
28 #self.verify("testfiles/largefiles")
29
30+ def test_restart_incremental(self):
31+ """
32+ Test restarting an incremental backup
33+ """
34+ # Make first normal full backup
35+ self.backup("full", "testfiles/dir1")
36+ # create 3 2M files
37+ assert not os.system("mkdir testfiles/largefiles")
38+ for n in (1,2,3):
39+ assert not os.system("dd if=/dev/urandom of=testfiles/largefiles/file%d bs=1024 count=2048 > /dev/null 2>&1" % n)
40+ # Force a failure partway through
41+ try:
42+ self.backup("inc", "testfiles/largefiles", options = ["--vols 1", "--fail 2"])
43+ assert False # shouldn't get this far
44+ except CmdError, e:
45+ pass
46+ # Now finish that incremental
47+ self.backup("inc", "testfiles/largefiles")
48+ self.verify("testfiles/largefiles")
49+
50 if __name__ == "__main__":
51 unittest.main()

Subscribers

People subscribed via source and target branches

to all changes: