[wg-windows] mingw, ocamlopt and "input line is too long"

Andreas Hauptmann andreashauptmann at t-online.de
Thu Jul 7 15:10:06 BST 2016


On Thu, 7 Jul 2016 13:41:30 +0200
Alain Frisch wrote:

> On 07/07/2016 13:26, Andreas Hauptmann wrote:
> > Thanks,
> > it still needs to be fixed at least here:
> > https://github.com/alainfrisch/flexdll/blob/2aa2c0e22aa37515617245065cdbfee7108fc172/reloc.ml#L164  
> 
> Are you sure?  This goes through get_output, which already had the
> logic to use bash for long command line.

Indeed, but then there is something wrong with get_output,
otherwise https://github.com/alainfrisch/flexdll/issues/7 couldn't
occur (I've observed this error several times in the past).

Probably it's just the magic number that is too high. The following
program aborts before 8191 (or 8182):

--
let () =
  let rec iter s =
    let cmd = s ^ " >NUL 2>NUL" in
    if Sys.command cmd <> 0 then (
      Printf.eprintf "%d\n" @@ String.length cmd;
      exit 0
    )
    else
      iter (s ^ "a")
  in
  let b = Bytes.make 8100 'a' in
  let start = "echo a" in
  let () = Bytes.blit_string start 0 b 0 (String.length start) in
  iter (Bytes.to_string b)
--

It's 8160 for me, and another user even reports 8158:
http://forum.pellesc.de/index.php?topic=4975.5



More information about the wg-windows mailing list