Commit 18cba59e authored by owsla's avatar owsla

Fix for crash when deleting read-only files on Windows. (Patch from Josh Nisly)


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@966 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent c80ac155
New in v1.2.3 (????/??/??) New in v1.2.3 (????/??/??)
--------------------------- ---------------------------
Fix for crash when deleting read-only files on Windows. (Patch from Josh Nisly)
Fix for Python 2.2 in win_acls.py (Closes Savannah bug #24922). Fix for Python 2.2 in win_acls.py (Closes Savannah bug #24922).
Throttle verbosity of listattr() warning messages from 3 to 4. (Andrew Ferguson) Throttle verbosity of listattr() warning messages from 3 to 4. (Andrew Ferguson)
......
...@@ -261,6 +261,7 @@ def rename(rp_source, rp_dest): ...@@ -261,6 +261,7 @@ def rename(rp_source, rp_dest):
raise raise
# On Windows, files can't be renamed on top of an existing file # On Windows, files can't be renamed on top of an existing file
rp_source.conn.os.chmod(rp_dest.path, 0700)
rp_source.conn.os.unlink(rp_dest.path) rp_source.conn.os.unlink(rp_dest.path)
rp_source.conn.os.rename(rp_source.path, rp_dest.path) rp_source.conn.os.rename(rp_source.path, rp_dest.path)
...@@ -1055,7 +1056,17 @@ class RPath(RORPath): ...@@ -1055,7 +1056,17 @@ class RPath(RORPath):
except os.error: except os.error:
if Globals.fsync_directories: self.fsync() if Globals.fsync_directories: self.fsync()
self.conn.shutil.rmtree(self.path) self.conn.shutil.rmtree(self.path)
else: self.conn.os.unlink(self.path) else:
try: self.conn.os.unlink(self.path)
except OSError, error:
if error.errno == errno.EPERM:
# On Windows, read-only files cannot be deleted.
# Remove the read-only attribute and try again.
self.chmod(0700)
self.conn.os.unlink(self.path)
else:
raise
self.setdata() self.setdata()
def contains_files(self): def contains_files(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment