Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTP protocol: The remote path is ignored and begins to download from root. #80

Closed
AdamJonsson opened this issue Dec 23, 2017 · 26 comments
Closed

Comments

@AdamJonsson
Copy link

AdamJonsson commented Dec 23, 2017

Expected Behaviour

I am expecting the same result as when I am using the SFTP protocol, the download command is only getting the files from the remote path.

Actual Behaviour

When I am using the SFTP protocol everything works fine. But when I am switching to the FTP protocol and beginning to download the files, it is getting all the files from the root.

An example is that I want to download the files from the following directory: "/home/workspace/a". I set the remotePath to the above path but when I start the download, it is getting the files from the root.

Also, when it is getting the files from the root, it is saving the files in the parent folder relatively to the context path.

I have tested two diffrent servers to connect to and the same problem occurs.

Steps to Reproduce the Problem

  1. Use the FTP protocol.
  2. Specify the remote path (Not the root).
    3 Download the files to a folder on the computer.

Requisites (important to diagnose the problem!)

Extension Logs

[info]: config at /Users/adamjonsson/Desktop/ElimTest {
"host": "",
"port": 21,
"username": "
",
"password": "",
"protocol": "ftp",
"agent": null,
"privateKeyPath": null,
"passphrase": null,
"passive": false,
"interactiveAuth": false,
"remotePath": "/www/",
"uploadOnSave": false,
"syncMode": "update",
"watcher": {
"files": false,
"autoUpload": false,
"autoDelete": false
},
"ignore": [
"/Users/adamjonsson/Desktop/ElimTest/
/.vscode/
",
"/Users/adamjonsson/Desktop/ElimTest/
/.git/",
"/Users/adamjonsson/Desktop/ElimTest/
/.DS_Store",
"/www/
/.vscode/",
"/www/
/.git/",
"/www/
*/.DS_Store"
],
"context": "/Users/adamjonsson/Desktop/ElimTest"
}

[debug]: task: download /Users/adamjonsson/Desktop/ElimTest
[debug]: conncet to remote

End of log. After the sftp-plugin have dowloaded almost every folder from the root directory it is getting stuck at some random folder.

Specifications

  • Version: 0.9.5
  • Platform: macOS 10.13.2
@liximomo
Copy link
Owner

The logs are insufficient. I need full logs.

@smspivak
Copy link

Same problem

@liximomo
Copy link
Owner

Please provide me the logs.

@smspivak
Copy link

[info]: config at /home/home/projects/****************** {
"protocol": "ftp",
"host": "",
"port": 21,
"username": "
",
"password": "",
"agent": null,
"privateKeyPath": null,
"passphrase": null,
"interactiveAuth": false,
"secure": false,
"secureOptions": null,
"passive": false,
"remotePath": "/www/
",
"uploadOnSave": true,
"syncMode": "full",
"ignore": [
"/.vscode/",
"/.git/
",
"/.DS_Store",
"/node_modules/
",
"/src/",
".gitignore",
".gulpfile.js",
"package-lock.json",
"package.json",
"phpcs.xml.dist",
"ToDo"
],
"watcher": {
"files": "
",
"autoUpload": true,
"autoDelete": true
},
"context": "/home/home/projects/******************"
}

[debug]: task: remove /www/******************/.git/index.lock
[debug]: connect to remote

[debug]: task: upload /home/home/projects/******************/.git/index.lock

[debug]: task: remove /www//.git/index.lock
[debug]:
ignore: /www/
/.git/index.lock
[debug]:
ignore: /home/home/projects//.git/index.lock
[debug]:
ignore: /www/
/.git/index.lock

