Error (and fix) restoring to a non-local directory

Phillip J. Eby pje@telecommunity.com
Sun, 18 Aug 2002 11:12:17 -0400


I got the following error trying to do a restore from a local drive to a 
drive over an SSH connection, using 0.9.5:

Traceback (most recent call last):
   File "/usr/bin/rdiff-backup", line 24, in ?
     rdiff_backup.Main.Main(sys.argv[1:])
   File 
"/var/tmp/rdiff-backup-root/usr/lib/python2.2/site-packages/rdiff_backup/Main.py", 
line 226, in Main
   File 
"/var/tmp/rdiff-backup-root/usr/lib/python2.2/site-packages/rdiff_backup/Security.py", 
line 33, in initialize
   File 
"/var/tmp/rdiff-backup-root/usr/lib/python2.2/site-packages/rdiff_backup/Security.py", 
line 92, in set_security_level
UnboundLocalError: local variable 'rdir' referenced before assignment

To fix it, I looked at the code and fixed up the "else" branch that was 
being executed for a restore from a local to a non-local drive, so that it 
set 'rdir=getpath(cp2)', since that seemed consistent with branches for 
other operations.  Restore then seemed to work okay.

One other problem I had before that, was that when I tried to restore from 
a backup directory that had no increments, it failed with the following:

Traceback (most recent call last):
   File "/usr/bin/rdiff-backup", line 24, in ?
     rdiff_backup.Main.Main(sys.argv[1:])
   File 
"/var/tmp/rdiff-backup-root/usr/lib/python2.2/site-packages/rdiff_backup/Main.py", 
line 229, in Main
   File 
"/var/tmp/rdiff-backup-root/usr/lib/python2.2/site-packages/rdiff_backup/Main.py", 
line 207, in take_action
   File 
"/var/tmp/rdiff-backup-root/usr/lib/python2.2/site-packages/rdiff_backup/Main.py", 
line 380, in RestoreAsOf
   File 
"/var/tmp/rdiff-backup-root/usr/lib/python2.2/site-packages/rdiff_backup/Main.py", 
line 390, in restore_common
   File 
"/var/tmp/rdiff-backup-root/usr/lib/python2.2/site-packages/rdiff_backup/restore.py", 
line 40, in Restore
   File 
"/var/tmp/rdiff-backup-root/usr/lib/python2.2/site-packages/rdiff_backup/restore.py", 
line 92, in get_inclist
   File 
"/var/tmp/rdiff-backup-root/usr/lib/python2.2/site-packages/rdiff_backup/rpath.py", 
line 569, in listdir
OSError: [Errno 2] No such file or directory: 
'/tmp/a12back/rdiff-backup-data/increments'


Apparently, it's not possible to restore a new backup that has no 
increments yet.  I didn't try to trace this one down, however, since my 
simple workaround at this point is to always run rdiff-backup *twice* when 
I first create a backup.  ;)

Thanks for a great program!