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 
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 [^] ; the Windows quoting rules are at
- [^]
- [^]
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 0007794resolved Proposal: Add open_process_args, for proc+args instead of a shell 

-  Notes
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.
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.
nojebar (developer)
2017-11-18 23:04

Closely related to [^]
Christophe Troestler (reporter)
2017-11-18 23:55

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

Pull request here: [^]

The suggested "" 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