mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Clemmer <clemmer.alexan...@gmail.com>
Subject Re: Review Request 46608: Libprocess: Implemented `subprocess_windows.cpp`.
Date Wed, 11 May 2016 21:52:43 GMT


> On May 11, 2016, 9:09 a.m., Michael Park wrote:
> > 3rdparty/libprocess/include/process/windows/subprocess.hpp, lines 122-181
> > <https://reviews.apache.org/r/46608/diff/5/?file=1378964#file1378964line122>
> >
> >     Follow-up to https://reviews.apache.org/r/46608/#comment195141: Since you say
that we don't need to escape quotes, let's change `const vector<string>& argv` to
`vector<string> argv` and all of this can be replaced with:
> >     
> >     ```
> >     string program = "\"" + argv[0] + "\"";
> >     argv.erase(argv.begin());
> >     string args = strings::join(" ", argv);
> >     string cmd = strings::join(" ", program, args);
> >     
> >     BOOL createProcessResult = CreateProcess(
> >       NULL,
> >       cmd.data(),
> >       ...);
> >     ```

Talked with Michael and dpravat a bit offline. For the time being, we are going to expect
that `argv` and `path` are correctly quoted when they are passed to the `subprocess` call.
It might not be a permanent solution, but the naive solution of wrapping `argv[0]` in quotes
is not going to cover all the corner cases. (For example, the path `C:\"Program Files"\foo.exe`.)

Our plan is to (1) just `strings::join(" ", argv)` and pass that as the command to `::CreateProcess`,
(2) leave a `NOTE` on this code explaining that if you want to pass a binary with a space
in it to `subprocess`, you get to quote that yourself for the time being, and (3) revisit
this when we touch the executor, which will give us the opportunity to figure out how `subprocess`
is being called, which will then help us decide how to handle this correctly, with minimum
complexity -- our goal here is to _not_ reimplement the CLI parser.


- Alex


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/46608/#review132623
-----------------------------------------------------------


On May 10, 2016, 11:44 p.m., Alex Clemmer wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46608/
> -----------------------------------------------------------
> 
> (Updated May 10, 2016, 11:44 p.m.)
> 
> 
> Review request for mesos, Alex Naparu, Daniel Pravat, Artem Harutyunyan, Joris Van Remoortere,
Michael Park, M Lawindi, and Yi Sun.
> 
> 
> Bugs: MESOS-3637
>     https://issues.apache.org/jira/browse/MESOS-3637
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Libprocess: Implemented `subprocess_windows.cpp`.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/subprocess_base.hpp PRE-CREATION 
>   3rdparty/libprocess/include/process/windows/subprocess.hpp PRE-CREATION 
>   3rdparty/libprocess/src/io.cpp 83e5f04f246b46880cfc34aa56441046b569b142 
>   3rdparty/libprocess/src/subprocess.cpp bb0fcbcd0dfa455c8700247c5b4ca0473fd163c3 
>   3rdparty/libprocess/src/subprocess_windows.cpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/46608/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alex Clemmer
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message