From 7b4584f86cfc36862db9c92eaa0d28a178e9e31c Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Sat, 31 Aug 2019 13:02:17 -0500 Subject: [PATCH] ssh: stat -> lstat --- dvc/remote/ssh/connection.py | 4 ++-- tests/unit/remote/ssh/test_connection.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dvc/remote/ssh/connection.py b/dvc/remote/ssh/connection.py index 16f74c2d5..039652e61 100644 --- a/dvc/remote/ssh/connection.py +++ b/dvc/remote/ssh/connection.py @@ -60,13 +60,13 @@ class SSHConnection: def st_mode(self, path): with ignore_file_not_found(): - return self.sftp.stat(path).st_mode + return self.sftp.lstat(path).st_mode return 0 def getsize(self, path): with ignore_file_not_found(): - return self.sftp.stat(path).st_size + return self.sftp.lstat(path).st_size return 0 diff --git a/tests/unit/remote/ssh/test_connection.py b/tests/unit/remote/ssh/test_connection.py index ae79d4d92..cadba03f2 100644 --- a/tests/unit/remote/ssh/test_connection.py +++ b/tests/unit/remote/ssh/test_connection.py @@ -81,7 +81,9 @@ def test_walk(tmp_path, ssh): reason="Only works on OSX (because of APFS)") def test_reflink(chdir_tmp, foo, ssh): ssh.reflink("foo", "bar") - assert System.is_reflink(bar_path) + assert filecmp.cmp("foo", "bar") + assert not System.is_symlink("bar") + assert not System.is_hardlink("bar") @pytest.mark.skip(reason="MockSSH doesn't support symlinks") def test_symlink(chdir_tmp, foo, ssh):