[debug]: task: download /home/home/projects/******************
[debug]:

target: /www/******************
context: transmission dir
error: Error: Timeout
at makeError (/home/smspivak/.vscode-insiders/extensions/liximomo.sftp-1.0.2/node_modules/ftp/lib/connection.js:1067:13)
at Parser. (/home/smspivak/.vscode-insiders/extensions/liximomo.sftp-1.0.2/node_modules/ftp/lib/connection.js:113:25)
at emitTwo (events.js:106:13)
at Parser.emit (events.js:194:7)
at Parser._write (/home/smspivak/.vscode-insiders/extensions/liximomo.sftp-1.0.2/node_modules/ftp/lib/parser.js:59:10)
at doWrite (_stream_writable.js:329:12)
at writeOrBuffer (_stream_writable.js:315:5)
at Parser.Writable.write (_stream_writable.js:241:11)
at Socket.ondata (/home/smspivak/.vscode-insiders/extensions/liximomo.sftp-1.0.2/node_modules/ftp/lib/connection.js:273:20)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at readableAddChunk (_stream_readable.js:178:18)
at Socket.Readable.push (_stream_readable.js:136:10)
at TCP.onread (net.js:560:20)

[debug]: connect end
[debug]: connect close

@liximomo
Copy link
Owner

liximomo commented Feb 1, 2018

The logs seem are unrelated to your problems.

@xVinniVx
Copy link

xVinniVx commented Feb 2, 2018

I have the same problem.
When using FTP protocol and setting remotPath to (for example): /domains/projects/public_html/cms
sync and download / upload is downloading ALL folders from /domains

It's just broken.

Tested on many machines.

@liximomo
Copy link
Owner

liximomo commented Feb 3, 2018

@xVinniVx Please try debug-pacakge and send me the logs.

@andreyorst
Copy link

andreyorst commented Mar 20, 2018

same here with ftp protocol. Yet ftp-simple plugin works fine.
God, my home dir is now full of trash from remote.

@liximomo
Copy link
Owner

@andreyorst Could you help me to debug this problem? I will make a debug-package with verbose logs. You only need to reproduce the problem and give me the logs.

@andreyorst
Copy link

@liximomo sure!

@liximomo
Copy link
Owner

@andreyorst Thanks! Please try with debug-pacakge and send me the logs.

@andreyorst
Copy link

@liximomo I've replaced all occurences of usermane to "usermane". This is not full log, because there were TON of data, and I couldn't even copy it, but at the end of the log you'll see that it started listing /home/.* dirs.
log.txt

@liximomo
Copy link
Owner

@andreyorst I fixed a possible bug! Please try debug-pacakge again see if it gets solved.

@andreyorst
Copy link

@liximomo I'm currently little busy, so I'll try that in a couple of hours

@andreyorst
Copy link

@liximomo Well now I't isn'y spamming all root content in my $HOME, but it's not working either.

[debug] run command download {"$mid":1,"fsPath":"/home/aorst/Downloads/xzzxczx","external":"file:///home/aorst/Downloads/xzzxczx","path":"/home/aorst/Downloads/xzzxczx","scheme":"file"} [{"$mid":1,"fsPath":"/home/aorst/Downloads/xzzxczx","external":"file:///home/aorst/Downloads/xzzxczx","path":"/home/aorst/Downloads/xzzxczx","scheme":"file"}]
[debug] < 220 (vsFTPd 2.2.2)
[debug] > USER username
[debug] < 331 Please specify the password.
[debug] > PASS ******
[debug] < 230 Login successful.
[debug] > FEAT
[debug] < 211-Features:\r\n EPRT
[debug] <  EPSV\r\n MDTM\r\n PASV\r\n REST STREAM\r\n SIZE
[debug] <  TVFS\r\n UTF8\r\n211 End
[debug] > TYPE I
[debug] < 200 Switching to Binary mode.
[info] connected
[debug] lstat /home/username/ftp_base
[debug] > PASV
[debug] < 227 Entering Passive Mode (192,168,175,44,201,159).
[debug] > LIST /home/username
[debug] < 150 Here comes the directory listing.
[debug] < 226 Directory send OK.
[debug] list /home/username/ftp_base
[debug] > PASV
[debug] < 227 Entering Passive Mode (192,168,175,44,162,169).
[debug] > LIST -al /home/username/ftp_base
[debug] < 150 Here comes the directory listing.
[debug] < 226 Directory send OK.
[debug] list /home/username/ftp_base/can_error_state
[debug] > PASV
[debug] list /home/username/ftp_base/can_overwrite_test
[debug] list /home/username/ftp_base/can_remote_test
[debug] list /home/username/ftp_base/can_self_test
[debug] < 227 Entering Passive Mode (192,168,175,44,192,30).
[debug] > LIST -al /home/username/ftp_base/can_error_state
[debug] < 150 Here comes the directory listing.
[debug] < 226 Directory send OK.
[debug] > PASV
[debug] < 227 Entering Passive Mode (192,168,175,44,141,211).
[debug] > LIST -al /home/username/ftp_base/can_overwrite_test
[debug] < 150 Here comes the directory listing.
[debug] < 226 Directory send OK.
[debug] > PASV
[debug] < 227 Entering Passive Mode (192,168,175,44,161,94).
[debug] > LIST -al /home/username/ftp_base/can_remote_test
[debug] < 150 Here comes the directory listing.
[debug] < 226 Directory send OK.
[debug] > PASV
[debug] < 227 Entering Passive Mode (192,168,175,44,104,203).
[debug] list /home/username/ftp_base/can_remote_test/SECOND_CHIP
[debug] > PASV
[debug] list /home/username/ftp_base/can_remote_test/rtlrun.two
[debug] < 227 Entering Passive Mode (192,168,175,44,77,183).
[debug] > LIST -al /home/username/ftp_base/can_remote_test/SECOND_CHIP
[debug] < 150 Here comes the directory listing.
[debug] < 226 Directory send OK.
[debug] > LIST -al /home/username/ftp_base/can_self_test
[debug] < 425 Use PORT or PASV first.
[debug] > PASV
[error]: Error: Use PORT or PASV first.
	at makeError (/home/aorst/.vscode/extensions/liximomo.sftp-1.1.3/node_modules/ftp/lib/connection.js:1067:13)
	at Parser.<anonymous> (/home/aorst/.vscode/extensions/liximomo.sftp-1.1.3/node_modules/ftp/lib/connection.js:113:25)
	at emitTwo (events.js:106:13)
	at Parser.emit (events.js:194:7)
	at Parser._write (/home/aorst/.vscode/extensions/liximomo.sftp-1.1.3/node_modules/ftp/lib/parser.js:59:10)
	at doWrite (_stream_writable.js:329:12)
	at writeOrBuffer (_stream_writable.js:315:5)
	at Parser.Writable.write (_stream_writable.js:241:11)
	at Socket.ondata (/home/aorst/.vscode/extensions/liximomo.sftp-1.1.3/node_modules/ftp/lib/connection.js:273:20)
	at emitOne (events.js:96:13)
[debug] < 227 Entering Passive Mode (192,168,175,44,119,186).
[debug] > LIST -al /home/username/ftp_base/can_remote_test/rtlrun.two
[debug] < 150 Here comes the directory listing.
[debug] < 226 Directory send OK.
[debug] list /home/username/ftp_base/can_remote_test/rtlrun.two/Tests
[debug] > PASV
[debug] list /home/username/ftp_base/can_remote_test/rtlrun.two/Tests2
[debug] < 227 Entering Passive Mode (192,168,175,44,154,26).
[debug] > LIST -al /home/username/ftp_base/can_remote_test/rtlrun.two/Tests
[debug] < 150 Here comes the directory listing.
[debug] < 226 Directory send OK.
[debug] > PASV
[debug] < 227 Entering Passive Mode (192,168,175,44,43,249).
[debug] > LIST -al /home/username/ftp_base/can_remote_test/rtlrun.two/Tests2
[debug] < 150 Here comes the directory listing.
[debug] < 226 Directory send OK.
[debug] < 200 NOOP ok.
[debug] < 200 NOOP ok.

And endless NOOP messages then.
And i'm not sure what it suppose to mean:
image

@liximomo
Copy link
Owner

liximomo commented Mar 20, 2018

Try to config "passive": true.

@andreyorst
Copy link

andreyorst commented Mar 20, 2018

Seems to work now!

Edit: Or not. This error appeared again. Even with "passive": true

My current config is:

{
    "protocol": "ftp",
    "passive": true,
    "port": 21,
    "host": "ftp",
    "username": "username",
    "password": "password",
    "remotePath": "/home/username/ftp_base",
    "uploadOnSave": true,
    "ignore": [
        ".vnc",
        ".vscode",
        ".git",
        "*.o",
        ".DS_Store"
    ]
}

@andreyorst
Copy link

andreyorst commented Mar 20, 2018

well, I've figured out that this errors are random. If I try to download again it may work. Actually now I able to download a remote directory, edit file and upload it back, but downloading doesn't always work.

Edit: I discovered that i need to hit download several times to get all remote content Is it normal?

@liximomo
Copy link
Owner

liximomo commented Mar 20, 2018

Set concurrency: 1 in sftp.json may prevent this error occurs.

@andreyorst
Copy link

Actually it is still here. And now it can't set connection. [sftp] Unable to make data connection( Error: connect ECONNRESET ***.***.***.**:*****) Notepad++ uses mostly the same config (ports, protocol, host, username etc) and works.

@liximomo
Copy link
Owner

liximomo commented Mar 20, 2018

Set passive back to false. And:

"ECONNRESET" means the other side of the TCP conversation abruptly closed its end of the connection.

I believe this error is just a random network problem.

@andreyorst
Copy link

Set passive back to false.

Ok

In terms of issue topic

But when I am switching to the FTP protocol and beginning to download the files, it is getting all the files from the root.

01dcbc9 seems to fix that, and my download problems may be a different story.

@liximomo
Copy link
Owner

Thanks for your help! This issue can be closed now. 🎉🎉🎉

@andreyorst
Copy link

@liximomo when extension will be updated in marketplace?

@liximomo
Copy link
Owner

@andreyorst The extension has updated in the marketplace.

@andreyorst
Copy link

Great! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants