Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007672OCamlstandard librarypublic2017-11-15 22:252018-05-13 23:55
ReporterChristophe Troestler 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusacknowledgedResolutionopen 
Platformx86_64OSGNU/LinuxOS VersionDebian testing
Product Version4.06.0 
Target VersionFixed in Version 
Summary0007672: Sys.command and Windows quoting
DescriptionWhen quoting several arguments in a command that will be sent to Sys.command, on must also quote the whole string for Windows cmd. This was discussed in https://github.com/janestreet/jbuilder/issues/322 [^] ; the Windows quoting rules are at
- https://www.borngeek.com/2011/03/22/calls-to-system-in-windows/ [^]
- https://stackoverflow.com/a/9965141 [^]
Given these unusual quoting rules, adding a function to quote a full command (such as Filename.quote_command : string list -> string) should be discussed.
TagsNo tags attached.
Attached Files

- Relationships
related to 0006107acknowledged Lack of quoting helpers for use with Unix.open_process* 
related to 0007794new Proposal: Add open_process_args, for proc+args instead of a shell 

-  Notes
(0018669)
xleroy (administrator)
2017-11-17 19:21

That's not the first time we discuss the weird quoting conventions of cmd.exe. I'll try to find the relevant problem reports and link them here.

I'm not opposed to have a quoting function for invoking Sys.command as envisioned in the PR; only, it should be called Sys.quote_command because it has nothing to do with Filenames.
(0018670)
xleroy (administrator)
2017-11-18 18:04

On second thoughts, I'm not so sure that it should be called Sys.quote_command. That would probably create a circular dependency between modules Sys and Filename.
(0018671)
nojebar (developer)
2017-11-18 23:04

Closely related to https://caml.inria.fr/mantis/view.php?id=6107 [^]
(0018672)
Christophe Troestler (reporter)
2017-11-18 23:55

@xleroy Another possibility would be Sys.run : string -> string list -> int that would take care of escaping the command and its arguments.
(0018689)
xleroy (administrator)
2017-11-26 17:12

Pull request here: https://github.com/ocaml/ocaml/pull/1492 [^]

The suggested "Sys.run" is unhelpful, I think, because if you want file redirections or pipes or other special shell characters in the command given to Sys.command, they must NOT be escaped. The documentation included in the pull request points this out.

- Issue History
Date Modified Username Field Change
2017-11-15 22:25 Christophe Troestler New Issue
2017-11-17 19:21 xleroy Note Added: 0018669
2017-11-17 19:21 xleroy Status new => acknowledged
2017-11-18 18:04 xleroy Note Added: 0018670
2017-11-18 23:04 nojebar Note Added: 0018671
2017-11-18 23:55 Christophe Troestler Note Added: 0018672
2017-11-20 15:31 xleroy Relationship added related to 0006107
2017-11-26 17:12 xleroy Note Added: 0018689
2018-05-13 23:55 nojebar Relationship added related to 0007794


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker