-
Notifications
You must be signed in to change notification settings - Fork 28
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
Scp: quoting errors with spaces in dest filename #94
Comments
Well, thanks for pointing out this error. You can try to have a PR to fix it if you want. BRs. |
Hi @HsuJv, thanks for the quick response. I had a quick play with getting the project's tests running but after initially noticing I needed to set some But since I only care about With that in mind I'll probably leave it but hopefully the test cases I listed in the issue are useful. Just a bit of feedback on potential improvements to the experience of running tests here:
|
Some answers to your question:
|
Do you not normally run the tests locally at all, and just let the github agent run them for you? I guess that works, but having some minimal setup for running tests locally would make it a bit easier to develop as you wouldn't have to keep pushing unfinished changes to github to test while writing the code and the feedback loop would be that much faster. I had configured some of those Since I ran into a few additional issues (which I raised and I see you've spotted them) I've gone back to using the |
I had a virtual machine that uses BRs |
When trying to upload individual files with scp, I ran into some
unknown error
s being reported. Looking at the source, it looks like this is the host sending a response packet which the library doesn't recognise, after sending the initial request to start an scp transfer.I was transferring relatively large files and with spaces in filenames and directories so I did a few tests to narrow down the actual problem. Filesize isn't important, nor is local filename, but remote filename seems to have issues if there are spaces.
I haven't managed to construct a very simple test case which producesI have identified several which produceunknown error
, butambiguous target
which seem to be errors in the client:For this test setup I created
"/tmp/foo bar"
on the remote host. I also tried this test with raw strings and by constructing paths withPath::new
first to rule out issues there, but it behaves the same in both cases.Results were:
You can see I can fix the issue manually by escaping any spaces in the remote path, but especially given I'm actually trying to pass it a
Path
I'd expect any necessary escaping to be handled by the library, as aPath
like/tmp/foo bar
correctly identifies the target.I'm not very familiar with the low-level SSH / SCP protocol here but I'm assuming this library is failing to correctly quote it in the way the protocol desires and failing in these edge cases.
If you're open to PRs I might see if I can fix this issue myself and add my test cases above to the unit tests; I see you've tested recursive uploads, implicit target dir, etc. but not any edgecases around funny filenames. I ran into this while working on a little project to learn Rust so this seems like a straightforward issue for me to tackle while I'm here.
EDIT:
I identified how to get
unknown error
, as well; it's if the destination path contains brackets:...and again, backslashing fixes them.
The text was updated successfully, but these errors were encountered: