#545: Use ssh ProxyCommand instead of multiple ssh commands --------------------------+------------------------------------------------- Reporter: eschnett | Owner: eschnett Type: enhancement | Status: review Priority: major | Milestone: Component: SimFactory | Version: Resolution: | Keywords: --------------------------+-------------------------------------------------
Comment (by hinder):
At the operating system level, new processes are started via execp (and variants). A process receives a list of arguments which are C strings - i.e. null-terminated. When launching a process from the shell, the user has to be able to make a syntactic distinction between the content of the argument and the separators indicating different arguments. So in addition to the need to quote characters which would otherwise be interpreted by the shell, there is also the need to group characters into the appropriate arguments. This is done using double or single quotes so that each shell "word" is passed to the process as a separate argument. As such, it is certainly possible for one of the arguments to a process to be an empty string.
For example (in Python for ease of use, but the same would apply to any language):
#!/usr/bin/env python import sys print sys.argv
MacBook-2:~ $ ./test.py 1 2 "" 3 ['./test.py', '1', '2', '', '3']
So I weigh in on the side of Erik and say that an empty string should be quoted so that it remains an empty string when it is unquoted. This is probably a special-case, but it's important to get QuoteSafe correct, as quoting is a nightmare, and is made doubly so when it doesn't work properly!
Questions:
* Is the quoting required dependent on which shell is being used?
* Is it possible to get the shell to quote a string itself?
* Is there a standard Python way to perform quoting? Answering my own question, Stack Overflow has this to say on the matter: http://stackoverflow.com/questions/967443/python-module-to-shellquote- unshellquote. Maybe we could just use the snippet provided?