3 ms·
Oh wow, good to know it's that broken. I still had figuring out how to properly quote SSH command lines on my todo list because I've got some shell wrappers tha
by unilynx 3y ago
Oh wow, good to know it's that broken. I still had figuring out how to properly quote SSH command lines on my todo list because I've got some shell wrappers that try to transparently execute stuff inside containers on remote machines and they weren't dealing right with spaces and quotes (think trying to build `remote @server sql <statement>`)
It's weird that this has been known for over a decade, and noone ever added a 'pass on the argv[] array unchanged' in all that time
Now that I know I can't fix this in stock openSSH I think I'll just look into throwing argv[] into a base64 encoded JSON array and somehow have jq fix and exec it on the other end.
- aidenn0 3y agoIf you use bash on both sides, you can use printf for any words in the command that need quoting (or all words if you are writing a script): ssh foo@bar baz "$(printf '%q\n' "something that needs $quoting") For cases where one or both sides are not bash, but still POSIX like, it's relatively easy to write a function that uses single quotes; just replace every single quote with '\'' before wrapping in single quotes.