You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 6332 Reporter: prevosto Assigned to:@damiendoligez Status: closed (set by @damiendoligez on 2014-05-16T18:51:01Z) Resolution: fixed Priority: normal Severity: minor Platform: x86 OS: Windows OS Version: 7 Version: 4.01.0 Fixed in version: 4.02.0+dev Category: platform support (windows, cross-compilation, etc) Monitored by: bobot
Bug description
As mentioned in #6107, under Windows, Unix.open_process and friends build a command-line string from the argv array.
Doing this, they fail to properly quote an empty string given as argument, as can be seen with the following example:
=== foo_ml.ml ===
let a = [| "./foo_c.exe"; ""; |];;
Printf.printf "number of args passed to create_process is %d\n%!" (Array.length a);
Unix.create_process "./foo_c.exe" a Unix.stdin Unix.stdout Unix.stderr
;;
exit 0;;
=== foo_c.c ===== (taken from #2939)
#include <stdio.h>
#include <windows.h>
int main(int argc, char ** argv)
{
int i;
printf("Raw command line is:\n%s\n", GetCommandLine());
printf("Number of args is: %d\n",argc);
printf("Parsed command line is:\n");
for (i = 0; i < argc; i++) printf("\targv[%d] = %s\n", i, argv[i]);
return 0;
}
Original bug ID: 6332
Reporter: prevosto
Assigned to: @damiendoligez
Status: closed (set by @damiendoligez on 2014-05-16T18:51:01Z)
Resolution: fixed
Priority: normal
Severity: minor
Platform: x86
OS: Windows
OS Version: 7
Version: 4.01.0
Fixed in version: 4.02.0+dev
Category: platform support (windows, cross-compilation, etc)
Monitored by: bobot
Bug description
As mentioned in #6107, under Windows, Unix.open_process and friends build a command-line string from the argv array.
Doing this, they fail to properly quote an empty string given as argument, as can be seen with the following example:
=== foo_ml.ml ===
let a = [| "./foo_c.exe"; ""; |];;
Printf.printf "number of args passed to create_process is %d\n%!" (Array.length a);
Unix.create_process "./foo_c.exe" a Unix.stdin Unix.stdout Unix.stderr
;;
exit 0;;
=== foo_c.c ===== (taken from #2939)
#include <stdio.h>
#include <windows.h>
int main(int argc, char ** argv)
{
int i;
printf("Raw command line is:\n%s\n", GetCommandLine());
printf("Number of args is: %d\n",argc);
printf("Parsed command line is:\n");
for (i = 0; i < argc; i++) printf("\targv[%d] = %s\n", i, argv[i]);
return 0;
}
The attached patch will take care of the issue
Steps to reproduce
ocamlc -o foo_ml.exe unix.cma foo_ml.ml
gcc -o foo_c.exe foo_c.c
./foo_ml.exe
File attachments
The text was updated successfully, but these errors were encountered: