← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~ed.so/duplicity/duplicity.tmpspacefix into lp:duplicity

 

edso has proposed merging lp:~ed.so/duplicity/duplicity.tmpspacefix into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)
Related bugs:
  Bug #1005901 in Duplicity: "cannot change temp dir"
  https://bugs.launchpad.net/duplicity/+bug/1005901

For more details, see:
https://code.launchpad.net/~ed.so/duplicity/duplicity.tmpspacefix/+merge/123622

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
-- 
https://code.launchpad.net/~ed.so/duplicity/duplicity.tmpspacefix/+merge/123622
Your team duplicity-team is requested to review the proposed merge of lp:~ed.so/duplicity/duplicity.tmpspacefix into lp:duplicity.
=== modified file 'duplicity/patchdir.py'
--- duplicity/patchdir.py	2011-08-23 18:14:17 +0000
+++ duplicity/patchdir.py	2012-09-10 18:45:23 +0000
@@ -21,7 +21,6 @@
 
 import re #@UnusedImport
 import types
-import tempfile
 import os
 
 from duplicity import tarfile #@UnusedImport
@@ -30,6 +29,7 @@
 from duplicity import diffdir
 from duplicity import misc
 from duplicity import selection
+from duplicity import tempdir
 from duplicity import util #@UnusedImport
 from duplicity.path import * #@UnusedWildImport
 from duplicity.lazy import * #@UnusedWildImport
@@ -470,8 +470,18 @@
     for delta_ropath in patch_seq[1:]:
         assert delta_ropath.difftype == "diff", delta_ropath.difftype
         if not isinstance( current_file, file ):
-            # librsync needs true file
-            tempfp = os.tmpfile()
+            """ TODO: the following is suboptimal and should be reworked
+            librsync insists on a real file object, which we create manually
+            by using the duplicity.tempdir to tell us where. unfortunately
+            these files can't have an autodelete handler attached, so they
+            are deleted only after the whole restore process is finished,
+            meaning the space needed for a restore is 1 volume plus all files
+            which need to be patched. in the worst case this means space for 
+            the whole restore is needed in the TMP fs additionally to the 
+            space needed in the target file system.
+            """
+            tempfp_fd = tempdir.default().mkstemp()[0]
+            tempfp = os.fdopen(tempfp_fd,'w+b')
             misc.copyfileobj( current_file, tempfp )
             assert not current_file.close()
             tempfp.seek( 0 )


Follow ups