Cygwin: TypeError: basis_file must be a (true) file, while restoring inremental backup

Bug #670891 reported by ChieftainY2k
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Duplicity
Fix Released
Medium
Unassigned

Bug Description

I am unable to restore files from incremental backup, while restoring files from FULL backup seems to be ok.

The error is "TypeError: basis_file must be a (true) file"

This is a major problem for me , since I use duplicity on a daily basis to back up my windows documents and files.

Backup storage is local drive.

All backed up files are from local drive.

See attachment for details.

Environment:
Windowx XP SP3 + latest cygwin.

Error summary:

bash-3.2$ uname -a
CYGWIN_NT-5.1 cy2k 1.7.7(0.230/5/3) 2010-08-31 09:58 i686 Cygwin

bash-3.2$ duplicity --version
duplicity 0.6.10

bash-3.2$ python --version
Python 2.6.5

Error Stack Trace:

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1245, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1238, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1192, in main
    restore(col_stats)
  File "/usr/bin/duplicity", line 539, in restore
    restore_get_patched_rop_iter(col_stats)):
  File "/usr/lib/python2.6/site-packages/duplicity/patchdir.py", line 520, in Write_ROPaths
    for ropath in rop_iter:
  File "/usr/lib/python2.6/site-packages/duplicity/patchdir.py", line 493, in integrate_patch_iters
    final_ropath = patch_seq2ropath( normalize_ps( patch_seq ) )
  File "/usr/lib/python2.6/site-packages/duplicity/patchdir.py", line 478, in patch_seq2ropath
    delta_ropath.open( "rb" ) )
  File "/usr/lib/python2.6/site-packages/duplicity/librsync.py", line 167, in __init__
    raise TypeError("basis_file must be a (true) file")
TypeError: basis_file must be a (true) file

Revision history for this message
ChieftainY2k (chieftainy2k) wrote :
Revision history for this message
Paolo Costa (paolinux) wrote :

Hi there,

I bumped into the same problem while running duplicity 0.6.11 (patched as of http://jager.no/projects/windows/duplicity-on-windows) using cygwin 1.7.7 and python 2.6.5 on Windows 7.

The problem is that, as explained in the Python documentation (http://docs.python.org/library/tempfile.html), tempfile.TemporaryFile returns a *file-like* object, not a file object. Under Linux, it effectively returns a file object but under windows it does not. Hence, the type of the object returned is *not* a types.FileType, causing the exception to be raised.

Further references:

http://bytes.com/topic/python/answers/36024-bug-windows-tempfile-py
http://<email address hidden>/msg00675.html

I found a workaround (patch attached) by replacing in src/patchdir.py "tempfile.TemporaryFile()" with "os.tmpfile()", which, instead, returns a file object (http://docs.python.org/library/os.html).

Hope it helps,

Paolo

Changed in duplicity:
importance: Undecided → Medium
milestone: none → 0.6.12
status: New → Fix Committed
Changed in duplicity:
status: Fix Committed → In Progress
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.