> On Jan. 25, 2016, 9:45 p.m., Jie Yu wrote: > > src/common/command_utils.cpp, line 46 > > <https://reviews.apache.org/r/42662/diff/1/?file=1205717#file1205717line46> > > > > We try to avoid using Option<vector<...>> since the semantics is not > > clear between None() and an empty vector. > > > > For this case, I would suggest we always use the argv version of > > subprocess to avoid escaping spaces. > > > > ``` > > static Future<string> launch( > > const string& path, > > const vector<string>& argv) > > { > > ... > > } > > ``` > > Jojy Varghese wrote: > I think we need both overloads of `subprocess` because `tar` would use > the `argv` version and command like `sha512` would use the other one. I have > the `Option<vector...>` here to differentiate between the two. > > Jie Yu wrote: > Why can't you use the argv version for sha512 as well? > > Jojy Varghese wrote: > I think it wont work because `argv` version uses the command passed to it > as name of the binary to `execve` and the `non-argv` one uses `sh` as the > binary. In fact i have tried using `argv` version of subprocess for `sha512` > and it doesnt work. > > Jie Yu wrote: > I don't understand. Both the argv and non-argv version use the same > underlying mecheniam (os::execvpe) to exec the process. Why one works and the > other one does not? > > Jojy Varghese wrote: > the `non-argv` one uses `sh` as the executable and passes ` {"sh", "-c", > command} ` as arguments to the command. Thats what I understood from L275 in > `3rdparty/libprocess/include/process/subprocess.hpp `. Let me know if I am > missing something. > > Jojy Varghese wrote: > Reading more code, I believe the difference is because of the PATH of > some commands. `tar`, `sh` are usually in the default PATH and shaXXX is not. > > Jie Yu wrote: > execvpe will search PATH as well. I don't understand why sh is able to > find the executable while execvpe cannot.
Reading further, i think you are right. There shouldnt be any difference. I will update the patch to use `argv`. I think when i tried earlier, I was not passing all the args to the exec. - Jojy ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/42662/#review116116 ----------------------------------------------------------- On Jan. 22, 2016, 5:38 p.m., Jojy Varghese wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/42662/ > ----------------------------------------------------------- > > (Updated Jan. 22, 2016, 5:38 p.m.) > > > Review request for mesos and Jie Yu. > > > Repository: mesos > > > Description > ------- > > This common file is a good place to add common command line utilities like > tar, > digests(sha256, sha512, etc). Currently this functionality is spread in the > code > base and this change would enable all those call sites to be replaced with a > common code. > > > Diffs > ----- > > src/CMakeLists.txt 47d0a7c0fe73b9297cd7dde6086b5e6e9e1f9e4e > src/Makefile.am 19bf3a7c2e43ca04ed6e6d506e052de5537f7c2f > src/common/command_utils.hpp PRE-CREATION > src/common/command_utils.cpp PRE-CREATION > src/tests/common/command_utils_tests.cpp PRE-CREATION > > Diff: https://reviews.apache.org/r/42662/diff/ > > > Testing > ------- > > make check. > > > Thanks, > > Jojy Varghese > >