Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sys.command and Windows quoting #7672

Open
vicuna opened this Issue Nov 15, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Nov 15, 2017

Original bug ID: 7672
Reporter: @Chris00
Status: acknowledged (set by @xavierleroy on 2017-11-17T18:21:08Z)
Resolution: open
Priority: normal
Severity: minor
Platform: x86_64
OS: GNU/Linux
OS Version: Debian testing
Version: 4.06.0
Category: standard library
Related to: #6107 #7794
Monitored by: @gasche

Bug description

When 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 ocaml/dune#322 ; the Windows quoting rules are at

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Nov 17, 2017

Comment author: @xavierleroy

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.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Nov 18, 2017

Comment author: @xavierleroy

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.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Nov 18, 2017

Comment author: @nojb

Closely related to #6107

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Nov 18, 2017

Comment author: @Chris00

@xLeroy Another possibility would be Sys.run : string -> string list -> int that would take care of escaping the command and its arguments.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Nov 26, 2017

Comment author: @xavierleroy

Pull request here: #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.