title: execve fails with wrong arguments
body: <p>I want to replace my program with an interactive Bash shell. Launching works in Golang (with <code>os/exec.Command</code>) and Python (<code>os.system</code>) but not when I want to replace the process using <code>syscall.Exec()</code> or <code>os.execve()</code>.</p>
  <p>Demo Python code:</p>
  <pre><code>import os
  
  # first try with fork: OK
  os.system(&quot;/bin/bash --rcfile env.sh -i&quot;)
  
  # second try with execve: FAIL (exit after reading env.sh)
  os.execve(&quot;/bin/bash&quot;, [&quot;--rcfile&quot;, &quot;env.sh&quot;, &quot;-i&quot;], os.environ)
  </code></pre>
  <p>Contents of env.sh:</p>
  <pre><code>export PS1='interactive shell $ '
  echo inside env.sh
  ls -la /proc/self/fd
  </code></pre>
  <p>Python output:</p>
  <pre><code>$ echo &quot;Start: $$&quot;; python test.py; echo &quot;End: $$&quot;;
  Start: 684875
  inside env.sh
  total 0
  lrwx------ 1 willem willem 64 mrt 31 14:03 0 -&gt; /dev/pts/1
  lrwx------ 1 willem willem 64 mrt 31 14:03 1 -&gt; /dev/pts/1
  lrwx------ 1 willem willem 64 mrt 31 14:03 2 -&gt; /dev/pts/1
  lr-x------ 1 willem willem 64 mrt 31 14:03 3 -&gt; /proc/737221/fd
  interactive shell $ exit &lt;--- Control-D from me
  inside env.sh
  total 0
  lrwx------ 1 willem willem 64 mrt 31 14:03 0 -&gt; /dev/pts/1
  lrwx------ 1 willem willem 64 mrt 31 14:03 1 -&gt; /dev/pts/1
  lrwx------ 1 willem willem 64 mrt 31 14:03 2 -&gt; /dev/pts/1
  lr-x------ 1 willem willem 64 mrt 31 14:03 3 -&gt; /proc/737223/fd
  End: 684875
  </code></pre>
  <p>Any ideas how to debug why Bash would exit at the second run?</p>