deploy-rs icon indicating copy to clipboard operation
deploy-rs copied to clipboard

wrong arguments given to ssh when some ssh argument specified in ssh-opts contains space

Open contrun opened this issue 4 years ago • 1 comments

Running deploy --ssh-opts='-o ProxyCommand="wstunnel --upgradePathPrefix=simple-test -L stdio:%h:%p wss://wstunnel.example.com"' '.#test' passes ["-o", "ProxyCommand=\"wstunnel", "--upgradePathPrefix=simple-test", "-L", "stdio:%h:%p", "wss://wstunnel.example.com\""] to ssh.

The current implementation just splits spaces. https://github.com/serokell/deploy-rs/blob/e5546f9c2503c26d175f08a81fc0a0f330be4cbe/src/lib.rs#L418

Instead, we should do something like shlex.split. I expect the arguments given to ssh is ssh_opts = ['-o', 'ProxyCommand=wstunnel --upgradePathPrefix=simple-test -L stdio:%h:%p wss://wstunnel.example.com'] instead of ssh_opts = ["-o", "ProxyCommand=\"wstunnel", "--upgradePathPrefix=simple-test", "-L", "stdio:%h:%p", "wss://wstunnel.example.com\""].

This may be usefule. https://users.rust-lang.org/t/crate-for-splitting-a-string-like-bash/40062

contrun avatar Sep 26 '21 04:09 contrun

I noticed that as well, my --ssh-opts=" -p 22 " got ignored.

teto avatar Dec 29 '22 16:12 teto