Re: GNU make 4.2 (and 4.2.1) failing due to length of command-line

Adrian Muresan <[email protected]> Wed, 22 Jun 2016 20:36:04 +0000
Newsgroups gmane.comp.gnu.make.windows
Message-ID <BY2PR11MB058173F513285000A557D20EBE2C0@BY2PR11MB0581.namprd11.prod.outlook.com>
--===============5088445189277960428==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_BY2PR11MB058173F513285000A557D20EBE2C0BY2PR11MB0581namp_"

--_000_BY2PR11MB058173F513285000A557D20EBE2C0BY2PR11MB0581namp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Does batch_mode_shell =3D 1 mean that it always uses the sh.exe instead of =
Windows.cmd?

That would make sense why it's now working.
The limitation on cmd.exe is 8192

https://support.microsoft.com/en-us/kb/830473

But I have around 18k characters.

Sent from my iPhone

On Jun 22, 2016, at 3:57 PM, Paul Smith <[email protected]<mailto:[email protected]=
rg>> wrote:

On Wed, 2016-06-22 at 19:47 +0000, Adrian Muresan wrote:
In config.h, I uncommented the line
/* #define BATCH_MODE_ONLY_SHELL 1 */

this affects job.c

  static const char *sh_cmds_sh[] =3D
    { "cd", "eval", "exec", "exit", "login", "logout", "set",
"umask", "wait",
      "while", "for", "case", "if", ":", ".", "break", "continue",
"export",
      "read", "readonly", "shift", "times", "trap", "switch", "test",
#ifdef BATCH_MODE_ONLY_SHELL
      "echo",
#endif
      0 };

I can see where you might think this makes a difference, but really
this is not relevant.  These are used to decide whether or not to use
the "fast path" or require a shell to run the recipe.  Your script is
complex enough that make will always decide to run the shell so having
"echo" in this list won't make any difference.

The thing that is relevant to your situation is in main.c:

    if (!unixy_shell && sh_found
        && (strstr (default_shell, "sh") || strstr (default_shell, "SH")))
      {
        unixy_shell =3D 1;
       batch_mode_shell =3D 0;
      }

 #ifdef BATCH_MODE_ONLY_SHELL
    batch_mode_shell =3D 1;
 #endif

Here we first decide that we have a UNIX-like shell (because make finds
your sh.exe); if that's true then we disable batch_mode_shell because a
UNIX shell should be sufficiently powerful to not need it.

Setting that config.h option causes batch_mode_shell to be set to 1
(true) always, in all situations.

That change is what's working around your broken shell.

