summaryrefslogtreecommitdiff
path: root/rdiff-backup/rdiff_backup/robust.py
diff options
context:
space:
mode:
authorben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-06-19 09:56:00 +0000
committerben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-06-19 09:56:00 +0000
commitf1a097e8c9fe9f80b9aa476566c21c9edd1d4b65 (patch)
tree1284f9ccf2b9e882ebe96ff9838c97c48c680eb0 /rdiff-backup/rdiff_backup/robust.py
parentf75dba2fa023f9e18b6e89dd8a826009571b6c41 (diff)
downloadrdiff-backup-f1a097e8c9fe9f80b9aa476566c21c9edd1d4b65.tar.gz
Added compile.py to compile the c portion
Added GPL headers to all the source code files Fixed memory leaks and bad pointer casts in cmodule.c git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@141 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup/robust.py')
-rw-r--r--rdiff-backup/rdiff_backup/robust.py73
1 files changed, 42 insertions, 31 deletions
diff --git a/rdiff-backup/rdiff_backup/robust.py b/rdiff-backup/rdiff_backup/robust.py
index 3c9851c..b7c11fd 100644
--- a/rdiff-backup/rdiff_backup/robust.py
+++ b/rdiff-backup/rdiff_backup/robust.py
@@ -1,35 +1,45 @@
-import tempfile, errno, signal, cPickle
-from static import *
-
-#######################################################################
-#
-# robust - code which prevents mirror from being corrupted, error-recovery
+# Copyright 2002 Ben Escoto
#
-# Ideally no matter an instance of rdiff-backup gets aborted, no
-# information should get lost. The target directory should be left in
-# a coherent state, and later instances of rdiff-backup should clean
-# things up so there is no sign that anything ever got aborted or
-# failed.
+# This file is part of rdiff-backup.
#
-# Thus, files should be updated in an atomic way as possible. Each
-# file should be updated (and the corresponding diff files written) or
-# not, and it should be clear which happened. In general, I don't
-# think this is possible, since the creation of the diff files and the
-# changing of updated files cannot be guarateed to happen together.
-# It is possible, I think, to record various information to files
-# which would allow a later process to figure out what the last
-# operation was, but this would add several file operations to the
-# processing of each file, and I don't think, would be a good
-# tradeoff.
-#
-# The compromise reached here is that diff files should be created
-# just before the mirror files are updated, and each file update
-# should be done with a rename operation on a file in the same
-# directory. Furthermore, every once in a while, rdiff-backup will
-# record which file it just finished processing. If any fatal errors
-# are caught, it will also record the last processed file. Future
-# instances may not know exactly when the previous instance was
-# aborted, but they will be able to narrow down the possibilities.
+# rdiff-backup is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA
+# 02139, USA; either version 2 of the License, or (at your option) any
+# later version; incorporated herein by reference.
+
+"""Prevent mirror from being corrupted; handle errors
+
+Ideally no matter an instance of rdiff-backup gets aborted, no
+information should get lost. The target directory should be left in a
+coherent state, and later instances of rdiff-backup should clean
+things up so there is no sign that anything ever got aborted or
+failed.
+
+Thus, files should be updated in an atomic way as possible. Each file
+should be updated (and the corresponding diff files written) or not,
+and it should be clear which happened. In general, I don't think this
+is possible, since the creation of the diff files and the changing of
+updated files cannot be guarateed to happen together. It is possible,
+I think, to record various information to files which would allow a
+later process to figure out what the last operation was, but this
+would add several file operations to the processing of each file, and
+I don't think, would be a good tradeoff.
+
+The compromise reached here is that diff files should be created just
+before the mirror files are updated, and each file update should be
+done with a rename operation on a file in the same directory.
+Furthermore, every once in a while, rdiff-backup will record which
+file it just finished processing. If any fatal errors are caught, it
+will also record the last processed file. Future instances may not
+know exactly when the previous instance was aborted, but they will be
+able to narrow down the possibilities.
+
+"""
+
+import tempfile, errno, signal, cPickle, C
+from static import *
+
class RobustAction:
"""Represents a file operation to be accomplished later"""
@@ -243,7 +253,8 @@ class Robust:
"""
try: return function(*args)
except (EnvironmentError, SkipFileException, DSRPPermError,
- RPathException, Rdiff.RdiffException), exc:
+ RPathException, Rdiff.RdiffException,
+ C.UnknownFileTypeError), exc:
TracebackArchive.add()
if (not isinstance(exc, EnvironmentError) or
(errno.errorcode[exc[0]] in