{"action":"created","issue":{"url":"https://api.github.com/repos/dokku/dokku/issues/345","repository_url":"https://api.github.com/repos/dokku/dokku","labels_url":"https://api.github.com/repos/dokku/dokku/issues/345/labels{/name}","comments_url":"https://api.github.com/repos/dokku/dokku/issues/345/comments","events_url":"https://api.github.com/repos/dokku/dokku/issues/345/events","html_url":"https://github.com/dokku/dokku/issues/345","id":23151398,"number":345,"title":"Quotes over ssh not working","user":{"login":"plietar","id":1489775,"avatar_url":"https://avatars.githubusercontent.com/u/1489775?v=3","gravatar_id":"","url":"https://api.github.com/users/plietar","html_url":"https://github.com/plietar","followers_url":"https://api.github.com/users/plietar/followers","following_url":"https://api.github.com/users/plietar/following{/other_user}","gists_url":"https://api.github.com/users/plietar/gists{/gist_id}","starred_url":"https://api.github.com/users/plietar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plietar/subscriptions","organizations_url":"https://api.github.com/users/plietar/orgs","repos_url":"https://api.github.com/users/plietar/repos","events_url":"https://api.github.com/users/plietar/events{/privacy}","received_events_url":"https://api.github.com/users/plietar/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2013-11-22T16:57:10Z","updated_at":"2016-07-18T15:15:01Z","closed_at":"2014-11-16T03:13:39Z","body":"Using quotes as part of an ssh command is broken : \r\n\r\nOver SSH:\r\n* `ssh -t dokku@dokku.me run app echo Hello` prints Hello\r\n* `ssh -t dokku@dokku.me run app bash -c \"echo Hello\"` prints an empty newline.\r\n* `ssh -t dokku@dokku.me run app 'bash -c \"echo Hello\"'` fails\r\n* `ssh -t dokku@dokku.me run app bash -c \\\"echo Hello\\\"` fails\r\n\r\nThis is the error in the 3rd and 4th cases :\r\n\r\n    Hello\": -c: line 0: unexpected EOF while looking for matching `\"'\r\n    Hello\": -c: line 1: syntax error: unexpected end of file\r\n\r\nAs a comparaison, on a non dokku ssh server (using bash as remote shell) :\r\n* `ssh -t host echo Hello` prints Hello\r\n* `ssh -t host bash -c \"echo Hello\"` prints an empty newline\r\n* `ssh -t host 'bash -c \"echo Hello\"'` prints Hello\r\n* `ssh -t host bash -c \\\"echo Hello\\\"` prints Hello\r\n\r\n\r\nThe second case is because the double quotes are interpreted by the local shell.\r\nThe command ends up as `bash -c echo Hello`, which runs echo with no args, and `Hello` is ignored.\r\n\r\nAs far as a know, this is not related to the run command, docker or pluginhook at all.\r\nI just wanted the simplest use case, but it could be reproduced easily with other commands, part of the main `dokku` script.\r\n\r\nThe reason I've found is that `SSH_ORIGINAL_COMMAND`, used by sshcommand to pass arguments to dokku, does not give access to split arguments by default, but just the whole string. The remote command is then responsible for splitting it up, using \"it's own\" rules, which bash does in the second example.\r\n\r\nHere are some links to posts and other similar projects dealing with the issue, and how to solve it, which could be used :\r\n* http://www.ict.griffith.edu.au/anthony/info/apps/ssh.hints\r\n* http://www.hackinglinuxexposed.com/tools/authprogs/src/authprogs\r\n* https://github.com/GNOME/sysadmin-bin/blob/e296a647fa016d5802a14e6aea070d0b4a6dae36/run-git-or-special-cmd\r\n* https://github.com/GNOME/sysadmin-bin/blob/master/run-git-or-special-cmd (Same as the above, rewritten in python)\r\n* http://selenic.com/pipermail/mercurial-devel/2012-January/037268.html\r\n\r\nThis should be considered as low priority for now."},"comment":{"url":"https://api.github.com/repos/dokku/dokku/issues/comments/233359209","html_url":"https://github.com/dokku/dokku/issues/345#issuecomment-233359209","issue_url":"https://api.github.com/repos/dokku/dokku/issues/345","id":233359209,"user":{"login":"ebeigarts","id":8155,"avatar_url":"https://avatars.githubusercontent.com/u/8155?v=3","gravatar_id":"","url":"https://api.github.com/users/ebeigarts","html_url":"https://github.com/ebeigarts","followers_url":"https://api.github.com/users/ebeigarts/followers","following_url":"https://api.github.com/users/ebeigarts/following{/other_user}","gists_url":"https://api.github.com/users/ebeigarts/gists{/gist_id}","starred_url":"https://api.github.com/users/ebeigarts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebeigarts/subscriptions","organizations_url":"https://api.github.com/users/ebeigarts/orgs","repos_url":"https://api.github.com/users/ebeigarts/repos","events_url":"https://api.github.com/users/ebeigarts/events{/privacy}","received_events_url":"https://api.github.com/users/ebeigarts/received_events","type":"User","site_admin":false},"created_at":"2016-07-18T15:15:00Z","updated_at":"2016-07-18T15:15:00Z","body":"@josegonzalez yes, I am using `-t`"}}
{"actor":{"display_login":"ebeigarts"}}