title: Inside a chroot execvp() returns "Argument list too long"
body: <p>I'm having an issue running a massive command inside a chroot. The command itself is triggered by a Makefile so the error is the classical:</p>
  
  <pre><code>make: execvp: /bin/sh: Argument list too long
  </code></pre>
  
  <p>I did investigate and I understood looking at make's source code that it creates a job via execvp() which is provided by libc (I've seen the command is passed as "/bin/sh" "-c" "...my arguments").
  So I looked the libc source and basically it looks there was a limit defined by ARG_MAX, however more recently it isn't used as the code says:</p>
  
  <pre><code>/* Legacy value of ARG_MAX.  The macro is now not defined since the
     actual value varies based on the stack size.  */
  #define legacy_ARG_MAX 131072
  </code></pre>
  
  <p>So it thought I need to change the stack size via:</p>
  
  <pre><code>ulimit -s VALUE
  </code></pre>
  
  <p>So I compared the value outside the chroot and I did set a much larger value inside the chroot. However same result...
  Do anyone have an idea? I don't know whether I'm investigating in the wrong direction or not.
  Thanks a lot for any help!</p>