Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006107OCamlplatform support (windows, cross-compilation, etc)public2013-07-30 20:042014-08-21 11:26
Assigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0006107: Lack of quoting helpers for use with Unix.open_process*
DescriptionThe open_process family of functions runs the given string through the shell. On Windows it uses cmd.exe (by default). Unfortunately, quoting for cmd.exe is difficult.

This page explains a bit how to quote arguments properly: [^] .

I believe there should be helpers to quote for cmd.exe: the Unix module provides functions that are implemented but unusable on Windows. Currently, the known victims include ocamlbuild and ocamlfind, both of which will obviously have troubles relying on a separate library like Batteries or Core. I expect there are not the only ones.

The documentation should also be updated in order to explain that each argument should be quoted and that functions to do so are available.
TagsNo tags attached.
Attached Files

- Relationships
related to 0006096resolved Validate what is needed to fully support Windows 
related to 0004981resolvedxclerc ocamlbuild/ shouldn't call bash 
related to 0005138resolved option "-j" doesn't parallelize processes on windows 

-  Notes
lefessan (developer)
2013-07-30 20:19

Have you tried Filename.quote ?
Camarade_Tux (reporter)
2013-07-30 20:46

It's insufficient for cmd.exe.

Quoting [^] :
  If you use the special characters <, >, |, & or ^, you must precede them with the escape character (^) or quotation marks.

Filename.quote doesn't pay attention to these characters and shouldn't. What would be needed is another version of quote, specifically made for cmd.exe.

(and btw, testing that a round-trip doesn't alter the arguments should be part of the testsuite)
Camarade_Tux (reporter)
2013-07-30 21:19

Also, I believe that having functions of the create_process* family be able to return values of type {in,out}_channel like the functions of the family open_process* could solve the issue for almost all codes.
xleroy (administrator)
2013-08-01 10:59

Thanks for the link. I agree it would make sense to quote command lines passed to cmd.exe (Sys.command, Unix.create_process*) *on top of* the normal quoting of arguments that every user of these functions should do using Filename.quote.

Since the issue is rather tricky and Damien Doligez already spent a lot of time figuring out Filename.quote under Windows, sample code and tests are most welcome.
frisch (developer)
2014-05-14 12:30

Changing Severity, since this is not really a bug.

- Issue History
Date Modified Username Field Change
2013-07-30 20:04 Camarade_Tux New Issue
2013-07-30 20:19 lefessan Note Added: 0010014
2013-07-30 20:19 lefessan Status new => feedback
2013-07-30 20:46 Camarade_Tux Note Added: 0010019
2013-07-30 20:46 Camarade_Tux Status feedback => new
2013-07-30 21:19 Camarade_Tux Note Added: 0010022
2013-08-01 10:59 xleroy Note Added: 0010055
2013-08-01 10:59 xleroy Status new => acknowledged
2013-08-01 10:59 xleroy Target Version => 4.01.1+dev
2013-08-01 11:00 xleroy Relationship added related to 0006096
2013-08-01 11:01 xleroy Relationship added related to 0004981
2013-08-12 16:19 doligez Relationship added related to 0005138
2014-05-14 12:30 frisch Note Added: 0011455
2014-05-14 12:30 frisch Severity major => feature
2014-05-25 20:24 doligez Target Version 4.01.1+dev => 4.02.0+dev
2014-08-21 11:26 doligez Target Version 4.02.0+dev =>
2017-02-23 16:46 doligez Category OCaml windows => platform support (windows, etc)
2017-02-23 17:16 doligez Category platform support (windows, etc) => platform support (windows, cross-compilation, etc)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker