Handle socket files

This commit is contained in:
2021-11-15 22:36:09 +03:00
parent 04692be42d
commit 2631b78d4d
3 changed files with 99 additions and 47 deletions

View File

@@ -1,6 +1,7 @@
import os
import os.path
import shutil
import socket
import string
import tempfile
import unittest
@@ -256,6 +257,16 @@ class TestRsync(CommonFSTestCase):
assert os.path.lexists(dst_path)
assert os.path.isdir(dst_path)
def test_src_is_socket(self):
src_spath = self.create_file(self.src_dir)
dst_spath = os.path.join(self.dst_dir, self.relpath(src_spath))
os.unlink(src_spath)
sock = socket.socket(socket.AF_UNIX)
sock.bind(src_spath)
all(fs.rsync(self.src_dir, self.dst_dir))
assert not os.path.lexists(dst_spath)
def test_src_dst_same_inode(self):
src_fpath = self.create_file(self.src_dir)
dst_fpath = os.path.join(self.dst_dir, self.relpath(src_fpath))