From 07a6cbf039049d3be04c329ce6adad6d2b42744e Mon Sep 17 00:00:00 2001 From: Ryo Nakamura Date: Thu, 14 Mar 2024 15:14:31 +0900 Subject: chmod after truncate and setutimes on the remote side. When the source file permission is r--r--r--, truncate and setutimes AFTER chmod fail due to permission deined. So, do chmod after truncate and setutimes. --- test/test_e2e.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/test_e2e.py b/test/test_e2e.py index e4dbe49..808558d 100644 --- a/test/test_e2e.py +++ b/test/test_e2e.py @@ -321,6 +321,21 @@ def test_dont_truncate_dst(mscp, src_prefix, dst_prefix): assert md5_before == md5_after f.cleanup() +@pytest.mark.parametrize("src_prefix, dst_prefix", param_remote_prefix) +def test_copy_readonly_file(mscp, src_prefix, dst_prefix): + """When a source file permission is r--r--r--, if chmod(r--r--r--) + runs first on the remote side, following truncate() and setutime() + fail due to permission deneid. So, run chmod() after truncate() + and setutime() + + """ + src = File("src", size = 1024 * 1024 * 128, perm = 0o444).make() + dst = File("dst") + run2ok([mscp, "-H", "-vvv", src_prefix + src.path, dst_prefix + dst.path]) + assert check_same_md5sum(src, dst) + src.cleanup() + dst.cleanup() + @pytest.mark.parametrize("src_prefix, dst_prefix", param_remote_prefix) def test_dont_make_conns_more_than_chunks(mscp, src_prefix, dst_prefix): # copy 100 files with -n 20 -I 1 options. if mscp creates 20 SSH -- cgit v1.2.3