-
Notifications
You must be signed in to change notification settings - Fork 82
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
Fix hack for bash when computing commands. #338
Conversation
The previous behavior was intentional (this was the only use of the |
Commands inside |
Now that this quoting is never done recursively, we would have the option to remove it from |
thinking about, it probably makes more sense to move the logic next to the bash invocation but I would rather do this change in #339. |
Also, I search a bit but could not find information about the behavior we're trying to avoid with this hack. @dra27 do you know anything about it ? |
The best place to put it would be https://github.com/ocaml/ocamlbuild/pull/339/files#diff-35ab9d070d2ae7c0fc3cf5506afdbcf99b86a4f8b2ef2b50c94903d11297c0f0R330 let prepare_command_for_windows cmd =
Array.append (Lazy.force windows_shell) [|"-c"; "''" ^ cmd|] |
IIRC this is all to do with how Cygwin applies quoting based on whether the caller is a Cygwin executable or a native Windows executable (as ocamlbuild is here). We have the same thing in opam, but solved very differently. However, it'd be far from trivial I expect to bring that all over from opam (the function When calling bash, I think this is definitely needed, therefore. On the basis that ocamlbuild has only been being used with these patches, it's probably better not to be shifting the logic too much without being able to "mass test" the existing packages which are using it? |
Is the present patch a subset of what's in the fdopen repo? I wasn't aware, and if so that does alleviate fears of regression. |
I've moved the |
I'm guessing that David was talking about the The current patch was not part of fdopen repo as far as I know. |
You haven't rebased the present PR with your new patch, I think. But I find the result simpler and I would be in favor of merging if the CI agrees. (I don't mind if we take some reasonable Windows-only risks in the upstream version, given the fact that upstream is already known-broken in many respects on Windows, it's a matter of improving and testing and being reactive in integrating your proposed improvements.) |
The patch is in #339 which sits on top of the current PR |
Okay. I understand what is going here in the present PR, and propose to go ahead and merge, but I haven't looked at #339 yet. |
We have the following hack in place when computing commands on win32
The current implementation also emit the empty string whenever it processes a
Quote spec
, this PR fixes this and only emit the empty string at the very beginning of the command.The diff is clearer if you ignore white-spaces