Merge pull request #8329 from rdolejsi/devel

file: prevent replace failure when overwriting empty directory with hard or soft link on force=yes
pull/4420/head
James Cammarata 2014-07-29 11:58:32 -05:00
commit 912674bd2b
1 changed files with 2 additions and 0 deletions

View File

@ -233,6 +233,8 @@ def main():
# try to replace atomically # try to replace atomically
tmppath = '/'.join([os.path.dirname(path), ".%s.%s.tmp" % (os.getpid(),time.time())]) tmppath = '/'.join([os.path.dirname(path), ".%s.%s.tmp" % (os.getpid(),time.time())])
try: try:
if prev_state == 'directory' and (state == 'hard' or state == 'link'):
os.rmdir(path)
if state == 'hard': if state == 'hard':
os.link(src,tmppath) os.link(src,tmppath)
else: else: