Merge lp:~ed.so/duplicity/duplicity.tmpspacefix into lp:duplicity/0.6

Proposed by edso
Status: Merged
Merged at revision: 860
Proposed branch: lp:~ed.so/duplicity/duplicity.tmpspacefix
Merge into: lp:duplicity/0.6
Diff against target: 52 lines (+13/-3)
2 files modified
duplicity/patchdir.py (+7/-3)
duplicity/tempdir.py (+6/-0)
To merge this branch: bzr merge lp:~ed.so/duplicity/duplicity.tmpspacefix
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+123622@code.launchpad.net

Description of the change

probably solves bug 'Out of space error while restoring a file' due to creating restored files always in /tmp
see bug tracker/mailing list
 https://bugs.launchpad.net/duplicity/+bug/1005901
 http://lists.gnu.org/archive/html/duplicity-talk/2012-09/msg00000.html

To post a comment you must log in.
860. By edso

use tempfile.TemporaryFile() so unused temp files are deleted automagically

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'duplicity/patchdir.py'
--- duplicity/patchdir.py 2011-08-23 18:14:17 +0000
+++ duplicity/patchdir.py 2012-09-11 14:13:22 +0000
@@ -21,8 +21,8 @@
2121
22import re #@UnusedImport22import re #@UnusedImport
23import types23import types
24import os
24import tempfile25import tempfile
25import os
2626
27from duplicity import tarfile #@UnusedImport27from duplicity import tarfile #@UnusedImport
28from duplicity import librsync #@UnusedImport28from duplicity import librsync #@UnusedImport
@@ -30,6 +30,7 @@
30from duplicity import diffdir30from duplicity import diffdir
31from duplicity import misc31from duplicity import misc
32from duplicity import selection32from duplicity import selection
33from duplicity import tempdir
33from duplicity import util #@UnusedImport34from duplicity import util #@UnusedImport
34from duplicity.path import * #@UnusedWildImport35from duplicity.path import * #@UnusedWildImport
35from duplicity.lazy import * #@UnusedWildImport36from duplicity.lazy import * #@UnusedWildImport
@@ -470,8 +471,11 @@
470 for delta_ropath in patch_seq[1:]:471 for delta_ropath in patch_seq[1:]:
471 assert delta_ropath.difftype == "diff", delta_ropath.difftype472 assert delta_ropath.difftype == "diff", delta_ropath.difftype
472 if not isinstance( current_file, file ):473 if not isinstance( current_file, file ):
473 # librsync needs true file474 """
474 tempfp = os.tmpfile()475 librsync insists on a real file object, which we create manually
476 by using the duplicity.tempdir to tell us where.
477 """
478 tempfp = tempfile.TemporaryFile( dir=tempdir.default().dir() )
475 misc.copyfileobj( current_file, tempfp )479 misc.copyfileobj( current_file, tempfp )
476 assert not current_file.close()480 assert not current_file.close()
477 tempfp.seek( 0 )481 tempfp.seek( 0 )
478482
=== modified file 'duplicity/tempdir.py'
--- duplicity/tempdir.py 2011-08-18 19:17:55 +0000
+++ duplicity/tempdir.py 2012-09-11 14:13:22 +0000
@@ -127,6 +127,12 @@
127127
128 self.__lock = threading.Lock() # protect private resources *AND* mktemp/mkstemp calls128 self.__lock = threading.Lock() # protect private resources *AND* mktemp/mkstemp calls
129129
130 def dir(self):
131 """
132 Returns the absolute pathname of the temp folder.
133 """
134 return self.__dir
135
130 def __del__(self):136 def __del__(self):
131 """137 """
132 Perform cleanup.138 Perform cleanup.

Subscribers

People subscribed via source and target branches

to all changes: