{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/13179","labels_url":"https://api.github.com/repos/ansible/ansible/issues/13179/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/13179/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/13179/events","html_url":"https://github.com/ansible/ansible/issues/13179","id":117048252,"number":13179,"title":"ansible_shell_type and make_become_cmd are at odds","user":{"login":"amenonsen","id":23628,"avatar_url":"https://avatars.githubusercontent.com/u/23628?v=3","gravatar_id":"","url":"https://api.github.com/users/amenonsen","html_url":"https://github.com/amenonsen","followers_url":"https://api.github.com/users/amenonsen/followers","following_url":"https://api.github.com/users/amenonsen/following{/other_user}","gists_url":"https://api.github.com/users/amenonsen/gists{/gist_id}","starred_url":"https://api.github.com/users/amenonsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amenonsen/subscriptions","organizations_url":"https://api.github.com/users/amenonsen/orgs","repos_url":"https://api.github.com/users/amenonsen/repos","events_url":"https://api.github.com/users/amenonsen/events{/privacy}","received_events_url":"https://api.github.com/users/amenonsen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-16T04:09:23Z","updated_at":"2015-11-17T14:24:08Z","closed_at":null,"body":"While investigating #12290, I found that if you set ``ansible_shell_type=csh``, then we construct a csh-syntax command line (e.g. using \"``env A=b python…``\" and \"``>& /dev/null``\"), which works if you're not using privilege escalation. But ``make_become_cmd`` doesn't know about ``ansible_shell_type``, so it ends up issuing ``sh -c '<csh-syntax-command>'``, which results in \"bad fd\" errors from bash (which doesn't accept ``>& /dev/null``)."},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/157384591","html_url":"https://github.com/ansible/ansible/issues/13179#issuecomment-157384591","issue_url":"https://api.github.com/repos/ansible/ansible/issues/13179","id":157384591,"user":{"login":"amenonsen","id":23628,"avatar_url":"https://avatars.githubusercontent.com/u/23628?v=3","gravatar_id":"","url":"https://api.github.com/users/amenonsen","html_url":"https://github.com/amenonsen","followers_url":"https://api.github.com/users/amenonsen/followers","following_url":"https://api.github.com/users/amenonsen/following{/other_user}","gists_url":"https://api.github.com/users/amenonsen/gists{/gist_id}","starred_url":"https://api.github.com/users/amenonsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amenonsen/subscriptions","organizations_url":"https://api.github.com/users/amenonsen/orgs","repos_url":"https://api.github.com/users/amenonsen/repos","events_url":"https://api.github.com/users/amenonsen/events{/privacy}","received_events_url":"https://api.github.com/users/amenonsen/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T14:24:08Z","updated_at":"2015-11-17T14:24:08Z","body":"It does unfortunately mean that we'll be issuing commands like this:\r\n```\r\nsh -c 'sudo root sh -c '\"'\"'echo BECOME-SUCCESS-XXX; '\"'\"'\"'\"'\"'\"'\"'\"'(/usr/bin/python -c '\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1();\\\r\nafile = open(\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'/tmp/x'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\", \"rb\")\\\r\nbuf = afile.read(BLOCKSIZE)\\\r\nwhile len(buf) > 0:\\\r\n\thasher.update(buf)\\\r\n\tbuf = afile.read(BLOCKSIZE)\\\r\nafile.close()\\\r\nprint(hasher.hexdigest())'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"' 2>/dev/null)'\"'\"'\"'\"'\"'\"'\"'\"''\"'\"''\r\n```\r\n\r\n…but I can't see what else to do, unless we ban csh altogether or find a smarter quoter than ``pipes.quote()``."}}