[New-bugs-announce] [issue41029] parallel sftp from local to remote file creates empty directory in home path

Suganya Vijayaraghavan report at bugs.python.org
Fri Jun 19 01:05:21 EDT 2020


New submission from Suganya Vijayaraghavan <sugan5433 at gmail.com>:

I was using parallelSSHClient - copy_to_file

The code was like below,
greenlets = client.copy_file('/tmp/logs', '/home/sugan/remote_copy/', recurse=True)

>From /tmp/logs, I'm copying to my home path(/home/sugan) under the name 'remote_copy'.

The copying is as expected but during copying the destination path is starting with '/' then after '/' what is the first directory (in my case it 'home') a empty directory 'home' is getting creating in my home path(/home/sugan)

output:
-rw-r--r-- 1 sugan sugan 420 Jun 19 00:15 sftp.py
drwxr-xr-x 3 sugan sugan 21  Jun 19 00:17 home

pwd: /home/sugan

Consider now my script is changed as,
greenlets = client.copy_file('/tmp/logs', '/opt/user1/remote_copy/', recurse=True)

My home path is - /home/sugan but I'm copying to /opt/user1. So now when I executed the script. The script creates a empty directory 'opt' in my home path(/home/sugan).


output:
-rw-r--r-- 1 sugan sugan 420 Jun 19 00:19 sftp.py
drwxr-xr-x 3 sugan sugan 21  Jun 19 00:22 opt

pwd: /home/sugan

So whatever destination path is given and the path startswith '/' then the first directory of the path is getting created in home path. If a same directory already exists in home path then it is ignored.

And if the destination path is a relative path from home then the parallelSSHClient.copy_file works as expected.



My concern is generally we use absolute path for all... So each an empty directory is getting created in home.

----------
components: Library (Lib)
messages: 371845
nosy: sugan19
priority: normal
severity: normal
status: open
title: parallel sftp from local to remote file creates empty directory in home path
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41029>
_______________________________________


More information about the New-bugs-announce mailing list