bug or user-error? killed my whole repository today just by doing some restore-tests....

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

bug or user-error? killed my whole repository today just by doing some restore-tests....

Roland Kletzing
hello!

i'm new to rdiff-backup (great tool, though!) - i never did testing the
restore in depth, but i was playing with this today - and i accidentally
killed my complete rdiff-backup repository!

OUCH!

fortunately, i did this in /backup with a non-priviledged account - and not
in / with the root account - furthermore i'm just "still testing" -
otherwise......

I think what i did is just sort of little error (i.e. using --force left
over from previous tries - and using "." as i was just used to ), but this
gave very unexpected result.

SO - WHAT I`M DEMONSTRATING HERE - TAKE CARE IF YOU WANT TO TRY TO
REPRODUCE!

ok - lets go.....

$ cd /backup

$ ls -la
drwx------   3 backup root  96 Apr 13 01:33 .
drwxr-xr-x  28 root root 664 Apr  1 15:28 ..
drwx------   4 backup root 112 Apr 13 01:39 my_rdiff_repository

ok - let`s restore a single file from my repository

$ rdiff-backup --force -r 2D ./my_rdiff_repository/path/single_file .
(DON`T DO IT THIS WAY!)

(ok - i did "--force", but that was just because i needed to use it in
previous restore-tests and i didn`t expect that it could lead to _such_
serious behaviour)

this command ran for quite a while - i was just wondering why - then giving

Exception '[Errno 22] Invalid argument: '.'' raised of class
'exceptions.OSError':
  File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line 295, in
error_check_Main
    try: Main(arglist)
  File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line 315, in
Main
    take_action(rps)
  File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line 281, in
take_action
    elif action == "restore-as-of": Restore(rps[0], rps[1], 1)
  File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line 490, in
Restore
    inc_rpath, dest_rp, time)
  File "/usr/lib/python2.3/site-packages/rdiff_backup/restore.py", line 37,
in Restore
    TargetS.patch(target, diff_iter)
  File "/usr/lib/python2.3/site-packages/rdiff_backup/restore.py", line 291,
in patch
    ITR.Finish()
  File "/usr/lib/python2.3/site-packages/rdiff_backup/rorpiter.py", line
247, in Finish
    to_be_finished.end_process()
  File "/usr/lib/python2.3/site-packages/rdiff_backup/restore.py", line 669,
in end_process
    self.base_rp.rmdir()
  File "/usr/lib/python2.3/site-packages/rdiff_backup/rpath.py", line 873,
in rmdir
    self.conn.os.rmdir(self.path)

Traceback (most recent call last):
  File "/usr/bin/rdiff-backup", line 23, in ?
    rdiff_backup.Main.error_check_Main(sys.argv[1:])
  File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line 295, in
error_check_Main
    try: Main(arglist)
  File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line 315, in
Main
    take_action(rps)
  File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line 281, in
take_action
    elif action == "restore-as-of": Restore(rps[0], rps[1], 1)
  File "/usr/lib/python2.3/site-packages/rdiff_backup/Main.py", line 490, in
Restore
    inc_rpath, dest_rp, time)
  File "/usr/lib/python2.3/site-packages/rdiff_backup/restore.py", line 37,
in Restore
    TargetS.patch(target, diff_iter)
  File "/usr/lib/python2.3/site-packages/rdiff_backup/restore.py", line 291,
in patch
    ITR.Finish()
  File "/usr/lib/python2.3/site-packages/rdiff_backup/rorpiter.py", line
247, in Finish
    to_be_finished.end_process()
  File "/usr/lib/python2.3/site-packages/rdiff_backup/restore.py", line 669,
in end_process
    self.base_rp.rmdir()
  File "/usr/lib/python2.3/site-packages/rdiff_backup/rpath.py", line 873,
in rmdir
    self.conn.os.rmdir(self.path)
OSError: [Errno 22] Invalid argument: '.'

huh ?

vmhost:/backup # ls -la
total 1
drwx------   2 root root  48 Apr 13 01:54 .
drwxr-xr-x  28 root root 664 Apr  1 15:28 ..

damn - what ?

:'-(

trying to restore a single file to current directory recursively seems to
have killed my complete backup repository.

imho, a backup program in "restore" mode should never delete dirs/files
recursively - not even with a --force option.
a backup program should better save our data, not deleting it.

in the output i see
  File "/usr/lib/python2.3/site-packages/rdiff_backup/rpath.py", line 873,
in rmdir
is this necessary that this tool does "rmdir" in restore mode - without any
option on the commandline which tells "--delete" or "--force-delete"  or
"--force-overwrite" ?
furthermore, from all sorts of errors i have seen with rdiff-backup, i
always see lots of python error-stuff which  is difficult to interpret for
the end user.
looks like there hasn`t been spend much work in error handling!? is this
just something which needs improvement, or is it due to "nature" of python ?

to avoid other people loosing data, i would recommend improving this by
changing this or by doing double-checking.
maybe i`m  just the "unlucky first one" experiencing this - or i`m just too
lazy - but i don`t really feel that i made a _big_ mistake here.

could someone give a comment about what i did or about rdiff-backup's
unexpected behaviour ?

thank you!

greetings
roland

ps:
please see this posting just as "constructive criticism" to help improving
rdiff-backup



_______________________________________________
rdiff-backup-users mailing list at [hidden email]
http://lists.nongnu.org/mailman/listinfo/rdiff-backup-users
Wiki URL: http://rdiff-backup.solutionsfirst.com.au/index.php/RdiffBackupWiki