-
Notifications
You must be signed in to change notification settings - Fork 254
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
support commands/users/groups/directories with spaces or other shell characters #451
base: master
Are you sure you want to change the base?
Conversation
f0124b7
to
18e44f9
Compare
18e44f9
to
3bc7ade
Compare
This is a breaking change to the behavior of SSHKit. I won't be able to accept this PR as is. However there are still improvements here that I can definitely get behind, if you'd like to split them off into another PR. For example I like replacing the Also, how about adding to the documentation instead of changing the behavior? For example the docs could offer advice about using capture "sh", "-c", "touch 1 && echo 1".shellescape |
Afaik ruby convention is that passing arrays to system calls is supposed to escape them, that's how system/exec/sh/IO.popen etc work. Not doing that is also violating the users expectation:
Agreed that this is not a simple patch, and will need a minor or major bump, but I think it's the obvious/expected way it should work, otherwise it's just "random bugs" since things like adding a user/group will suddenly change what the command means. (also |
#452 for just the sprintf change |
/cc @leehambley since your name is all over command.rb :D |
#453 for just the things I'd consider bugfixes |
I don't think the comparison holds up exactly. In Ruby's Arguments about "correctness" aside, SSHKit is a mature library (it has been >5 years since 1.0.0) and as a maintainer I personally place more value on keeping existing users happy and free from surprising changes. I will defer to @leehambley since he probably has more experience in this particular area. Thanks for splitting up into separate PRs. 👍 |
this should execute "sh -c touch\ 1 &&\ echo\ 1" and not
sh -c touch 1
andecho 1
... same issue for directories/users/groups
... also making user and group use the same form of escaping
... I'm pretty sure
nohup
should also dosh -c
to avoid funky issues/fyi @eatwithforks @adammw @jonmoter this is why we saw crazy issues :D
... cap-devs, please let me know if this looks correct, or if I understood something wrong