<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">Core</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.0.0
  config file = /Users/loranger/.ansible.cfg
  configured module search path = [u'/Users/loranger/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.4.0.0/libexec/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14 (default, Sep 25 2017, 09:54:19) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]"><pre class="notranslate"><code class="notranslate">ansible 2.4.0.0
  config file = /Users/loranger/.ansible.cfg
  configured module search path = [u'/Users/loranger/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.4.0.0/libexec/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14 (default, Sep 25 2017, 09:54:19) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">DEFAULT_HOST_LIST(/Users/loranger/.ansible.cfg) = [u'/Users/loranger/.ansible/hosts']<br>
DEFAULT_REMOTE_TMP(/Users/loranger/.ansible.cfg) = $HOME/.ansible/tmp<br>
DEFAULT_ROLES_PATH(/Users/loranger/.ansible.cfg) = [u'/Users/loranger/.ansible/roles']<br>
HOST_KEY_CHECKING(/Users/loranger/.ansible.cfg) = False</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Using Ansible on macOS 10.13 to various debians</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Since I enabled a <em>Business Dropbox</em> account, Dropbox app renamed the default <code class="notranslate">Dropbox</code> folder to <code class="notranslate">Dropbox (Personnelle)</code> and my sync-ed ansible folder (<code class="notranslate">~/.ansible -&gt; ~/Dropbox (Personnelle)/OSX/mackup/.ansible</code>) now contains a space which ansible cannot deal with.<br>
As discussed on the mailinglist, I cannot rename the Dropbox folder because the app detect the change and rollback my modifications.<br>
It seems my bug could be fixed if ansible would surround the inventory folder by quotes, or escape pathes.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="❯ ansible chaos -m ping"><pre class="notranslate">❯ ansible chaos -m ping</pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="chaos | SUCCESS =&gt; {
    &quot;changed&quot;: false, 
    &quot;ping&quot;: &quot;pong&quot;
}"><pre class="notranslate">chaos <span class="pl-k">|</span> SUCCESS =<span class="pl-k">&gt;</span> {
    <span class="pl-s"><span class="pl-pds">"</span>changed<span class="pl-pds">"</span></span>: false, 
    <span class="pl-s"><span class="pl-pds">"</span>ping<span class="pl-pds">"</span></span>: <span class="pl-s"><span class="pl-pds">"</span>pong<span class="pl-pds">"</span></span>
}</pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.0.0
  config file = /Users/loranger/.ansible.cfg
  configured module search path = [u'/Users/loranger/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.4.0.0/libexec/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14 (default, Sep 25 2017, 09:54:19) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]
Using /Users/loranger/.ansible.cfg as config file
setting up inventory plugins
Parsed /Users/loranger/.ansible/hosts/composer inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/dujour.conf inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/hosts inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/northern.conf inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/perso.conf inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/phoenix.disable inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/puccia.conf inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/raspberry.conf inventory source with ini plugin
Loading callback plugin minimal of type stdout, v2.0 from /usr/local/Cellar/ansible/2.4.0.0/libexec/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc
META: ran handlers
Using module file /usr/local/Cellar/ansible/2.4.0.0/libexec/lib/python2.7/site-packages/ansible/modules/system/ping.py
&lt;chaos&gt; ESTABLISH SSH CONNECTION FOR USER: None
&lt;chaos&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o 'ControlPath=/Users/loranger/Dropbox (Personnelle)/OSX/mackup/.ansible/cp/eead3d7599' chaos '/bin/sh -c '&quot;'&quot;'( umask 77 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1508359150.0-45696358822537 `&quot; &amp;&amp; echo ansible-tmp-1508359150.0-45696358822537=&quot;` echo $HOME/.ansible/tmp/ansible-tmp-1508359150.0-45696358822537 `&quot; ) &amp;&amp; sleep 0'&quot;'&quot;''
&lt;chaos&gt; (255, '', 'command-line line 0: garbage at end of line; &quot;(Personnelle)/OSX/mackup/.ansible/cp/eead3d7599&quot;.\r\n')
chaos | UNREACHABLE! =&gt; {
    &quot;changed&quot;: false, 
    &quot;msg&quot;: &quot;Failed to connect to the host via ssh: command-line line 0: garbage at end of line; \&quot;(Personnelle)/OSX/mackup/.ansible/cp/eead3d7599\&quot;.\r\n&quot;, 
    &quot;unreachable&quot;: true
}"><pre class="notranslate"><code class="notranslate">ansible 2.4.0.0
  config file = /Users/loranger/.ansible.cfg
  configured module search path = [u'/Users/loranger/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.4.0.0/libexec/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14 (default, Sep 25 2017, 09:54:19) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]
Using /Users/loranger/.ansible.cfg as config file
setting up inventory plugins
Parsed /Users/loranger/.ansible/hosts/composer inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/dujour.conf inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/hosts inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/northern.conf inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/perso.conf inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/phoenix.disable inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/puccia.conf inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/raspberry.conf inventory source with ini plugin
Loading callback plugin minimal of type stdout, v2.0 from /usr/local/Cellar/ansible/2.4.0.0/libexec/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc
META: ran handlers
Using module file /usr/local/Cellar/ansible/2.4.0.0/libexec/lib/python2.7/site-packages/ansible/modules/system/ping.py
&lt;chaos&gt; ESTABLISH SSH CONNECTION FOR USER: None
&lt;chaos&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o 'ControlPath=/Users/loranger/Dropbox (Personnelle)/OSX/mackup/.ansible/cp/eead3d7599' chaos '/bin/sh -c '"'"'( umask 77 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1508359150.0-45696358822537 `" &amp;&amp; echo ansible-tmp-1508359150.0-45696358822537="` echo $HOME/.ansible/tmp/ansible-tmp-1508359150.0-45696358822537 `" ) &amp;&amp; sleep 0'"'"''
&lt;chaos&gt; (255, '', 'command-line line 0: garbage at end of line; "(Personnelle)/OSX/mackup/.ansible/cp/eead3d7599".\r\n')
chaos | UNREACHABLE! =&gt; {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: command-line line 0: garbage at end of line; \"(Personnelle)/OSX/mackup/.ansible/cp/eead3d7599\".\r\n", 
    "unreachable": true
}
</code></pre></div>
<p dir="auto">(Sorry to re-open my <a href="issues/31916">previous issue</a>, but it seems it's a real bug)</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">When for any reason the .ansible/ directory is inside a path <strong>with whitespaces</strong>, the 'control_path' generated by default is wrong, and thus the SSH commandline.</p>
<p dir="auto">The addition of quotes surrounding the 'control_path' inside 'ansible/plugins/connection/ssh.py' fixes the bug.</p>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">Connection plugin</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.8.2
  config file = /Users/pposca/proyectos/kipeos-devops/ansible.cfg
  configured module search path = ['/Users/pposca/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/pposca/.virtualenvs/kipeos-devops/lib/python3.7/site-packages/ansible
  executable location = /Users/pposca/.virtualenvs/kipeos-devops/bin/ansible
  python version = 3.7.3 (default, Jul  7 2019, 18:15:21) [Clang 10.0.1 (clang-1001.0.46.4)]"><pre class="notranslate"><code class="notranslate">ansible 2.8.2
  config file = /Users/pposca/proyectos/kipeos-devops/ansible.cfg
  configured module search path = ['/Users/pposca/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/pposca/.virtualenvs/kipeos-devops/lib/python3.7/site-packages/ansible
  executable location = /Users/pposca/.virtualenvs/kipeos-devops/bin/ansible
  python version = 3.7.3 (default, Jul  7 2019, 18:15:21) [Clang 10.0.1 (clang-1001.0.46.4)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="DEFAULT_HOST_LIST(/Users/pposca/proyectos/kipeos-devops/ansible.cfg) = ['/Users/pposca/proyectos/kipeos-devops/hosts']
INTERPRETER_PYTHON(/Users/pposca/proyectos/kipeos-devops/ansible.cfg) = auto"><pre class="notranslate"><code class="notranslate">DEFAULT_HOST_LIST(/Users/pposca/proyectos/kipeos-devops/ansible.cfg) = ['/Users/pposca/proyectos/kipeos-devops/hosts']
INTERPRETER_PYTHON(/Users/pposca/proyectos/kipeos-devops/ansible.cfg) = auto
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<ul dir="auto">
<li>MacOS 10.14.5</li>
<li>Mackup (so .ansible/ is a symlink to a directory with whitespaces in its path)</li>
<li>Python 3.7.3</li>
</ul>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Having .ansible inside a directory with whitespaces in its path:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible all -m ping"><pre class="notranslate"><code class="notranslate">ansible all -m ping
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mydomain.com | SUCCESS =&gt; {
    &quot;ansible_facts&quot;: {
        &quot;discovered_interpreter_python&quot;: &quot;/usr/bin/python3&quot;
    },
    &quot;changed&quot;: false,
    &quot;ping&quot;: &quot;pong&quot;
}"><pre class="notranslate"><code class="notranslate">mydomain.com | SUCCESS =&gt; {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "ping": "pong"
}
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.8.2
  config file = /Users/pposca/proyectos/kipeos-devops/ansible.cfg
  configured module search path = ['/Users/pposca/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/pposca/.virtualenvs/kipeos-devops/lib/python3.7/site-packages/ansible
  executable location = /Users/pposca/.virtualenvs/kipeos-devops/bin/ansible
  python version = 3.7.3 (default, Jul  7 2019, 18:15:21) [Clang 10.0.1 (clang-1001.0.46.4)]
Using /Users/pposca/proyectos/kipeos-devops/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /Users/pposca/proyectos/kipeos-devops/hosts as it did not pass it's verify_file() method
script declined parsing /Users/pposca/proyectos/kipeos-devops/hosts as it did not pass it's verify_file() method
auto declined parsing /Users/pposca/proyectos/kipeos-devops/hosts as it did not pass it's verify_file() method
Parsed /Users/pposca/proyectos/kipeos-devops/hosts inventory source with ini plugin
Loading callback plugin minimal of type stdout, v2.0 from /Users/pposca/.virtualenvs/kipeos-devops/lib/python3.7/site-packages/ansible/plugins/callback/minimal.py
META: ran handlers
&lt;mydomain.com&gt; ESTABLISH SSH CONNECTION FOR USER: None
&lt;mydomain.com&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o 'ControlPath=/Volumes/Apple HDD/VDrive/Dropbox/Mackup/.ansible/cp/fc95ded756' mydomain.com '/bin/sh -c '&quot;'&quot;'echo ~ &amp;&amp; sleep 0'&quot;'&quot;''
&lt;mydomain.com&gt; (255, b'', b'command-line line 0: garbage at end of line; &quot;HDD/VDrive/Dropbox/Mackup/.ansible/cp/fc95ded756&quot;.\r\n')
mydomain.com | UNREACHABLE! =&gt; {
    &quot;changed&quot;: false,
    &quot;msg&quot;: &quot;Failed to connect to the host via ssh: command-line line 0: garbage at end of line; \&quot;HDD/VDrive/Dropbox/Mackup/.ansible/cp/fc95ded756\&quot;.&quot;,
    &quot;unreachable&quot;: true
}"><pre class="notranslate"><code class="notranslate">ansible 2.8.2
  config file = /Users/pposca/proyectos/kipeos-devops/ansible.cfg
  configured module search path = ['/Users/pposca/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/pposca/.virtualenvs/kipeos-devops/lib/python3.7/site-packages/ansible
  executable location = /Users/pposca/.virtualenvs/kipeos-devops/bin/ansible
  python version = 3.7.3 (default, Jul  7 2019, 18:15:21) [Clang 10.0.1 (clang-1001.0.46.4)]
Using /Users/pposca/proyectos/kipeos-devops/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /Users/pposca/proyectos/kipeos-devops/hosts as it did not pass it's verify_file() method
script declined parsing /Users/pposca/proyectos/kipeos-devops/hosts as it did not pass it's verify_file() method
auto declined parsing /Users/pposca/proyectos/kipeos-devops/hosts as it did not pass it's verify_file() method
Parsed /Users/pposca/proyectos/kipeos-devops/hosts inventory source with ini plugin
Loading callback plugin minimal of type stdout, v2.0 from /Users/pposca/.virtualenvs/kipeos-devops/lib/python3.7/site-packages/ansible/plugins/callback/minimal.py
META: ran handlers
&lt;mydomain.com&gt; ESTABLISH SSH CONNECTION FOR USER: None
&lt;mydomain.com&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o 'ControlPath=/Volumes/Apple HDD/VDrive/Dropbox/Mackup/.ansible/cp/fc95ded756' mydomain.com '/bin/sh -c '"'"'echo ~ &amp;&amp; sleep 0'"'"''
&lt;mydomain.com&gt; (255, b'', b'command-line line 0: garbage at end of line; "HDD/VDrive/Dropbox/Mackup/.ansible/cp/fc95ded756".\r\n')
mydomain.com | UNREACHABLE! =&gt; {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: command-line line 0: garbage at end of line; \"HDD/VDrive/Dropbox/Mackup/.ansible/cp/fc95ded756\".",
    "unreachable": true
}
</code></pre></div>
<h5 dir="auto">VALUE OF THE VARIABLE 'b_args'</h5>
<p dir="auto">Note the whitespace after 'Apple':</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="(b'-o', b'ControlPath=/Volumes/Apple HDD/VDrive/Dropbox/Mackup/.ansible/cp/fc95ded756')"><pre class="notranslate"><code class="notranslate">(b'-o', b'ControlPath=/Volumes/Apple HDD/VDrive/Dropbox/Mackup/.ansible/cp/fc95ded756')
</code></pre></div>
<h5 dir="auto">RELATED ISSUES</h5>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="35377360" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/7713" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/7713/hovercard" href="https://github.com/ansible/ansible/issues/7713">#7713</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="266634747" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/31916" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/31916/hovercard" href="https://github.com/ansible/ansible/issues/31916">#31916</a></p>