From reviews-return-21684-apmail-mesos-reviews-archive=mesos.apache.org@mesos.apache.org Mon Jan 25 22:52:43 2016 Return-Path: X-Original-To: apmail-mesos-reviews-archive@minotaur.apache.org Delivered-To: apmail-mesos-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9DB5C18120 for ; Mon, 25 Jan 2016 22:52:43 +0000 (UTC) Received: (qmail 72205 invoked by uid 500); 25 Jan 2016 22:52:43 -0000 Delivered-To: apmail-mesos-reviews-archive@mesos.apache.org Received: (qmail 72185 invoked by uid 500); 25 Jan 2016 22:52:43 -0000 Mailing-List: contact reviews-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@mesos.apache.org Delivered-To: mailing list reviews@mesos.apache.org Received: (qmail 72172 invoked by uid 99); 25 Jan 2016 22:52:43 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jan 2016 22:52:43 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id DC09C288810; Mon, 25 Jan 2016 22:52:42 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============1432118478837960347==" MIME-Version: 1.0 Subject: Re: Review Request 42662: Added common command utils file. From: Jie Yu To: Jie Yu Cc: Jojy Varghese , mesos Date: Mon, 25 Jan 2016 22:52:42 -0000 Message-ID: <20160125225242.12173.68198@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: Jie Yu X-ReviewGroup: mesos X-Auto-Response-Suppress: DR, RN, OOF, AutoReply X-ReviewRequest-URL: https://reviews.apache.org/r/42662/ X-Sender: Jie Yu References: <20160125214527.12173.33695@reviews.apache.org> In-Reply-To: <20160125214527.12173.33695@reviews.apache.org> X-ReviewBoard-Diff-For: src/common/command_utils.hpp X-ReviewBoard-Diff-For: src/common/command_utils.cpp X-ReviewBoard-Diff-For: src/tests/common/command_utils_tests.cpp Reply-To: Jie Yu X-ReviewRequest-Repository: mesos --===============1432118478837960347== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On Jan. 25, 2016, 9:45 p.m., Jie Yu wrote: > > src/common/command_utils.cpp, line 46 > > > > > > We try to avoid using Option> 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 launch( > > const string& path, > > const vector& 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` 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. execvpe will search PATH as well. I don't understand why sh is able to find the executable while execvpe cannot. - Jie ----------------------------------------------------------- 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 > > --===============1432118478837960347==--