--_000_BY2PR11MB058173F513285000A557D20EBE2C0BY2PR11MB0581namp_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
</head>
<body dir=3D"auto">
<div>Does batch_mode_shell =3D 1 mean that it always uses the sh.exe instea=
d of Windows.cmd?</div>
<div><br>
</div>
<div>That would make sense why it's now working.&nbsp;</div>
<div>The limitation on cmd.exe is 8192</div>
<div><br>
</div>
<div><a href=3D"https://support.microsoft.com/en-us/kb/830473">https://supp=
ort.microsoft.com/en-us/kb/830473</a></div>
<div><br>
</div>
<div>But I have around 18k characters.&nbsp;<br>
<br>
<div>Sent from my iPhone</div>
</div>
<div><br>
On Jun 22, 2016, at 3:57 PM, Paul Smith &lt;<a href=3D"mailto:[email protected]=
g">[email protected]</a>&gt; wrote:<br>
<br>
</div>
<blockquote type=3D"cite">
<div><span>On Wed, 2016-06-22 at 19:47 &#43;0000, Adrian Muresan wrote:</sp=
an><br>
<blockquote type=3D"cite"><span>In&nbsp;config.h, I uncommented the line</s=
pan><br>
</blockquote>
<blockquote type=3D"cite"><span>/*&nbsp;#define BATCH_MODE_ONLY_SHELL 1 */<=
/span><br>
</blockquote>
<blockquote type=3D"cite"><span></span><br>
</blockquote>
<blockquote type=3D"cite"><span>this affects&nbsp;job.c</span><br>
</blockquote>
<blockquote type=3D"cite"><span></span><br>
</blockquote>
<blockquote type=3D"cite"><span>&nbsp; static const char *sh_cmds_sh[] =3D<=
/span><br>
</blockquote>
<blockquote type=3D"cite"><span>&nbsp; &nbsp; { &quot;cd&quot;, &quot;eval&=
quot;, &quot;exec&quot;, &quot;exit&quot;, &quot;login&quot;, &quot;logout&=
quot;, &quot;set&quot;,</span><br>
</blockquote>
<blockquote type=3D"cite"><span>&quot;umask&quot;, &quot;wait&quot;,</span>=
<br>
</blockquote>
<blockquote type=3D"cite"><span>&nbsp; &nbsp; &nbsp; &quot;while&quot;, &qu=
ot;for&quot;, &quot;case&quot;, &quot;if&quot;, &quot;:&quot;, &quot;.&quot=
;, &quot;break&quot;, &quot;continue&quot;,</span><br>
</blockquote>
<blockquote type=3D"cite"><span>&quot;export&quot;,</span><br>
</blockquote>
<blockquote type=3D"cite"><span>&nbsp; &nbsp; &nbsp; &quot;read&quot;, &quo=
t;readonly&quot;, &quot;shift&quot;, &quot;times&quot;, &quot;trap&quot;, &=
quot;switch&quot;, &quot;test&quot;,</span><br>
</blockquote>
<blockquote type=3D"cite"><span>#ifdef BATCH_MODE_ONLY_SHELL</span><br>
</blockquote>
<blockquote type=3D"cite"><span>&nbsp; &nbsp; &nbsp; &quot;echo&quot;,</spa=
n><br>
</blockquote>
<blockquote type=3D"cite"><span>#endif</span><br>
</blockquote>
<blockquote type=3D"cite"><span>&nbsp; &nbsp; &nbsp; 0 };</span><br>
</blockquote>
<span></span><br>
<span>I can see where you might think this makes a difference, but really</=
span><br>
<span>this is not relevant. &nbsp;These are used to decide whether or not t=
o use</span><br>
<span>the &quot;fast path&quot; or require a shell to run the recipe. &nbsp=
;Your script is</span><br>
<span>complex enough that make will always decide to run the shell so havin=
g</span><br>
<span>&quot;echo&quot; in this list won't make any difference.</span><br>
<span></span><br>
<span>The thing that is relevant to your situation is in main.c:</span><br>
<span></span><br>
<span>&nbsp; &nbsp; if (!unixy_shell &amp;&amp; sh_found</span><br>
<span>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;&amp; (strstr (defaul=
t_shell, &quot;sh&quot;) || strstr (default_shell, &quot;SH&quot;)))</span>=
<br>
<span>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{</span><br>
<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;unixy_shell =3D 1;</span><=
br>
<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;batch_mode_shell =3D 0;</sp=
an><br>
<span>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}</span><br>
<span></span><br>
<span>&nbsp;#ifdef BATCH_MODE_ONLY_SHELL</span><br>
<span>&nbsp; &nbsp;&nbsp;batch_mode_shell =3D 1;</span><br>
<span>&nbsp;#endif</span><br>
<span></span><br>
<span>Here we first decide that we have a UNIX-like shell (because make fin=
ds</span><br>
<span>your sh.exe); if that's true then we disable batch_mode_shell because=
 a</span><br>
<span>UNIX shell should be sufficiently powerful to not need it.</span><br>
<span></span><br>
<span>Setting that config.h option causes batch_mode_shell to be set to 1</=
span><br>
<span>(true) always, in all situations.</span><br>
<span></span><br>
<span>That change is what's working around your broken shell.</span><br>
</div>
</blockquote>
</body>
</html>

--_000_BY2PR11MB058173F513285000A557D20EBE2C0BY2PR11MB0581namp_--


--===============5088445189277960428==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Make-w32 mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/make-w32

--===============5088445189277960428==--