summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2004-05-31 20:08:52 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2004-05-31 20:08:52 +0000
commitafa7df4139422358570fbc4da7d63fb5fd8939ad (patch)
treedeeabd87d4b45ba461be2a74677deee9888027ce
parentbceeb65cee1e0190df06d00db7f250e485d1623f (diff)
downloadrdiff-backup-afa7df4139422358570fbc4da7d63fb5fd8939ad.tar.gz
Fixed obscure hard link bug
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@539 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/CHANGELOG4
-rw-r--r--rdiff-backup/rdiff_backup/Hardlink.py13
2 files changed, 15 insertions, 2 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG
index 0936943..5b94f39 100644
--- a/rdiff-backup/CHANGELOG
+++ b/rdiff-backup/CHANGELOG
@@ -15,6 +15,10 @@ Fix for restoring certain directories when not run as root.
Now when determining group permissions check supplementary groups as
well as main group. (Bug report by Ryan Castle.)
+Fixed bug which could cause crash when backing up 3 or more hard
+linked files and the first gets deleted during processing. (Thanks to
+Dean Gaudet for bug report.)
+
New in v0.13.4 (2004/01/31)
---------------------------
diff --git a/rdiff-backup/rdiff_backup/Hardlink.py b/rdiff-backup/rdiff_backup/Hardlink.py
index 81472b2..8b03d26 100644
--- a/rdiff-backup/rdiff_backup/Hardlink.py
+++ b/rdiff-backup/rdiff_backup/Hardlink.py
@@ -32,7 +32,7 @@ source side should only transmit inode information.
from __future__ import generators
import cPickle
-import Globals, Time, rpath, log, robust
+import Globals, Time, rpath, log, robust, errno
# The keys in this dictionary are (inode, devloc) pairs. The values
# are a pair (index, remaining_links, dest_key) where index is the
@@ -113,5 +113,14 @@ def link_rp(diff_rorp, dest_rpath, dest_root = None):
"""Make dest_rpath into a link using link flag in diff_rorp"""
if not dest_root: dest_root = dest_rpath # use base of dest_rpath
dest_link_rpath = dest_root.new_index(diff_rorp.get_link_flag())
- dest_rpath.hardlink(dest_link_rpath.path)
+ try: dest_rpath.hardlink(dest_link_rpath.path)
+ except EnvironmentError, exc:
+ # This can happen if the source of dest_link_rpath was deleted
+ # after it's linking info was recorded but before
+ # dest_link_rpath was written.
+ print "$$$$$$$", exc, exc[0], errno.errorcode[exc[0]]
+ if errno.errorcode[exc[0]] == 'ENOENT':
+ dest_rpath.touch() # This will cause an UpdateError later
+ else: raise Exception("EnvironmentError '%s' linking %s to %s" %
+ (exc, dest_rpath.path, dest_link_rpath.path))