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

need Julia API for UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS #13776

Closed
stevengj opened this issue Oct 26, 2015 · 1 comment · Fixed by #13780
Closed

need Julia API for UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS #13776

stevengj opened this issue Oct 26, 2015 · 1 comment · Fixed by #13780

Comments

@stevengj
Copy link
Member

As discussed in JuliaPy/Conda.jl#17, we really need an api like windows_verbatim(cmd) that is a no-op on Unix but sets the UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS flag on the command on Windows.

The reason is that, basically, Windows process spawning is completely insane, and how you pass arguments changes on a program-by-program basis.

On Unix, when you spawn a process, you pass a list of strings that are the arguments. On Windows, you pass a single string that represents the entire "command line", and the program is responsible for getting the command line and parsing it into arguments. Usually, programs do this parsing by splitting arguments at spaces, which means that passing arguments containing spaces depends on how the program did the parsing.

  • By default, libuv surrounds arguments containing spaces/tabs (or empty arguments) in double quotes " and backslash-escapes " and \. This will, however, confuse programs that don't look for these things when they parse their arguments.
  • libuv provides an option called UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS. If you set this option flag in the uv_process_t handle, then no quoting or escaping is done and the arguments are pasted verbatim into the "command-line" string. It is then up to the program to detect arguments that had spaces etc.

The Miniconda installer program expects the verbatim arguments to be passed, without quoting. We can do a crude simulation of this in Conda.jl by calling split on the arguments to break them into multiple arguments, but this doesn't handle arguments containing multiple consecutive spaces correctly. We really need a Julia API for UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS, because there is no single correct answer here.

@stevengj stevengj changed the title need Julia API for libuv UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS need Julia API for UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS Oct 26, 2015
@vtjnash vtjnash assigned vtjnash and unassigned vtjnash Oct 26, 2015
@stevengj
Copy link
Member Author

(Note that if programs use the CommandLineToArgvW function to parse the command line, then the parser rules apparently correspond to libuv's quoting, and so arguments with embedded spaces are handled mostly correctly (with a few exceptions noted in the comments). But some programs, e.g. the Anaconda installer, apparently do their own parsing and follow different rules.

justinmk pushed a commit to justinmk/neovim that referenced this issue Jan 9, 2017
Closes neovim#5360
References neovim#3305
Reverts commit dc9652e.

Disabling the quoting was does not solve the problem in general, and
we would end up having to handle the quoting ourselves.

See: JuliaLang/julia#13776
justinmk pushed a commit to justinmk/neovim that referenced this issue Jan 9, 2017
Closes neovim#5360
References neovim#3305
Reverts commit dc9652e.

Disabling the quoting was does not solve the problem in general, and
we would end up having to handle the quoting ourselves.

See: JuliaLang/julia#13776
justinmk pushed a commit to justinmk/neovim that referenced this issue Jan 10, 2017
Closes neovim#5360
References neovim#3305
Reverts commit dc9652e.

Disabling the quoting was does not solve the problem in general, and
we would end up having to handle the quoting ourselves.

See: JuliaLang/julia#13776
justinmk pushed a commit to justinmk/neovim that referenced this issue Jan 10, 2017
Closes neovim#5360
References neovim#3305
Reverts commit dc9652e.

Disabling the quoting was does not solve the problem in general, and
we would end up having to handle the quoting ourselves.

See: JuliaLang/julia#13776
justinmk pushed a commit to justinmk/neovim that referenced this issue Jan 10, 2017
Closes neovim#5360
References neovim#3305
Reverts commit dc9652e.

Disabling the quoting was does not solve the problem in general, and
we would end up having to handle the quoting ourselves.

See: JuliaLang/julia#13776
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants