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

ocamlbuild/my_std.ml shouldn't call bash #4981

Closed
vicuna opened this issue Feb 17, 2010 · 9 comments
Closed

ocamlbuild/my_std.ml shouldn't call bash #4981

vicuna opened this issue Feb 17, 2010 · 9 comments

Comments

@vicuna
Copy link

vicuna commented Feb 17, 2010

Original bug ID: 4981
Reporter: samin
Assigned to: @xclerc
Status: resolved (set by @protz on 2012-01-18T10:18:15Z)
Resolution: suspended
Priority: normal
Severity: feature
Version: 3.11.2
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Related to: #5201 #6096 #6107
Monitored by: "Michael Soegtrop" @ygrek thelema Camarade_Tux @jberdine "Julien Signoles" gildor @Chris00 gerd

Bug description

On a vanilla Windows machine, with no cygwin, ocamlbuild falls over.

ocamlbuild calls bash.
But the presence of ocaml Windows distributions implies that I need not have bash on my os.

@vicuna
Copy link
Author

vicuna commented Apr 18, 2010

Comment author: @xavierleroy

As far as I can remember Windows's standard command-line interpreter (cmd.exe) is unusable in ocamlbuild's context (and in many others), because of its incomplete (and undocumented!) quoting behavior: there are plenty of commands that simply cannot be given as argument to "cmd /c" because they cannot be quoted properly. So, that leave little choice but going through a better shell like Cygwin's. Suggestions for alternative approaches most welcome. (Reclassified as "feature wish".)

@vicuna
Copy link
Author

vicuna commented Apr 26, 2010

Comment author: samin

I'm OK with this being reclassified as a feature wish.
Can you point me to the examples of what can't be run using Sys.command on Windows?

@vicuna
Copy link
Author

vicuna commented Apr 26, 2010

Comment author: ertai

I don't rember exactly the examples but try to pass an argument to a command that contains spaces, quotes, slashes, blackslashes and you will quickly found the problem.

@vicuna
Copy link
Author

vicuna commented Apr 26, 2010

Comment author: Julien Signoles

Bashisms are also an issue for BSD-like systems: that is not a Windows-only feature wish.

@vicuna
Copy link
Author

vicuna commented Apr 26, 2010

Comment author: ertai

Bashism is only when you call sh, here we call bash.

@vicuna
Copy link
Author

vicuna commented Jan 18, 2012

Comment author: @protz

Hi,

First of all, thanks for reporting. While we believe you're
making a valid point, we don't have enough manpower to devote to this feature in
the foreseeable future. We're moving this to the resolved/suspended status: this
means the discussion is still open, but the PR won't appear in our to-do list.
You're welcome to reopen the issue if you have a patch; we would gladly review
it.

Thanks,

jonathan

@vicuna vicuna closed this as completed Jan 18, 2012
@vicuna
Copy link
Author

vicuna commented May 30, 2012

Comment author: @ygrek

A description of windows quoting rules, including cmd.
http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx

@vicuna
Copy link
Author

vicuna commented May 30, 2012

Comment author: @protz

The next version of the Windows installer will encourage the user to install Cygwin. A few bugs have been fixed as well, and now ocamlbuild calls bash with what we believe is proper quoting. This should be announced in a few days, once we package the beta release of OCaml 4.00.

The official position is now: "if you want to get an ocaml development environment under Windows, just install cygwin". The windows installer will offer you the option of launching cygwin's setup.exe with the right set of packages preselected.

But of course we'd be glad to accept a patch that lifts the requirement on bash on Windows. That being said, I don't think anyone here wants to be the person who writes the patch :).

Thanks,

jonathan

@vicuna
Copy link
Author

vicuna commented Oct 5, 2016

Comment author: Michael Soegtrop

Dear OCaml Team,

I want to package a /small/ OCaml with Coq, so that native compute works. It would be nice to have ocamlbuild working as well.

I looked into the quoting issue. OCaml's Filename.quote doesn't seem to be appropriate for Windows. The quoting character for Windows is ^ and this character doesn't occur at all in Filename.ml, except as string concat, so this function is for sure wrong.

The "documentation" for quoting on Windows I tend to use is:

http://ss64.com/nt/syntax-esc.html

https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/

I would voulunteer to fix this and also to change ocamlbuild to not call bash or unix commands except for "raw shell script actions" (see https://github.com/ocaml/ocamlbuild/blob/13feb3cafc1f4f664aca0a744f2f08e30bffd06a/src/signatures.mli#L190)

Would this be appreciated for main stream OCaml, or should I just patch it for Coq?

Best regards,

Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant