Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006332OCamlOCaml windowspublic2014-02-28 10:392014-05-16 20:51
Reporterprevosto 
Assigned Todoligez 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
Platformx86OSWindowsOS Version7
Product Version4.01.0 
Target VersionFixed in Version4.02.0+dev 
Summary0006332: Unix.open_process fails to pass empty arguments
DescriptionAs mentioned in PR#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 PR#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 Reproduceocamlc -o foo_ml.exe unix.cma foo_ml.ml
gcc -o foo_c.exe foo_c.c
./foo_ml.exe
TagsNo tags attached.
Attached Files? file icon patch-ab-create-process-blank-arg [^] (461 bytes) 2014-02-28 10:39 [Show Content]

- Relationships

-  Notes
(0011504)
doligez (administrator)
2014-05-16 20:51

Fixed in 4.02+dev7 (commit 14888)

- Issue History
Date Modified Username Field Change
2014-02-28 10:39 prevosto New Issue
2014-02-28 10:39 prevosto File Added: patch-ab-create-process-blank-arg
2014-05-16 20:27 doligez Assigned To => doligez
2014-05-16 20:27 doligez Status new => assigned
2014-05-16 20:51 doligez Note Added: 0011504
2014-05-16 20:51 doligez Status assigned => closed
2014-05-16 20:51 doligez Resolution open => fixed
2014-05-16 20:51 doligez Fixed in Version => 4.02.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker